private RegistryKey cvtKey(clsRegistry.RootKeyConstants RootKey) { RegistryKey functionReturnValue = null; functionReturnValue = null; switch (RootKey) { case RootKeyConstants.HKEY_CLASSES_ROOT: functionReturnValue = Microsoft.Win32.Registry.ClassesRoot; break; case RootKeyConstants.HKEY_CURRENT_CONFIG: functionReturnValue = Microsoft.Win32.Registry.CurrentConfig; break; case RootKeyConstants.HKEY_CURRENT_USER: functionReturnValue = Microsoft.Win32.Registry.CurrentUser; break; case RootKeyConstants.HKEY_LOCAL_MACHINE: functionReturnValue = Microsoft.Win32.Registry.LocalMachine; break; case RootKeyConstants.HKEY_USERS: functionReturnValue = Microsoft.Win32.Registry.Users; break; } return(functionReturnValue); }
public void SaveRegistrySetting(clsRegistry.RootKeyConstants RootKey, string Key, string Value, object Data) { if ((mSupport != null) && (mSupport.Registry != null)) { mSupport.Registry.SaveRegistrySetting(RootKey, Key, Value, Data); } }
public void CreateRegistryKey(clsRegistry.RootKeyConstants RootKey, string KeyName) { RegistryKey Reg = null; try { //Iterate through the KeyName making sure each sub-key exists (create as necessary)... string[] SubKeys = KeyName.Split('\\'); string Key = SubKeys[0]; for (short i = 1; i <= SubKeys.Length - 1; i++) { string SubKey = string.Format("{0}\\{1}", Key, SubKeys[i]); if (!this.RegistryKeyExists(RootKey, SubKey)) { Reg = cvtKey(RootKey).OpenSubKey(Key, true); Reg.CreateSubKey(SubKeys[i]); Reg.Close(); Reg = null; } Key = SubKey; } } catch (System.Exception ex) { } finally { if ((Reg != null)) { Reg.Close(); } } }
public object GetRegistrySetting(clsRegistry.RootKeyConstants RootKey, string Key, string Value, object vDefault) { object functionReturnValue = null; functionReturnValue = null; if ((mSupport != null) && (mSupport.Registry != null)) { return(mSupport.Registry.GetRegistrySetting(RootKey, Key, Value, vDefault)); } return(functionReturnValue); }
public void SaveRegistrySetting(clsRegistry.RootKeyConstants RootKey, string KeyName, string ValueName, object Data) { object CurrentValue = this.GetRegistrySetting(RootKey, KeyName, ValueName, clsSupport.bpeNullString); if (CurrentValue.ToString() == clsSupport.bpeNullString) { this.CreateRegistryKey(RootKey, KeyName); } if (CurrentValue.ToString() != Data.ToString()) { this.SetRegistryKeyValue(RootKey, KeyName, ValueName, Data); } }
public object GetRegistrySetting(clsRegistry.RootKeyConstants RootKey, string KeyName, string ValueName, object vDefault = null) { object functionReturnValue = null; functionReturnValue = null; functionReturnValue = this.GetRegistryKeyValue(RootKey, KeyName, ValueName, vDefault); if (functionReturnValue == null) { //Assume GetRegistryKeyValue returned Nothing because the key doesn't yet exist... //Rather than sweat the details of the significance of the missing key, simply return the default value //(we'll worry about the missing key in SaveRegistrySetting if it comes to that)... functionReturnValue = vDefault; } return(functionReturnValue); }
public void SetRegistryKeyValue(clsRegistry.RootKeyConstants RootKey, string KeyName, string ValueName, object Data) { RegistryKey Reg = null; try { Reg = cvtKey(RootKey).OpenSubKey(KeyName, true); if ((Reg != null)) { Reg.SetValue(ValueName, Data); } } catch (System.Exception ex) { } finally { if ((Reg != null)) { Reg.Close(); } } }
public void DeleteRegistryKey(clsRegistry.RootKeyConstants RootKey, string KeyName, string SubKey) { RegistryKey Reg = null; try { Reg = cvtKey(RootKey).OpenSubKey(KeyName, true); if ((Reg != null)) { Reg.DeleteSubKey(SubKey); } } catch (System.Exception ex) { } finally { if ((Reg != null)) { Reg.Close(); } } }
public bool RegistryKeyExists(clsRegistry.RootKeyConstants RootKey, string KeyName) { bool functionReturnValue = false; RegistryKey Reg = null; functionReturnValue = false; try { Reg = cvtKey(RootKey).OpenSubKey(KeyName); if ((Reg != null)) { functionReturnValue = true; } } catch (System.Exception ex) { } finally { if ((Reg != null)) { Reg.Close(); } } return(functionReturnValue); }
public object GetRegistryKeyValue(clsRegistry.RootKeyConstants RootKey, string KeyName, string ValueName, object vDefault) { object functionReturnValue = null; RegistryKey Reg = null; functionReturnValue = null; try { Reg = cvtKey(RootKey).OpenSubKey(KeyName); if ((Reg != null)) { functionReturnValue = Reg.GetValue(ValueName, vDefault); } } catch (System.Exception ex) { } finally { if ((Reg != null)) { Reg.Close(); } } return(functionReturnValue); }