Esempio n. 1
0
        private static IEnumerable <Information> EnumerateInformationsFromKey(
            RegistryKey key,
            InformationFilterDelegate filter)
        {
            if (key == null)
            {
                yield break;
            }

            try
            {
                foreach (string subKeyName in key.GetSubKeyNames())
                {
                    using (RegistryKey subKey = key.OpenSubKey(subKeyName, false))
                    {
                        if (subKey == null)
                        {
                            continue;
                        }

                        var info = new Information(subKey);
                        if (filter(info))
                        {
                            yield return(info);
                        }
                    }
                }
            }
            finally
            {
                key.Close();
            }
        }
Esempio n. 2
0
        public static ICollection <Information> GetInformations(InformationFilterDelegate filter)
        {
            var infos = new List <Information>();

            infos.AddRange(EnumerateInformationsFromKey(OpenUninstallKey(Registry.LocalMachine), filter));
            infos.AddRange(EnumerateInformationsFromKey(OpenUninstallKeyWow6432(Registry.LocalMachine), filter));
            infos.AddRange(EnumerateInformationsFromKey(OpenUninstallKey(Registry.CurrentUser), filter));
            infos.AddRange(EnumerateInformationsFromKey(OpenUninstallKeyWow6432(Registry.CurrentUser), filter));

            infos.Sort();
            PathInformationsWithWindowsInstallerIcons(infos);
            return(infos);
        }
Esempio n. 3
0
 public static ICollection <Information> GetInformations(Regex regexp, InformationFilterDelegate filter)
 {
     return(GetInformations(info => filter(info) && regexp.IsMatch(info.DisplayName)));
 }