private IList <PackageSource> GetEndpointsAsync() { List <PackageSource> configurationSources = SourceProvider.LoadPackageSources() .Where(p => p.IsEnabled) .ToList(); IList <PackageSource> packageSources; if (Source.Count > 0) { packageSources = Source .Select(s => PackageSourceProviderExtensions.ResolveSource(configurationSources, s)) .ToList(); } else { packageSources = configurationSources; } return(packageSources); }
private static IEnumerable <PackageSource> GetPackageSources(ISettings settings, IEnumerable <string> sources, CommandOption config) { var availableSources = PackageSourceProvider.LoadPackageSources(settings).Where(source => source.IsEnabled); var uniqueSources = new HashSet <string>(); var packageSources = new List <PackageSource>(); foreach (var source in sources) { if (!uniqueSources.Contains(source)) { uniqueSources.Add(source); packageSources.Add(PackageSourceProviderExtensions.ResolveSource(availableSources, source)); } } if (packageSources.Count == 0 || config.HasValue()) { packageSources.AddRange(availableSources); } return(packageSources); }