public void GetRegistryValueKindTest() { const string regBinary = "REG_BINARY"; var registryValueKind = Registryy.GetRegistryValueKind(regBinary); Assert.AreEqual(RegistryValueKind.Binary, registryValueKind); }
public void GetRegistryHiveTest() { const string regHklm = "HKEY_LOCAL_MACHINE"; var registryHive = Registryy.GetRegistryHive(regHklm); Assert.AreEqual(RegistryHive.LocalMachine, registryHive); }
public void OpenParentKeyTest() { const string pathToParentKey = @"HKEY_CURRENT_USER\Software"; const string pathToKey = pathToParentKey + @"\Microsoft"; var registryKey = Registryy.OpenRegistryKey(pathToKey).Value; var parentKey = registryKey.OpenParent(); Assert.AreEqual(pathToParentKey, parentKey.Name); }
public void GetNameWithoutPathTest() { const string pathToKey = @"HKEY_CURRENT_USER\Software\Microsoft"; var registryKey = Registryy.OpenRegistryKey(pathToKey).Value; var nameWithoutPath = registryKey.GetNameWithoutPath(); Assert.AreEqual("Microsoft", nameWithoutPath); }
public RegistryKeyInfo(string pathToKey) { var aKeyParts = pathToKey.Split(new[] { '\\' }, 2); if (aKeyParts.Length != 2) { throw new ArgumentException("Try to open invalid registry key: " + pathToKey); } Hive = Registryy.GetRegistryHive(aKeyParts[0]); PathToKey = aKeyParts[1]; }