public static T GetCachedCatalog <T>(this T catalog) where T : ComposablePartCatalog { string path = FileIO.GetTemporaryFileName("cache.dll"); ComposablePartCatalogCachingServices.CacheCatalog((ICachedComposablePartCatalog)catalog, path); return((T)ComposablePartCatalogCachingServices.ReadCatalogFromCache(path)); }
public static ComposablePartCatalog LoadCacheCatalog() { Console.WriteLine("Reading cache:"); File.Copy(CACHE_PATH, CACHE_SHADOW_PATH, true); var catalog = ComposablePartCatalogCachingServices.ReadCatalogFromCache(CACHE_SHADOW_PATH); if (!catalog.IsCacheUpToDate) { Console.WriteLine("Updating cache"); ComposablePartCatalogCachingServices.CacheCatalog(catalog, CACHE_PATH); } return((ComposablePartCatalog)catalog); }