예제 #1
0
        public void GetRegistryValueKindTest()
        {
            const string regBinary = "REG_BINARY";

            var registryValueKind = Registryy.GetRegistryValueKind(regBinary);

            Assert.AreEqual(RegistryValueKind.Binary, registryValueKind);
        }
예제 #2
0
        public void GetRegistryHiveTest()
        {
            const string regHklm = "HKEY_LOCAL_MACHINE";

            var registryHive = Registryy.GetRegistryHive(regHklm);

            Assert.AreEqual(RegistryHive.LocalMachine, registryHive);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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];
        }