Exemple #1
0
        private void PopulatePackageList(string regexFilter, bool isWoW, List <PackageInfo> pkgs, Dictionary <string, RegKeyProxy> keys)
        {
            foreach (KeyValuePair <string, RegKeyProxy> pair in keys)
            {
                RegKeyProxy k = pair.Value;
                PackageInfo p = new PackageInfo();
                Dictionary <string, RegistryField> fields = k.GetValues();

                p.IsWoW       = isWoW;
                p.Identifier  = k.KeyName;
                p.RegKeyPath  = k.PathReleativeToHive + "\\" + k.KeyName;
                p.DisplayName = GetField(fields, "DisplayName") as string ?? string.Empty;

                if (!string.IsNullOrWhiteSpace(regexFilter) &&
                    !Regex.IsMatch(p.DisplayName, regexFilter, RegexOptions.IgnoreCase) &&
                    !Regex.IsMatch(p.Identifier, regexFilter, RegexOptions.IgnoreCase)
                    )
                {
                    continue;
                }

                p.DisplayVersion       = GetField(fields, "DisplayVersion") as string;
                p.Comments             = GetField(fields, "Comments") as string;
                p.InstallLocation      = GetField(fields, "InstallLocation") as string;
                p.InstallSource        = GetField(fields, "InstallSource") as string;
                p.InstallDate          = GetField(fields, "InstallDate") as string;
                p.UninstallString      = GetField(fields, "UninstallString") as string;
                p.QuietUninstallString = GetField(fields, "QuietUninstallString") as string;
                p.ModifyPath           = GetField(fields, "ModifyPath") as string;

                pkgs.Add(p);
            }
        }
Exemple #2
0
        public uint EnumKey(string keyPath, ref Dictionary <string, RegKeyProxy> keys)
        {
            string[] keyNames;
            uint     rv = EnumKey(keyPath, out keyNames);

            if (0 == rv)
            {
                foreach (string k in keyNames)
                {
                    keys[k] = new RegKeyProxy(this, keyPath, k);
                }
            }

            return(rv);
        }
Exemple #3
0
        public Dictionary <string, RegKeyProxy> GetKeysAt(string keyPath)
        {
            string[] keys;
            uint     rv = EnumKey(keyPath, out keys);

            Dictionary <string, RegKeyProxy> proxies = new Dictionary <string, RegKeyProxy>();

            if (0 != rv)
            {
                throw new RegistryException(rv, "Encountered error while getting keys at path " + m_hiveKey + "\\" + keyPath);
            }
            else
            {
                foreach (string key in keys)
                {
                    proxies[key] = new RegKeyProxy(this, keyPath, key);
                }
            }

            return(proxies);
        }