public void DisablePackageSource(PackageSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            Settings.SetValue(ConfigurationConstants.DisabledPackageSources, source.Name, "true");
        }
Esempio n. 2
0
 /// <summary>
 /// Saves the <paramref name="source"/> as the active source.
 /// </summary>
 /// <param name="source"></param>
 public void SaveActivePackageSource(PackageSource source)
 {
     try
     {
         Settings.DeleteSection(ConfigurationContants.ActivePackageSourceSectionName);
         Settings.SetValue(ConfigurationContants.ActivePackageSourceSectionName, source.Name, source.Source);
     }
     catch (Exception)
     {
         // we want to ignore all errors here.
     }
 }
Esempio n. 3
0
        public void SetValue(string section, string key, string value)
        {
            // machine wide settings cannot be changed.
            if (IsMachineWideSettings)
            {
                if (_next == null)
                {
                    throw new InvalidOperationException(Resources.Error_NoWritableConfig);
                }

                _next.SetValue(section, key, value);
                return;
            }

            if (String.IsNullOrEmpty(section))
            {
                throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, nameof(section));
            }
            var sectionElement = GetOrCreateSection(ConfigXDocument.Root, section);

            SetValueInternal(sectionElement, key, value, attributes: null);
            Save();
        }