コード例 #1
0
 internal UtilsRegistryKey(UtilsRegistry root, string fullPath)
 {
     _root     = root;
     _path     = fullPath;
     _innerKey = _root.HiveKey.OpenSubKey(fullPath);
     _innerKey.Close();
 }
コード例 #2
0
        /// <summary>
        /// Creates an instance of the class
        /// </summary>
        public RegistryEditorControl()
        {
            try
            {
                InitializeComponent();
                if (!Program.IsDesign)
                {
                    _localMachine32 = new UtilsRegistry(Registry.LocalMachine, @"Software\Microsoft\Office");
                    _currentUser32 = new UtilsRegistry(Registry.CurrentUser, @"Software\Microsoft\Office");
                    if (System.Environment.Is64BitOperatingSystem)
                    {
                        _localMachine64 = new UtilsRegistry(Registry.LocalMachine, @"Software\Wow6432Node\Microsoft\Office");
                        _currentUser64 = new UtilsRegistry(Registry.CurrentUser, @"Software\Wow6432Node\Microsoft\Office");
                        _localMachine = _localMachine64;
                        _currentUser = _currentUser64;
                    }
                    else
                    {
                        _localMachine = _localMachine32;
                        _currentUser = _currentUser32;
                    }

                    _userIsAdmin = Program.IsAdmin;
                    _supportsInfoMessage = !_userIsAdmin;
                }
            }
            catch (Exception exception)
            {
                Forms.ErrorForm.ShowError(exception,ErrorCategory.NonCritical, 1033);
            }
        }
コード例 #3
0
 internal UtilsRegistryKey(UtilsRegistry root, string fullPath)
 {
     _root = root;
     _path = fullPath;
     _innerKey = _root.HiveKey.OpenSubKey(fullPath);
     _innerKey.Close();
 }
コード例 #4
0
 internal UtilsRegistryKey(UtilsRegistry root, RegistryKey innerKey, string path)
 {
     _root     = root;
     _innerKey = innerKey;
     _path     = path;
 }
コード例 #5
0
        private UtilsRegistryKey SearchHive(string expression, UtilsRegistry hive, UtilsRegistryKey selectedKeyInHive)
        {
            if (null == hive)
                return null;

            TreeNode testNode = GetRootNode(hive.IsLocalMachine, hive.IsWow);
            if(null == testNode)
                return null;

            List<UtilsRegistryKey> rootKeys = new List<UtilsRegistryKey>();
            foreach (UtilsRegistryKey item in hive.Key.Keys)
                rootKeys.Add(item);

            if ((null != selectedKeyInHive && hive.Path.Equals(selectedKeyInHive.Path, StringComparison.InvariantCultureIgnoreCase)) || null == selectedKeyInHive)
            {
                // selected key is one the 2 roots or not selected
                foreach (var item in rootKeys)
                {
                    UtilsRegistryKey resultKey = SearchTopKey(expression, item);
                    if(null != resultKey)
                        return resultKey;
                }
            }
            else
            {
                // selected key is a descendent
                int topParentIndex = 0;
                UtilsRegistryKey topParentKey = GetTopParent(selectedKeyInHive, rootKeys, out topParentIndex);

                // same top key
                UtilsRegistryKey topKeyResult = SearchTopKey(expression, topParentKey, selectedKeyInHive);
                if (null != topKeyResult)
                    return topKeyResult;

                // bottom keys
                bool ignore = true;
                foreach (var item in hive.Key.Keys)
                {
                    if (true == ignore)
                    {
                        if (item.Path == topParentKey.Path)
                            ignore = false;
                    }
                    else
                    {
                        UtilsRegistryKey bottomKeyResult = SearchTopKey(expression, item);
                        if (null != bottomKeyResult)
                            return bottomKeyResult;
                    }
                }
            }

            return null;
        }
コード例 #6
0
 internal UtilsRegistryKey(UtilsRegistry root, RegistryKey innerKey, string path)
 {
     _root = root;
     _innerKey = innerKey;
     _path = path;
 }