Exemplo n.º 1
0
        public override void ChangeActiveSource(PackageSource newSource)
        {
            if (newSource.Equals(NuGetV3PreviewSource))
            {
                return; // Can't set it as default
            }

            var source = _sourceProvider.GetEnabledPackageSources()
                         .FirstOrDefault(s => String.Equals(s.Name, newSource.Name, StringComparison.OrdinalIgnoreCase));

            if (source == null)
            {
                throw new ArgumentException(
                          String.Format(
                              CultureInfo.CurrentCulture,
                              Strings.VsPackageManagerSession_UnknownSource,
                              newSource.Name),
                          "newSource");
            }

            // The Urls should be equal but if they aren't, there's nothing the user can do about it :(
            Debug.Assert(String.Equals(source.Source, newSource.Url, StringComparison.Ordinal));

            // Update the active package source
            _sourceProvider.ActivePackageSource = source;
        }
Exemplo n.º 2
0
        private static bool IsOfficialPackageSource(PackageSource packageSource)
        {
            if (packageSource == null)
            {
                return(false);
            }

            return(packageSource.Equals(NuGetDefaultSource));
        }
Exemplo n.º 3
0
        internal bool RemovePackageSource(PackageSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            bool result = _packageSources.Remove(source);

            if (result)
            {
                PersistPackageSources();
                if (source.Equals(ActivePackageSource))
                {
                    ActivePackageSource = null;
                }
            }

            return(result);
        }
        internal bool RemovePackageSource(PackageSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            bool result = _packageSources.Remove(source);
            if (result)
            {
                PersistPackageSources();
                if (source.Equals(ActivePackageSource))
                {
                    ActivePackageSource = null;
                }
            }

            return result;
        }
        private static bool IsOfficialPackageSource(PackageSource packageSource)
        {
            if (packageSource == null)
            {
                return false;
            }

            return packageSource.Equals(NuGetDefaultSource);
        }
        public override void ChangeActiveSource(PackageSource newSource)
        {
            if (newSource.Equals(NuGetV3PreviewSource))
            {
                return; // Can't set it as default
            }

            var source = _sourceProvider.GetEnabledPackageSources()
                .FirstOrDefault(s => String.Equals(s.Name, newSource.Name, StringComparison.OrdinalIgnoreCase));
            if (source == null)
            {
                throw new ArgumentException(
                    String.Format(
                        CultureInfo.CurrentCulture,
                        Strings.VsPackageManagerSession_UnknownSource,
                        newSource.Name),
                    "newSource");
            }

            // The Urls should be equal but if they aren't, there's nothing the user can do about it :(
            Debug.Assert(String.Equals(source.Source, newSource.Url, StringComparison.Ordinal));

            // Update the active package source
            _sourceProvider.ActivePackageSource = source;
        }
Exemplo n.º 7
0
 public bool Equals(SourceRepository x, SourceRepository y)
 {
     return(PackageSource.Equals(x.PackageSource, y.PackageSource));
 }