278 lines
8.9 KiB
C#
278 lines
8.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Win32;
|
|
|
|
namespace NX_Installation
|
|
{
|
|
class ReadWriteRegistry
|
|
{
|
|
CreateReadWriteDeleteRegistry reg =
|
|
new CreateReadWriteDeleteRegistry();
|
|
|
|
public string ReadNxOnlineFromRegistry()
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "NX_VAI_ONLINE";
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetNxOnlineToRegistry(string NxOnline)
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "NX_VAI_ONLINE";
|
|
reg.Value = NxOnline;
|
|
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadNxOfflineFromRegistry()
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "NX_VAI_OFFLINE";
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetNxOfflineToRegistry(string NxOffline)
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "NX_VAI_OFFLINE";
|
|
reg.Value = NxOffline;
|
|
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadLocationFromRegistry()
|
|
{
|
|
reg.SubKey = @"SOFTWARE\NX-Portal";
|
|
reg.Key = "Location";
|
|
|
|
return reg.ReadSubkey();
|
|
}
|
|
|
|
public void SetLocationToRegistry(string Location)
|
|
{
|
|
reg.SubKey = @"SOFTWARE\NX-Portal";
|
|
reg.Key = "Location";
|
|
reg.Value = Location;
|
|
|
|
reg.WriteSubkey();
|
|
}
|
|
|
|
public string ReadUserprofileFromRegistry()
|
|
{
|
|
reg.SubKey = @"SOFTWARE\NX-Portal";
|
|
reg.Key = "Userprofile";
|
|
|
|
return reg.ReadSubkey();
|
|
}
|
|
|
|
public void SetUserprofileToRegistry(string Userprofile)
|
|
{
|
|
reg.SubKey = @"SOFTWARE\NX-Portal";
|
|
reg.Key = "Userprofile";
|
|
reg.Value = Userprofile;
|
|
|
|
reg.WriteSubkey();
|
|
}
|
|
|
|
public string ReadComputerTypeFromRegistry()
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "COMPUTER_TYPE";
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetComputerTypeToRegistry(string ComputerType)
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "COMPUTER_TYPE";
|
|
reg.Value = ComputerType;
|
|
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadConnectionTypeFromRegistry()
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "CONNECTION_TYPE";
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetConnectionTypeToRegistry(string ConnectionType)
|
|
{
|
|
reg.SubKey = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment";
|
|
reg.Key = "CONNECTION_TYPE";
|
|
reg.Value = ConnectionType;
|
|
|
|
RegistryKey newKey = Registry.LocalMachine.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadUgiiBaseDirFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_BASE_DIR";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetUgiiBaseDirToRegistry(string UgiiBaseDir)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_BASE_DIR";
|
|
reg.Value = UgiiBaseDir;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadUgiiRootDirFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_ROOT_DIR";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetUgiiRootDirToRegistry(string UgiiRootDir)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_ROOT_DIR";
|
|
reg.Value = UgiiRootDir;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadUgiiLangFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_LANG";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetUgiiLangToRegistry(string UgiiLang)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_LANG";
|
|
reg.Value = UgiiLang;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadUgiiTmpDirFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_TMP_DIR";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetUgiiTmpDirToRegistry(string UgiiTmpDir)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_TMP_DIR";
|
|
reg.Value = UgiiTmpDir;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadUgsLicenseServerFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGS_LICENSE_SERVER";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetUgsLicenseServerToRegistry(string UgsLicenseServer)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGS_LICENSE_SERVER";
|
|
reg.Value = UgsLicenseServer;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadUgsLicenseBundleFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGS_LICENSE_BUNDLE";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetUgsLicenseBundleToRegistry(string UgsLicenseBundle)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGS_LICENSE_BUNDLE";
|
|
reg.Value = UgsLicenseBundle;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadMaxFitBoxSizeFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_MAX_FIT_BOX_SIZE";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetMaxFitBoxSizeToRegistry(string MaxFitBoxSize)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "UGII_MAX_FIT_BOX_SIZE";
|
|
reg.Value = MaxFitBoxSize;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
|
|
public string ReadJavaHomeFromRegistry()
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "JAVA_HOME";
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
|
|
return newKey.GetValue(reg.Key).ToString();
|
|
}
|
|
|
|
public void SetJavaHomeToRegistry(string JavaHome)
|
|
{
|
|
reg.SubKey = @"Environment";
|
|
reg.Key = "JAVA_HOME";
|
|
reg.Value = JavaHome;
|
|
|
|
RegistryKey newKey = Registry.CurrentUser.CreateSubKey(reg.SubKey);
|
|
newKey.SetValue(reg.Key, reg.Value);
|
|
}
|
|
}
|
|
}
|