private void EnableOrDisableSource(bool enabled) { if (string.IsNullOrEmpty(Name)) { throw new CommandLineException(LocalizedResourceManager.GetString("SourcesCommandNameRequired")); } var packageSource = SourceProvider.GetPackageSourceByName(Name); if (packageSource == null) { throw new CommandLineException(LocalizedResourceManager.GetString("SourcesCommandNoMatchingSourcesFound"), Name); } if (enabled && !packageSource.IsEnabled) { SourceProvider.EnablePackageSource(Name); } else if (!enabled && packageSource.IsEnabled) { SourceProvider.DisablePackageSource(Name); } Console.WriteLine( enabled ? LocalizedResourceManager.GetString("SourcesCommandSourceEnabledSuccessfully") : LocalizedResourceManager.GetString("SourcesCommandSourceDisabledSuccessfully"), Name); }