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


C# ISettings.GetValues方法代码示例

本文整理汇总了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;
        }
开发者ID:kumavis,项目名称:NuGet,代码行数:28,代码来源:VSPackageSourceProvider.cs

示例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;
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:41,代码来源:VSPackageSourceProvider.cs

示例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;
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:35,代码来源:VSPackageSourceProvider.cs

示例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;
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:45,代码来源:VSPackageSourceProvider.cs


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