本文整理汇总了C#中IPackageSourceProvider.LoadPackageSources方法的典型用法代码示例。如果您正苦于以下问题:C# IPackageSourceProvider.LoadPackageSources方法的具体用法?C# IPackageSourceProvider.LoadPackageSources怎么用?C# IPackageSourceProvider.LoadPackageSources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackageSourceProvider
的用法示例。
在下文中一共展示了IPackageSourceProvider.LoadPackageSources方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CachedPackageSourceProvider
public CachedPackageSourceProvider(IPackageSourceProvider sourceProvider)
{
if (sourceProvider == null)
{
throw new ArgumentNullException("sourceProvider");
}
_packageSources = sourceProvider.LoadPackageSources().ToList();
}
示例2: GetEffectivePackageSources
public static List<PackageSource> GetEffectivePackageSources(IPackageSourceProvider sourceProvider,
IEnumerable<string> sources, IEnumerable<string> fallbackSources)
{
var allSources = sourceProvider.LoadPackageSources();
var enabledSources = sources.Any() ?
Enumerable.Empty<PackageSource>() :
allSources.Where(s => s.IsEnabled);
var addedSources = sources.Concat(fallbackSources).Select(
value => allSources.FirstOrDefault(source => CorrectName(value, source)) ?? new PackageSource(value));
return enabledSources.Concat(addedSources).Distinct().ToList();
}
示例3: CreateSourceRepository
internal static SourceRepository CreateSourceRepository(IPackageSourceProvider packageSourceProvider, IEnumerable<string> sources)
{
PackageSource firstSource = null;
if (sources != null && sources.Any())
{
// BUGBUG: Hard-coded to only use the first one
string firstSourceString = sources.FirstOrDefault();
firstSource = String.IsNullOrEmpty(firstSourceString) ? null : new PackageSource(firstSourceString);
}
else
{
// BUGBUG: Hard-coded to only use the first one
firstSource = packageSourceProvider.LoadPackageSources().FirstOrDefault();
}
return firstSource != null ? CreateRepo(firstSource) : null;
}
示例4: VsPackageSourceProvider
internal VsPackageSourceProvider(ISettings settings, IPackageSourceProvider packageSourceProvider)
{
if (settings == null)
{
throw new ArgumentNullException("settings");
}
if (packageSourceProvider == null)
{
throw new ArgumentNullException("packageSourceProvider");
}
_packageSourceProvider = packageSourceProvider;
_settings = settings;
_packageSources = _packageSourceProvider.LoadPackageSources().ToList();
DeserializeActivePackageSource();
AddOfficialPackageSourceIfNeeded();
MigrateActivePackageSource();
}