示例#1
0
        private void Init()
        {
            localPackages = new Dictionary <Hash, LocalPackageInfo>();

            var packageReferences = localPackageManager.ListPackages(deleteUnfinishedBuilds: true).ToArray();

            var packagesInitData = new List <LocalPackageInfo>();

            foreach (var pr in packageReferences)
            {
                PackageHashes       hashes;
                PackageDownloadInfo download;
                PackageMeta         meta;
                PackageSequenceInfo packageSequence;
                try
                {
                    hashes          = localPackageManager.ReadPackageHashesFile(pr);
                    packageSequence = hashes.CreatePackageSequence();
                    download        = localPackageManager.ReadPackageDownloadStatus(pr, packageSequence);
                    meta            = localPackageManager.ReadPackageMetadata(pr);

                    var item = new LocalPackageInfo(pr, download, hashes, meta, packageSequence);
                    packagesInitData.Add(item);
                }
                catch (Exception e)
                {
                    logger.LogWarning(e, "Can't read package {0:s}", pr.Id);
                    continue;
                }
            }

            UpdateLists(addToLocal: packagesInitData, removeFromLocal: null, addToDiscovered: Enumerable.Empty <DiscoveredPackage>());
        }