#region Determines whether the registry key exists
/// <summary>
/// To determine whether the registry key exists, the default is to judge under the registry base key HKEY_LOCAL_MACHINE (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// Example: If the Domain and SubKey attributes are set, then Domain\\SubKey is judged. Otherwise, the default judgment is HKEY_LOCAL_MACHINE\\software\\
/// </summary>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist()
{
///Determine whether the registry key name is empty. If it is empty, return false
if (_subkey == || _subkey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(_subkey, _domain);
if (sKey == null)
{
return false;
}
return true;
}
/// <summary>
/// Determine whether the registry key exists. The default is to judge under the registry base key HKEY_LOCAL_MACHINE
/// Virtual method, subclasses can be rewrite
/// Example: If the subkey is software\\higame\\, it will be determined whether the HKEY_LOCAL_MACHINE\\software\\higame\\registry key exists
/// </summary>
/// <param name="subKey">registry key name</param>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist(string subKey)
{
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(subKey);
if (sKey == null)
{
return false;
}
return true;
}
/// <summary>
/// Determine whether the registry key exists
/// Virtual method, subclasses can be rewrite
/// Example: If regDomain is HKEY_CLASSES_ROOT, it will be determined whether the HKEY_CLASSES_ROOT\\SubKey registry key exists
/// </summary>
/// <param name="regDomain">registry base domain</param>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist(RegDomain regDomain)
{
///Determine whether the registry key name is empty. If it is empty, return false
if (_subkey == || _subkey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(_subkey, regDomain);
if (sKey == null)
{
return false;
}
return true;
}
/// <summary>
/// Determine whether the registry key exists (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// Example: If regDomain is HKEY_CLASSES_ROOT and subkey is software\\higame\\, it will be determined whether the HKEY_CLASSES_ROOT\\software\\higame\\registry key exists
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist(string subKey, RegDomain regDomain)
{
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(subKey, regDomain);
if (sKey == null)
{
return false;
}
return true;
}
#endregion
#region Delete registry keys
/// <summary>
/// Delete the registry key (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <returns> Return true if the deletion is successful, otherwise false</returns>
public virtual bool DeleteSubKey()
{
///Return to whether the deletion was successful
bool result = false;
///Determine whether the registry key name is empty. If it is empty, return false
if (_subkey == || _subkey == null)
{
return false;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
if (IsSubKeyExist())
{
try
{
///Delete the registry key
(_subkey);
result = true;
}
catch
{
result = false;
}
}
/// Close changes to registry key
();
return result;
}
/// <summary>
/// Delete the registry key (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <returns> Return true if the deletion is successful, otherwise false</returns>
public virtual bool DeleteSubKey(string subKey)
{
///Return to whether the deletion was successful
bool result = false;
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
if (IsSubKeyExist())
{
try
{
///Delete the registry key
(subKey);
result = true;
}
catch
{
result = false;
}
}
/// Close changes to registry key
();
return result;
}
/// <summary>
/// Delete the registry key
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Return true if the deletion is successful, otherwise false</returns>
public virtual bool DeleteSubKey(string subKey, RegDomain regDomain)
{
///Return to whether the deletion was successful
bool result = false;
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(regDomain);
if (IsSubKeyExist(subKey, regDomain))
{
try
{
///Delete the registry key
(subKey);
result = true;
}
catch
{
result = false;
}
}
/// Close changes to registry key
();
return result;
}
#endregion
#region determines whether the key value exists
/// <summary>
/// Determine whether the key value exists (please set the SubKey and RegeditKey properties first)
/// Virtual method, subclasses can be rewrite
/// 1. If RegeditKey is empty or null, return false
/// 2. If SubKey is empty, null, or the registry key specified by SubKey does not exist, return false
/// </summary>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist()
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (_regeditkey == || _regeditkey == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey();
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, _regeditkey, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Determine whether the key value exists (please set the SubKey property first)
/// Virtual method, subclasses can be rewrite
/// If SubKey is empty, null, or the registry key specified by SubKey does not exist, return false
/// </summary>
/// <param name="name">Key value name</param>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist(string name)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (name == || name == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey();
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, name, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Determine whether the key value exists
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist(string name, string subKey)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (name == || name == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey);
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, name, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Determine whether the key value exists
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist(string name, string subKey, RegDomain regDomain)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (name == || name == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey, regDomain);
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, name, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
#endregion
#region Set key-value content
/// <summary>
/// Set the specified key value content, not specify the content data type (please set the RegeditKey and SubKey properties first)
/// If there is a key change value, modify the key value content. If there is no key value, create the key value first and then set the key value content.
/// </summary>
/// <param name="content">Key-value content</param>
/// <returns>Return true if the key value content is set successfully, otherwise false will be returned</returns>
public virtual bool WriteRegeditKey(object content)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (_regeditkey == || _regeditkey == null)
{
return false;
}
///Discern whether the registry key exists. If it does not exist, create it directly
if (!IsSubKeyExist(_subkey))
{
CreateSubKey(_subkey);
}
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
/// If the registry key is opened, return false
if (key == null)
{
return false;
}
try
{
(_regeditkey, content);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Set the specified key value content, not specify the content data type (please set the SubKey attribute first)
/// If there is a key change value, modify the key value content. If there is no key value, create the key value first and then set the key value content.
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="content">Key-value content</param>
/// <returns>Return true if the key value content is set successfully, otherwise false will be returned</returns>
public virtual bool WriteRegeditKey(string name, object content)
{
///Return result
bool result = false;
///Judge whether the key value exists
if (name == || name == null)
{
return false;
}
///Discern whether the registry key exists. If it does not exist, create it directly
if (!IsSubKeyExist(_subkey))
{
CreateSubKey(_subkey);
}
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
/// If the registry key is opened, return false
if (key == null)
{
return false;
}
try
{
(name, content);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Set the specified key value content and specify the content data type (please set the SubKey attribute first)
/// If there is a key change value, modify the key value content. If there is no key value, create the key value first and then set the key value content.
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="content">Key-value content</param>
/// <returns>Return true if the key value content is set successfully, otherwise false will be returned</returns>
public virtual bool WriteRegeditKey(string name, object content, RegValueKind regValueKind)
{
///Return result
bool result = false;
///Judge whether the key value exists
if (name == || name == null)
{
return false;
}
///Discern whether the registry key exists. If it does not exist, create it directly
if (!IsSubKeyExist(_subkey))
{
CreateSubKey(_subkey);
}
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
/// If the registry key is opened, return false
if (key == null)
{
return false;
}
try
{
(name, content, GetRegValueKind(regValueKind));
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
return result;
}
#endregion
#region Read key-value content
/// <summary>
/// Read key value content (please set the RegeditKey and SubKey properties first)
/// 1. If the RegeditKey is empty, null or the key value indicated by RegeditKey does not exist, return null
/// 2. If the SubKey is empty, null or the registry key indicated by SubKey does not exist, return null
/// 3. Otherwise, return key-value content
/// </summary>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey()
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (_regeditkey == || _regeditkey == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(_regeditkey))
{
///Open the registry key
RegistryKey key = OpenSubKey();
if (key != null)
{
obj = (_regeditkey);
}
/// Close changes to registry key
();
}
return obj;
}
/// <summary>
/// Read key value content (please set the SubKey property first)
/// 1. If the SubKey is empty, null or the registry key indicated by SubKey does not exist, return null
/// 2. Otherwise, return key-value content
/// </summary>
/// <param name="name">Key value name</param>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey(string name)
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (name == || name == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key
RegistryKey key = OpenSubKey();
if (key != null)
{
obj = (name);
}
/// Close changes to registry key
();
}
return obj;
}
/// <summary>
/// Read key-value content
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey(string name, string subKey)
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (name == || name == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey);
if (key != null)
{
obj = (name);
}
/// Close changes to registry key
();
}
return obj;
}
/// <summary>
/// Read key-value content
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey(string name, string subKey, RegDomain regDomain)
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (name == || name == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey, regDomain);
if (key != null)
{
obj = (name);
}
/// Close changes to registry key
();
}
return obj;
}
#endregion
#region Delete key value
/// <summary>
/// Delete the key value (please set the RegeditKey and SubKey properties first)
/// 1. If the RegeditKey is empty, null or the key value indicated by RegeditKey does not exist, return false
/// 2. If the SubKey is empty, null, or the registry key indicated by SubKey does not exist, return false
/// </summary>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey()
{
///Delete the result
bool result = false;
///Discribing whether to set the key value attribute. If it is not set, return false
if (_regeditkey == || _regeditkey == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(_regeditkey))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
if (key != null)
{
try
{
///Delete the key value
(_regeditkey);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
/// <summary>
/// Delete the key value (please set the SubKey property first)
/// If the registry key indicated by SubKey is empty, null, or the SubKey does not exist, return false
/// </summary>
/// <param name="name">Key value name</param>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey(string name)
{
///Delete the result
bool result = false;
///Judge whether the key value name is empty. If it is empty, return false
if (name == || name == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
if (key != null)
{
try
{
///Delete the key value
(name);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
/// <summary>
/// Delete key value
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey(string name, string subKey)
{
///Delete the result
bool result = false;
///Direquire whether the key value name and registry key name are empty. If it is empty, return false
if (name == || name == null || subKey == || subKey == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(subKey, true);
if (key != null)
{
try
{
///Delete the key value
(name);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
/// <summary>
/// Delete key value
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey(string name, string subKey, RegDomain regDomain)
{
///Delete the result
bool result = false;
///Direquire whether the key value name and registry key name are empty. If it is empty, return false
if (name == || name == null || subKey == || subKey == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(subKey, regDomain, true);
if (key != null)
{
try
{
///Delete the key value
(name);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
#endregion
#endregion
#region Protected Method
/// <summary>
/// Get the top-level node corresponding to the registry base key field
/// Example: If regDomain is ClassesRoot, return
/// </summary>
/// <param name="regDomain">registry base domain</param>
/// <returns>Registration base domain corresponds to top-level node</returns>
protected RegistryKey GetRegDomain(RegDomain regDomain)
{
///Create a node based on registry base
RegistryKey key;
#region determines the registry base domain
switch (regDomain)
{
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
default:
key = ; break;
}
#endregion
return key;
}
/// <summary>
/// Get the corresponding value data type in the registry
/// Example: If regValueKind is DWord, return
/// </summary>
/// <param name="regValueKind">registry data type</param>
/// <returns>The corresponding data type in the registry</returns>
protected RegistryValueKind GetRegValueKind(RegValueKind regValueKind)
{
RegistryValueKind regValueK;
#region Determine registry data type
switch (regValueKind)
{
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
default:
regValueK = ; break;
}
#endregion
return regValueK;
}
#region Open registry key
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey()
{
///Document whether the registry key name is empty
if (_subkey == || _subkey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (_subkey);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="writable">Set to true if write access to an item is required</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(bool writable)
{
///Document whether the registry key name is empty
if (_subkey == || _subkey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (_subkey, writable);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="writable">Set to true if write access to an item is required</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey, bool writable)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey, writable);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey, RegDomain regDomain)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(regDomain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <param name="writable">Set to true if write access to an item is required</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey, RegDomain regDomain, bool writable)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(regDomain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey, writable);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
#endregion
#endregion
}
/// <summary>
/// To determine whether the registry key exists, the default is to judge under the registry base key HKEY_LOCAL_MACHINE (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// Example: If the Domain and SubKey attributes are set, then Domain\\SubKey is judged. Otherwise, the default judgment is HKEY_LOCAL_MACHINE\\software\\
/// </summary>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist()
{
///Determine whether the registry key name is empty. If it is empty, return false
if (_subkey == || _subkey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(_subkey, _domain);
if (sKey == null)
{
return false;
}
return true;
}
/// <summary>
/// Determine whether the registry key exists. The default is to judge under the registry base key HKEY_LOCAL_MACHINE
/// Virtual method, subclasses can be rewrite
/// Example: If the subkey is software\\higame\\, it will be determined whether the HKEY_LOCAL_MACHINE\\software\\higame\\registry key exists
/// </summary>
/// <param name="subKey">registry key name</param>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist(string subKey)
{
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(subKey);
if (sKey == null)
{
return false;
}
return true;
}
/// <summary>
/// Determine whether the registry key exists
/// Virtual method, subclasses can be rewrite
/// Example: If regDomain is HKEY_CLASSES_ROOT, it will be determined whether the HKEY_CLASSES_ROOT\\SubKey registry key exists
/// </summary>
/// <param name="regDomain">registry base domain</param>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist(RegDomain regDomain)
{
///Determine whether the registry key name is empty. If it is empty, return false
if (_subkey == || _subkey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(_subkey, regDomain);
if (sKey == null)
{
return false;
}
return true;
}
/// <summary>
/// Determine whether the registry key exists (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// Example: If regDomain is HKEY_CLASSES_ROOT and subkey is software\\higame\\, it will be determined whether the HKEY_CLASSES_ROOT\\software\\higame\\registry key exists
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Returns whether the registry key exists, and returns true if it exists, otherwise returns false</returns>
public virtual bool IsSubKeyExist(string subKey, RegDomain regDomain)
{
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Retrieve registry subkey
///If sKey is null, it means that the registry key does not exist, otherwise it exists
RegistryKey sKey = OpenSubKey(subKey, regDomain);
if (sKey == null)
{
return false;
}
return true;
}
#endregion
#region Delete registry keys
/// <summary>
/// Delete the registry key (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <returns> Return true if the deletion is successful, otherwise false</returns>
public virtual bool DeleteSubKey()
{
///Return to whether the deletion was successful
bool result = false;
///Determine whether the registry key name is empty. If it is empty, return false
if (_subkey == || _subkey == null)
{
return false;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
if (IsSubKeyExist())
{
try
{
///Delete the registry key
(_subkey);
result = true;
}
catch
{
result = false;
}
}
/// Close changes to registry key
();
return result;
}
/// <summary>
/// Delete the registry key (please set the SubKey attribute first)
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <returns> Return true if the deletion is successful, otherwise false</returns>
public virtual bool DeleteSubKey(string subKey)
{
///Return to whether the deletion was successful
bool result = false;
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
if (IsSubKeyExist())
{
try
{
///Delete the registry key
(subKey);
result = true;
}
catch
{
result = false;
}
}
/// Close changes to registry key
();
return result;
}
/// <summary>
/// Delete the registry key
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Return true if the deletion is successful, otherwise false</returns>
public virtual bool DeleteSubKey(string subKey, RegDomain regDomain)
{
///Return to whether the deletion was successful
bool result = false;
///Determine whether the registry key name is empty. If it is empty, return false
if (subKey == || subKey == null)
{
return false;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(regDomain);
if (IsSubKeyExist(subKey, regDomain))
{
try
{
///Delete the registry key
(subKey);
result = true;
}
catch
{
result = false;
}
}
/// Close changes to registry key
();
return result;
}
#endregion
#region determines whether the key value exists
/// <summary>
/// Determine whether the key value exists (please set the SubKey and RegeditKey properties first)
/// Virtual method, subclasses can be rewrite
/// 1. If RegeditKey is empty or null, return false
/// 2. If SubKey is empty, null, or the registry key specified by SubKey does not exist, return false
/// </summary>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist()
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (_regeditkey == || _regeditkey == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey();
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, _regeditkey, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Determine whether the key value exists (please set the SubKey property first)
/// Virtual method, subclasses can be rewrite
/// If SubKey is empty, null, or the registry key specified by SubKey does not exist, return false
/// </summary>
/// <param name="name">Key value name</param>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist(string name)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (name == || name == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey();
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, name, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Determine whether the key value exists
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist(string name, string subKey)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (name == || name == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey);
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, name, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Determine whether the key value exists
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns>Returns whether the key value exists, and it returns true if it exists, otherwise it returns false</returns>
public virtual bool IsRegeditKeyExist(string name, string subKey, RegDomain regDomain)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (name == || name == null)
{
return false;
}
///Document whether the registry key exists
if (IsSubKeyExist())
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey, regDomain);
///Key value collection
string[] regeditKeyNames;
///Get key value collection
regeditKeyNames = ();
///Transip through the key value collection. If there is a key value, exit the traversal.
foreach (string regeditKey in regeditKeyNames)
{
if ((regeditKey, name, true) == 0)
{
result = true;
break;
}
}
/// Close changes to registry key
();
}
return result;
}
#endregion
#region Set key-value content
/// <summary>
/// Set the specified key value content, not specify the content data type (please set the RegeditKey and SubKey properties first)
/// If there is a key change value, modify the key value content. If there is no key value, create the key value first and then set the key value content.
/// </summary>
/// <param name="content">Key-value content</param>
/// <returns>Return true if the key value content is set successfully, otherwise false will be returned</returns>
public virtual bool WriteRegeditKey(object content)
{
///Return result
bool result = false;
///Document whether to set key value attributes
if (_regeditkey == || _regeditkey == null)
{
return false;
}
///Discern whether the registry key exists. If it does not exist, create it directly
if (!IsSubKeyExist(_subkey))
{
CreateSubKey(_subkey);
}
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
/// If the registry key is opened, return false
if (key == null)
{
return false;
}
try
{
(_regeditkey, content);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Set the specified key value content, not specify the content data type (please set the SubKey attribute first)
/// If there is a key change value, modify the key value content. If there is no key value, create the key value first and then set the key value content.
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="content">Key-value content</param>
/// <returns>Return true if the key value content is set successfully, otherwise false will be returned</returns>
public virtual bool WriteRegeditKey(string name, object content)
{
///Return result
bool result = false;
///Judge whether the key value exists
if (name == || name == null)
{
return false;
}
///Discern whether the registry key exists. If it does not exist, create it directly
if (!IsSubKeyExist(_subkey))
{
CreateSubKey(_subkey);
}
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
/// If the registry key is opened, return false
if (key == null)
{
return false;
}
try
{
(name, content);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
return result;
}
/// <summary>
/// Set the specified key value content and specify the content data type (please set the SubKey attribute first)
/// If there is a key change value, modify the key value content. If there is no key value, create the key value first and then set the key value content.
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="content">Key-value content</param>
/// <returns>Return true if the key value content is set successfully, otherwise false will be returned</returns>
public virtual bool WriteRegeditKey(string name, object content, RegValueKind regValueKind)
{
///Return result
bool result = false;
///Judge whether the key value exists
if (name == || name == null)
{
return false;
}
///Discern whether the registry key exists. If it does not exist, create it directly
if (!IsSubKeyExist(_subkey))
{
CreateSubKey(_subkey);
}
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
/// If the registry key is opened, return false
if (key == null)
{
return false;
}
try
{
(name, content, GetRegValueKind(regValueKind));
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
return result;
}
#endregion
#region Read key-value content
/// <summary>
/// Read key value content (please set the RegeditKey and SubKey properties first)
/// 1. If the RegeditKey is empty, null or the key value indicated by RegeditKey does not exist, return null
/// 2. If the SubKey is empty, null or the registry key indicated by SubKey does not exist, return null
/// 3. Otherwise, return key-value content
/// </summary>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey()
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (_regeditkey == || _regeditkey == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(_regeditkey))
{
///Open the registry key
RegistryKey key = OpenSubKey();
if (key != null)
{
obj = (_regeditkey);
}
/// Close changes to registry key
();
}
return obj;
}
/// <summary>
/// Read key value content (please set the SubKey property first)
/// 1. If the SubKey is empty, null or the registry key indicated by SubKey does not exist, return null
/// 2. Otherwise, return key-value content
/// </summary>
/// <param name="name">Key value name</param>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey(string name)
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (name == || name == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key
RegistryKey key = OpenSubKey();
if (key != null)
{
obj = (name);
}
/// Close changes to registry key
();
}
return obj;
}
/// <summary>
/// Read key-value content
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey(string name, string subKey)
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (name == || name == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey);
if (key != null)
{
obj = (name);
}
/// Close changes to registry key
();
}
return obj;
}
/// <summary>
/// Read key-value content
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns>Return key-value content</returns>
public virtual object ReadRegeditKey(string name, string subKey, RegDomain regDomain)
{
///Key value content results
object obj = null;
///Document whether to set key value attributes
if (name == || name == null)
{
return null;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key
RegistryKey key = OpenSubKey(subKey, regDomain);
if (key != null)
{
obj = (name);
}
/// Close changes to registry key
();
}
return obj;
}
#endregion
#region Delete key value
/// <summary>
/// Delete the key value (please set the RegeditKey and SubKey properties first)
/// 1. If the RegeditKey is empty, null or the key value indicated by RegeditKey does not exist, return false
/// 2. If the SubKey is empty, null, or the registry key indicated by SubKey does not exist, return false
/// </summary>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey()
{
///Delete the result
bool result = false;
///Discribing whether to set the key value attribute. If it is not set, return false
if (_regeditkey == || _regeditkey == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(_regeditkey))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
if (key != null)
{
try
{
///Delete the key value
(_regeditkey);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
/// <summary>
/// Delete the key value (please set the SubKey property first)
/// If the registry key indicated by SubKey is empty, null, or the SubKey does not exist, return false
/// </summary>
/// <param name="name">Key value name</param>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey(string name)
{
///Delete the result
bool result = false;
///Judge whether the key value name is empty. If it is empty, return false
if (name == || name == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(true);
if (key != null)
{
try
{
///Delete the key value
(name);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
/// <summary>
/// Delete key value
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey(string name, string subKey)
{
///Delete the result
bool result = false;
///Direquire whether the key value name and registry key name are empty. If it is empty, return false
if (name == || name == null || subKey == || subKey == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(subKey, true);
if (key != null)
{
try
{
///Delete the key value
(name);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
/// <summary>
/// Delete key value
/// </summary>
/// <param name="name">Key value name</param>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Return true if the deletion is successful, otherwise return false</returns>
public virtual bool DeleteRegeditKey(string name, string subKey, RegDomain regDomain)
{
///Delete the result
bool result = false;
///Direquire whether the key value name and registry key name are empty. If it is empty, return false
if (name == || name == null || subKey == || subKey == null)
{
return false;
}
///Judge whether the key value exists
if (IsRegeditKeyExist(name))
{
///Open the registry key in a writable way
RegistryKey key = OpenSubKey(subKey, regDomain, true);
if (key != null)
{
try
{
///Delete the key value
(name);
result = true;
}
catch
{
result = false;
}
finally
{
/// Close changes to registry key
();
}
}
}
return result;
}
#endregion
#endregion
#region Protected Method
/// <summary>
/// Get the top-level node corresponding to the registry base key field
/// Example: If regDomain is ClassesRoot, return
/// </summary>
/// <param name="regDomain">registry base domain</param>
/// <returns>Registration base domain corresponds to top-level node</returns>
protected RegistryKey GetRegDomain(RegDomain regDomain)
{
///Create a node based on registry base
RegistryKey key;
#region determines the registry base domain
switch (regDomain)
{
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
case :
key = ; break;
default:
key = ; break;
}
#endregion
return key;
}
/// <summary>
/// Get the corresponding value data type in the registry
/// Example: If regValueKind is DWord, return
/// </summary>
/// <param name="regValueKind">registry data type</param>
/// <returns>The corresponding data type in the registry</returns>
protected RegistryValueKind GetRegValueKind(RegValueKind regValueKind)
{
RegistryValueKind regValueK;
#region Determine registry data type
switch (regValueKind)
{
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
case :
regValueK = ; break;
default:
regValueK = ; break;
}
#endregion
return regValueK;
}
#region Open registry key
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey()
{
///Document whether the registry key name is empty
if (_subkey == || _subkey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (_subkey);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="writable">Set to true if write access to an item is required</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(bool writable)
{
///Document whether the registry key name is empty
if (_subkey == || _subkey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (_subkey, writable);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="writable">Set to true if write access to an item is required</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey, bool writable)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(_domain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey, writable);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node and retrieve the child keys in a read-only manner
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey, RegDomain regDomain)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(regDomain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
/// <summary>
/// Open the registry key node
/// Virtual method, subclasses can be rewrite
/// </summary>
/// <param name="subKey">registry key name</param>
/// <param name="regDomain">registry base domain</param>
/// <param name="writable">Set to true if write access to an item is required</param>
/// <returns> Return null if SubKey is empty, null or SubKey indicates that the registry key does not exist, otherwise return the registry node</returns>
protected virtual RegistryKey OpenSubKey(string subKey, RegDomain regDomain, bool writable)
{
///Document whether the registry key name is empty
if (subKey == || subKey == null)
{
return null;
}
///Create a node based on registry base
RegistryKey key = GetRegDomain(regDomain);
///The node of the registry key to be opened
RegistryKey sKey = null;
///Open the registry key
sKey = (subKey, writable);
/// Close changes to registry key
();
///Return to the registry node
return sKey;
}
#endregion
#endregion
}