当前位置: 首页>>代码示例>>C#>>正文


C# ISettings.SetValue方法代码示例

本文整理汇总了C#中ISettings.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ISettings.SetValue方法的具体用法?C# ISettings.SetValue怎么用?C# ISettings.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISettings的用法示例。


在下文中一共展示了ISettings.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetEncryptedValue

        public static void SetEncryptedValue(ISettings settings, string section, string key, string value)
        {
            if (String.IsNullOrEmpty(section))
            {
                throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, "section");
            }
            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, "key");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (String.IsNullOrEmpty(value))
            {
                settings.SetValue(section, key, String.Empty);
            }
            else
            {
                var encryptedString = EncryptionUtility.EncryptString(value);
                settings.SetValue(section, key, encryptedString);
            }
        }
开发者ID:michaelstaib,项目名称:NuGet.Configuration,代码行数:25,代码来源:SettingsUtility.cs

示例2: PersistActivePackageSource

        private static void PersistActivePackageSource(ISettings settings, PackageSource activePackageSource)
        {
            settings.DeleteSection(ActivePackageSourceSectionName);

            if (activePackageSource != null)
            {
                settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Name, activePackageSource.Source);
            }
        }
开发者ID:kumavis,项目名称:NuGet,代码行数:9,代码来源:VSPackageSourceProvider.cs

示例3: SetConfigValue

 /// <summary>
 /// Sets a config value in the setting.
 /// </summary>
 /// <param name="settings">The settings instance to store the key-value in.</param>
 /// <param name="key">The key to store.</param>
 /// <param name="value">The value to store.</param>
 /// <param name="encrypt">Determines if the value needs to be encrypted prior to storing.</param>
 public static void SetConfigValue(ISettings settings, string key, string value, bool encrypt = false)
 {
     if (encrypt == true)
     {
         SetEncryptedValue(settings, ConfigSection, key, value);
     }
     else
     {
         settings.SetValue(ConfigSection, key, value);
     }
 }
开发者ID:michaelstaib,项目名称:NuGet.Configuration,代码行数:18,代码来源:SettingsUtility.cs

示例4: PersistActivePackageSource

        private static void PersistActivePackageSource(
            ISettings settings,
            IVsShellInfo vsShellInfo,
            PackageSource activePackageSource)
        {
            if (activePackageSource != null)
            {
                // When running Visual Studio Express For Windows 8, we will have previously swapped in a curated package source for the normal official source.
                // But, we always want to persist the normal official source. So, we swap the normal official source back in for the curated source.
                if (vsShellInfo.IsVisualStudioExpressForWindows8 && activePackageSource.IsOfficial)
                {
                    activePackageSource = new PackageSource(NuGetConstants.DefaultFeedUrl, OfficialFeedName, isEnabled: activePackageSource.IsEnabled, isOfficial: true);
                }

                settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Name, activePackageSource.Source);
            }
            else
            {
                settings.DeleteSection(ActivePackageSourceSectionName);
            }
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:21,代码来源:VSPackageSourceProvider.cs

示例5: DisableSourceControlMode

 public static void DisableSourceControlMode(ISettings settings)
 {
     settings.SetValue(SolutionSection, DisableSourceControlIntegerationKey, "true");
 }
开发者ID:pabomex,项目名称:NuGet.PackageManagement,代码行数:4,代码来源:SourceControlUtility.cs


注:本文中的ISettings.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。