private static PyHKEY GetRootKey(object key) { PyHKEY rootKey; rootKey = key as PyHKEY; if (rootKey == null) { BigInteger bi = key as BigInteger; if (!Object.ReferenceEquals(bi, null)) { rootKey = new PyHKEY(RegistryKey.OpenRemoteBaseKey(MapSystemKey(bi), string.Empty)); } else { throw new InvalidCastException("The object is not a PyHKEY object"); } } return rootKey; }
public static void CloseKey(PyHKEY key) { key.Close(); }
public static PyHKEY CreateKey(object key, string subKeyName) { PyHKEY rootKey = GetRootKey(key); //if key is a system key and no subkey is specified return that. BigInteger bi = key as BigInteger; if (!Object.ReferenceEquals(bi, null) && string.IsNullOrEmpty(subKeyName)) return rootKey; PyHKEY subKey = new PyHKEY(rootKey.key.CreateSubKey(subKeyName)); return subKey; }