public void Remove(NuGetSource source)
        {
            if (_sources.All(x => !string.Equals(x.Id, source.Id)))
            {
                throw new InvalidOperationException("Source not found");
            }

            var s = _sources.First(x => string.Equals(x.Id, source.Id, StringComparison.InvariantCultureIgnoreCase));

            _sources.Remove(s);

            Store();
        }
        public void Add(NuGetSource source)
        {
            if (_sources.Any(x => string.Equals(x.Id, source.Id, StringComparison.InvariantCultureIgnoreCase)))
            {
                return;
            }

            if (_sources.Any(x => string.Equals(x.Name, source.Name, StringComparison.InvariantCultureIgnoreCase)))
            {
                throw new InvalidOperationException("Source with same name already exists");
            }

            _sources.Add(source);
            Store();
        }
        public void Edit(NuGetSource source, string name, string url, string key)
        {
            if (_sources.All(x => !string.Equals(x.Id, source.Id)))
            {
                throw new InvalidOperationException("Source not found");
            }

            if (_sources.Any(x => !string.Equals(source.Id, x.Id, StringComparison.InvariantCultureIgnoreCase) && string.Equals(x.Name, source.Name, StringComparison.InvariantCultureIgnoreCase)))
            {
                throw new InvalidOperationException("Source with same name already exists");
            }

            source.SetName(name);
            source.SetUrl(url);
            source.SetKey(key);

            Store();
        }
 public bool Contains(NuGetSource source)
 {
     return(_sources.Any(x => x == source));
 }