public static ApplicationUninstallerFactoryCache Load(string filename) { var c = new ApplicationUninstallerFactoryCache(filename); c.Read(); return(c); }
static ApplicationUninstallerFactory() { if (UninstallToolsGlobalConfig.EnableAppInfoCache) { var cachePath = UninstallToolsGlobalConfig.AppInfoCachePath; try { if (File.Exists(cachePath)) { Cache = ApplicationUninstallerFactoryCache.Load(cachePath); } else { Cache = new ApplicationUninstallerFactoryCache(cachePath); } } catch (SystemException e) { Cache = new ApplicationUninstallerFactoryCache(cachePath); Console.WriteLine(e); } } }
private static void ApplyCache(List <ApplicationUninstallerEntry> baseEntries, ApplicationUninstallerFactoryCache cache, InfoAdderManager infoAdder) { foreach (var entry in baseEntries) { var matchedEntry = cache.TryGetCachedItem(entry); if (matchedEntry != null) { infoAdder.CopyMissingInformation(entry, matchedEntry); } } }
private static void ApplyCache(ICollection <ApplicationUninstallerEntry> baseEntries, ApplicationUninstallerFactoryCache cache, InfoAdderManager infoAdder) { var hits = 0; foreach (var entry in baseEntries) { var matchedEntry = cache.TryGetCachedItem(entry); if (matchedEntry != null) { infoAdder.CopyMissingInformation(entry, matchedEntry); hits++; } else { Debug.WriteLine("Cache miss: " + entry.DisplayName); } } Console.WriteLine($@"Cache hits: {hits}/{baseEntries.Count}"); }