public NugetPackagePluginCatalog(string packageName, string packageVersion = null, bool includePrerelease = false, NuGetFeed packageFeed = null, string packagesFolder = null, Action <TypeFinderCriteriaBuilder> configureFinder = null, Dictionary <string, TypeFinderCriteria> criterias = null, NugetPluginCatalogOptions options = null) { _packageName = packageName; _packageVersion = packageVersion; _includePrerelease = includePrerelease; _packageFeed = packageFeed; PackagesFolder = packagesFolder ?? Path.Combine(Path.GetTempPath(), "NugetPackagePluginCatalog", Path.GetRandomFileName()); if (!Directory.Exists(PackagesFolder)) { Directory.CreateDirectory(PackagesFolder); } if (criterias == null) { criterias = new Dictionary <string, TypeFinderCriteria>(); } _typeFinderCriterias = criterias; _options = options ?? new NugetPluginCatalogOptions(); if (configureFinder != null) { var builder = new TypeFinderCriteriaBuilder(); configureFinder(builder); var criteria = builder.Build(); _typeFinderCriterias.Add("", criteria); } }
public NugetFeedPluginCatalog(NuGetFeed packageFeed, string searchTerm = null, bool includePrereleases = false, int maxPackages = 128, string packagesFolder = null, Action <TypeFinderCriteriaBuilder> configureFinder = null, Dictionary <string, TypeFinderCriteria> criterias = null, NugetPluginCatalogOptions options = null) { _packageFeed = packageFeed; _searchTerm = searchTerm; _includePrereleases = includePrereleases; _maxPackages = maxPackages; PackagesFolder = packagesFolder ?? Path.Combine(Path.GetTempPath(), "NugetFeedPluginCatalog", Path.GetRandomFileName()); if (!Directory.Exists(PackagesFolder)) { Directory.CreateDirectory(PackagesFolder); } if (criterias == null) { criterias = new Dictionary <string, TypeFinderCriteria>(); } _options = options ?? new NugetPluginCatalogOptions(); if (configureFinder != null) { var builder = new TypeFinderCriteriaBuilder(); configureFinder(builder); var criteria = builder.Build(); _options.TypeFinderOptions.TypeFinderCriterias.Add(criteria); } foreach (var finderCriteria in criterias) { finderCriteria.Value.Tags = new List <string>() { finderCriteria.Key }; _options.TypeFinderOptions.TypeFinderCriterias.Add(finderCriteria.Value); } }
public async Task Initialize() { var nuGetDownloader = new NuGetDownloader(_options.LoggerFactory()); var packages = await nuGetDownloader.SearchPackagesAsync(_packageFeed, _searchTerm, maxResults : _maxPackages); foreach (var packageAndRepo in packages) { var options = new NugetPluginCatalogOptions() { TypeFinderOptions = _options.TypeFinderOptions, PluginNameOptions = _options.PluginNameOptions }; var packageCatalog = new NugetPackagePluginCatalog(packageAndRepo.Package.Identity.Id, packageAndRepo.Package.Identity.Version.ToString(), _includePrereleases, _packageFeed, PackagesFolder, options: options); await packageCatalog.Initialize(); _pluginCatalogs.Add(packageCatalog); } IsInitialized = true; }