public void UpdatePackageSources(IEnumerable <PackageSource> updatedPackageSources) { PackageSources.Clear(); foreach (PackageSource updatedPackageSource in updatedPackageSources) { PackageSources.Add(updatedPackageSource); } UpdateActivePackageSource(); }
public void UpdatePackageSources(IEnumerable <PackageSource> updatedPackageSources) { List <PackageSource> packageSourcesBackup = PackageSources.ToList(); try { PackageSources.Clear(); foreach (PackageSource updatedPackageSource in updatedPackageSources) { PackageSources.Add(updatedPackageSource); } UpdateActivePackageSource(); } catch (Exception) { PackageSources.AddRange(packageSourcesBackup); UpdateActivePackageSource(); throw; } }
protected void InitializePackageSources() { var settings = Settings.LoadDefaultSettings(new PhysicalFileSystem("C:\\"), null, null); var packageSourceProvider = new PackageSourceProvider(settings); var packageSources = packageSourceProvider.GetEnabledPackageSources().ToList(); HttpClient.DefaultCredentialProvider = new SettingsCredentialProvider(new DotPeekCredentialProvider(), packageSourceProvider); if (!packageSources.Any()) { packageSources.Add(PluginConstants.NuGetPackageSource); } foreach (var packageSource in packageSources) { PackageSources.Add(new Uri(packageSource.Source)); } PackageSource = PackageSources.First(); }