本文整理汇总了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);
}
}
示例2: PersistActivePackageSource
private static void PersistActivePackageSource(ISettings settings, PackageSource activePackageSource)
{
settings.DeleteSection(ActivePackageSourceSectionName);
if (activePackageSource != null)
{
settings.SetValue(ActivePackageSourceSectionName, activePackageSource.Name, activePackageSource.Source);
}
}
示例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);
}
}
示例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);
}
}
示例5: DisableSourceControlMode
public static void DisableSourceControlMode(ISettings settings)
{
settings.SetValue(SolutionSection, DisableSourceControlIntegerationKey, "true");
}