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(); } }
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); }
public static ICollection <Information> GetInformations(Regex regexp, InformationFilterDelegate filter) { return(GetInformations(info => filter(info) && regexp.IsMatch(info.DisplayName))); }