Esempio n. 1
0
        public async static Task <DependencyScanner> Create(Config config, IFileAccess fileSystem, PackagePolicies packagePolicies)
        {
            var catalog = new NuGetCatalog(config.DiskCache);
            var index   = await catalog.GetIndex();

            return(new DependencyScanner(index, config, fileSystem, packagePolicies));
        }
Esempio n. 2
0
        public void Add(CatalogPage page)
        {
            foreach (var item in page.Items)
            {
                if (!packageIdToPagePaths.ContainsKey(item.Id))
                {
                    packageIdToPagePaths.Add(item.Id, new HashSet <string>());
                    packageIdToVersions.Add(item.Id, new HashSet <string>());
                }

                string filePath = NuGetCatalog.GetPageCachePath(page.Url);
                packageIdToPagePaths[item.Id].Add(filePath);

                packageIdToVersions[item.Id].Add(item.Version);
            }
        }
Esempio n. 3
0
        public static async Task <(IDependencyScanner, ILicenseScanner)> Create(IFileAccess fileSystem, Config config)
        {
            var packagePolicies = PackagePolicies.LoadFrom(config.PackagePolicies);
            var scanner         = await DependencyScanner.Create(config, fileSystem, packagePolicies);

            var catalog = new NuGetCatalog(config.DiskCache);
            var index   = await catalog.GetIndex();

            var registry = new NuGetDependencies(index, config);

            Func <IPackage, Task <PackageDetailsResult> > getDetails =
                p => registry.GetPackageDetails(p).ContinueWith(ConvertPackageDetails);

            ILicenseScanner licenseScanner = new LicenseScanner(getDetails, packagePolicies, config);

            return(scanner, licenseScanner);
        }