Example #1
0
        public static ComposablePartCatalog CreateCacheCatalog()
        {
            Console.WriteLine("Creating Cache:");
            var catalog = new CachedAssemblyCatalog(PARTS_PATH);

            ComposablePartCatalogCachingServices.CacheCatalog(catalog, CACHE_PATH);
            return(catalog);
        }
Example #2
0
        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));
        }
Example #3
0
        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);
        }