Beispiel #1
0
        public async Task <Dictionary <string, AppManifest> > CachePackagesAsync()
        {
            if (Cached)
            {
                return(PackagesStore);
            }

            if (PackagesStore == null)
            {
                CheckRepository();

                var cached = await PackageCache.GetInstance().ReadCacheFromDirectoryAsync(Source);

                if ((cached == null) || (cached.Count == 0))
                {
                    PackagesStore = await PackageScanner.GetInstance().GetPackagesFromPath(Source);

                    await PackageCache.GetInstance().WriteCacheAtDirectoryAsync(Source, PackagesStore);
                }
                else
                {
                    LogInfo($"Fetched {cached.Count} items from cache");
                    PackagesStore = cached;
                }
            }

            Cached = true;
            return(PackagesStore);
        }
Beispiel #2
0
        public static PackageScanner GetInstance()
        {
            if (Instance == null)
            {
                Instance = new PackageScanner();
            }

            return(Instance);
        }