C# Class NanoByte.Common.RegistryUtils

Provides utility and extension methods for Registry access.
ファイルを表示 Open project: nano-byte/common

Public Methods

Method Description
DeleteSoftwareValue ( [ subkeyName, [ valueName, bool machineWide ) : void

Deletes a value from one of the SOFTWARE keys in the registry.

Does not throw an exception for missing keys or values.

GetDword ( [ keyName, [ valueName, int defaultValue ) : int

Reads a DWORD value from the registry.

SetDword ( [ keyName, [ valueName, int value ) : void

Sets a DWORD value in the registry.

SetSoftwareString ( [ subkeyName, [ valueName, [ value, bool machineWide = false ) : void

Sets a string value in one or more of the SOFTWARE keys in the registry.

SetString ( [ keyName, [ valueName, [ value ) : void

Sets a string value in the registry.

Private Methods

Method Description
CreateSubKeyChecked ( [ key, [ subkeyName ) : RegistryKey
DeleteValue ( RegistryKey root, string subkeyName, string valueName ) : void
GetSoftwareString ( [ subkeyName, [ valueName, [ defaultValue = null ) : string
GetSoftwareString ( [ subkeyName, [ valueName, bool machineWide ) : string
GetString ( [ keyName, [ valueName, [ defaultValue = null ) : string
GetSubKeyNames ( [ key, [ subkeyName ) : string[]
GetValueNames ( [ key, [ subkeyName ) : string[]
OpenHklmKey ( [ subkeyName, bool &x64 ) : RegistryKey
OpenSubKeyChecked ( [ key, [ subkeyName, bool writable = false ) : RegistryKey

Method Details

DeleteSoftwareValue() public static method

Deletes a value from one of the SOFTWARE keys in the registry.
Does not throw an exception for missing keys or values.
Registry access failed.
public static DeleteSoftwareValue ( [ subkeyName, [ valueName, bool machineWide ) : void
subkeyName [ The path of the key relative to the SOFTWARE key.
valueName [ The name of the value to delete.
machineWide bool true to delete from HKLM/SOFTWARE (and HKLM/SOFTWARE/Wow6432Node if ); false to delete from HCKU/SOFTWARE.
return void

GetDword() public static method

Reads a DWORD value from the registry.
Registry access failed.
public static GetDword ( [ keyName, [ valueName, int defaultValue ) : int
keyName [ The full path of the key to read from.
valueName [ The name of the value to read.
defaultValue int The default value to return if the key or value does not exist.
return int

SetDword() public static method

Sets a DWORD value in the registry.
Registry access failed. Write access to the key is not permitted.
public static SetDword ( [ keyName, [ valueName, int value ) : void
keyName [ The full path of the key to write to.
valueName [ The name of the value to write.
value int The value to write.
return void

SetSoftwareString() public static method

Sets a string value in one or more of the SOFTWARE keys in the registry.
Registry access failed. Write access to the key is not permitted.
public static SetSoftwareString ( [ subkeyName, [ valueName, [ value, bool machineWide = false ) : void
subkeyName [ The path of the key relative to the SOFTWARE key.
valueName [ The name of the value to write.
value [ The value to write.
machineWide bool true to write to HKLM/SOFTWARE (and HKLM/SOFTWARE/Wow6432Node if ); false to write to HCKU/SOFTWARE.
return void

SetString() public static method

Sets a string value in the registry.
Registry access failed. Write access to the key is not permitted.
public static SetString ( [ keyName, [ valueName, [ value ) : void
keyName [ The full path of the key to write to.
valueName [ The name of the value to write.
value [ The value to write.
return void