本文整理汇总了C#中ISettings.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# ISettings.GetValues方法的具体用法?C# ISettings.GetValues怎么用?C# ISettings.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettings
的用法示例。
在下文中一共展示了ISettings.GetValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeActivePackageSource
private static PackageSource DeserializeActivePackageSource(
ISettings settings,
IVsShellInfo vsShellInfo)
{
var settingValues = settings.GetValues(ActivePackageSourceSectionName);
PackageSource packageSource = null;
if (settingValues != null && settingValues.Any())
{
KeyValuePair<string, string> setting = settingValues.First();
if (IsAggregateSource(setting.Key, setting.Value))
{
packageSource = AggregatePackageSource.Instance;
}
else
{
packageSource = new PackageSource(setting.Value, setting.Key);
}
}
if (packageSource != null)
{
// guard against corrupted data if the active package source is not enabled
packageSource.IsEnabled = true;
}
return packageSource;
}
示例2: DeserializeActivePackageSource
private static PackageSource DeserializeActivePackageSource(
ISettings settings,
IVsShellInfo vsShellInfo)
{
var settingValues = settings.GetValues(ActivePackageSourceSectionName);
PackageSource packageSource = null;
if (settingValues != null && settingValues.Any())
{
KeyValuePair<string, string> setting = settingValues.First();
if (IsAggregateSource(setting.Key, setting.Value))
{
packageSource = AggregatePackageSource.Instance;
}
else
{
packageSource = new PackageSource(setting.Value, setting.Key);
}
}
if (packageSource != null)
{
// guard against corrupted data if the active package source is not enabled
packageSource.IsEnabled = true;
// Unlike NuGet Core, Visual Studio has the concept of an official package source.
// If the active package source is the official source, we need to set its IsOfficial it.
if (IsOfficialPackageSource(packageSource))
{
packageSource.IsOfficial = true;
// When running Visual Studio Express for Windows 8, we swap in a curated feed for the normal official feed.
if (vsShellInfo.IsVisualStudioExpressForWindows8)
{
packageSource = new PackageSource(NuGetConstants.VisualStudioExpressForWindows8FeedUrl, VisualStudioExpressForWindows8FeedName, isEnabled: packageSource.IsEnabled, isOfficial: true);
}
}
}
return packageSource;
}
示例3: DeserializeActivePackageSource
private static PackageSource DeserializeActivePackageSource(
ISettings settings,
IVsShellInfo vsShellInfo)
{
var settingValues = settings.GetValues(ActivePackageSourceSectionName);
PackageSource packageSource = null;
if (settingValues != null && settingValues.Any())
{
KeyValuePair<string, string> setting = settingValues.First();
if (IsAggregateSource(setting.Key, setting.Value))
{
packageSource = AggregatePackageSource.Instance;
}
else
{
packageSource = new PackageSource(setting.Value, setting.Key);
}
}
if (packageSource != null)
{
// guard against corrupted data if the active package source is not enabled
packageSource.IsEnabled = true;
// Unlike NuGet Core, Visual Studio has the concept of an official package source.
// If the active package source is the official source, we need to set its IsOfficial it.
if (IsOfficialPackageSource(packageSource))
{
packageSource.IsOfficial = true;
}
}
return packageSource;
}
示例4: DeserializeActivePackageSource
private PackageSource DeserializeActivePackageSource(
ISettings settings,
IVsShellInfo vsShellInfo)
{
// NOTE: Even though the aggregate source is being disabled, this method can still return it because
// it could be reading a v2.x active source setting. The caller of this method will migrate the active source
// to the first enabled feed.
var enabledSources = new HashSet<string>(StringComparer.CurrentCultureIgnoreCase);
foreach (var source in _packageSources.Where(p => p.IsEnabled))
{
enabledSources.Add(source.Name);
}
// The special aggregate source, i.e. "All", is always enabled.
enabledSources.Add(Resources.VsResources.AggregateSourceName);
var settingValues = settings.GetValues(ActivePackageSourceSectionName);
if (settingValues != null)
{
settingValues = settingValues.Where(s => enabledSources.Contains(s.Key)).ToList();
}
PackageSource packageSource = null;
if (settingValues != null && settingValues.Any())
{
KeyValuePair<string, string> setting = settingValues.First();
if (IsAggregateSource(setting.Key, setting.Value))
{
packageSource = AggregatePackageSource.Instance;
}
else
{
packageSource = new PackageSource(setting.Value, setting.Key);
}
}
if (packageSource != null)
{
// guard against corrupted data if the active package source is not enabled
packageSource.IsEnabled = true;
}
return packageSource;
}