本文整理汇总了C#中NuGet.Frameworks.NuGetFramework.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# NuGetFramework.Equals方法的具体用法?C# NuGetFramework.Equals怎么用?C# NuGetFramework.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NuGet.Frameworks.NuGetFramework
的用法示例。
在下文中一共展示了NuGetFramework.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMatchingProjectContexts
/// <summary>
/// Return the matching framework/runtime ProjectContext.
/// If 'nugetframework' or 'runtime' is null or empty then it matches with any.
/// </summary>
private static IEnumerable<ProjectContext> GetMatchingProjectContexts(IEnumerable<ProjectContext> contexts, NuGetFramework framework, string runtimeIdentifier)
{
foreach (var context in contexts)
{
if (context.TargetFramework == null || string.IsNullOrEmpty(context.RuntimeIdentifier))
{
continue;
}
if (string.IsNullOrEmpty(runtimeIdentifier) || runtimeIdentifier.Equals(context.RuntimeIdentifier))
{
if (framework == null || framework.Equals(context.TargetFramework))
{
yield return context;
}
}
}
}
示例2: GetRuntimeAssetFoldersForPromotion
private IEnumerable<string> GetRuntimeAssetFoldersForPromotion(ContentItemGroup runtimeAssets, NuGetFramework targetFramework, string targetFrameworkName)
{
if (runtimeAssets == null || runtimeAssets.Items.Count == 0)
{
return Enumerable.Empty<string>();
}
if (runtimeAssets.Items.All(ci => NuGetAssetResolver.IsPlaceholder(ci.Path)))
{
return Enumerable.Empty<string>();
}
if (targetFrameworkName == null)
{
targetFrameworkName = targetFramework.GetShortFolderName();
}
var resolvedFramework = runtimeAssets.Properties["tfm"] as NuGetFramework;
if (targetFramework.Equals(resolvedFramework))
{
Log.LogMessage(LogImportance.Low, $"Not promoting explicit implementation for {targetFrameworkName}");
return Enumerable.Empty<string>();
}
return NuGetAssetResolver.GetPackageTargetDirectories(runtimeAssets);
}
示例3: GetObscuredAssetFolders
private IEnumerable<string> GetObscuredAssetFolders(ContentItemGroup assets, ContentItemGroup obscuredAssets, NuGetFramework targetFramework, string targetFrameworkName, string expectedAssetFolder, string ignoredAssetFolder = null)
{
if (assets == null || assets.Items.Count == 0)
{
return Enumerable.Empty<string>();
}
if (assets.Items.Any(ci => !NuGetAssetResolver.IsPlaceholder(ci.Path)))
{
return Enumerable.Empty<string>();
}
if (targetFrameworkName == null)
{
targetFrameworkName = targetFramework.GetShortFolderName();
}
var resolvedFramework = assets.Properties["tfm"] as NuGetFramework;
if (targetFramework.Equals(resolvedFramework))
{
Log.LogMessage(LogImportance.Low, $"Not overriding explicit placeholder for {targetFrameworkName}");
return Enumerable.Empty<string>();
}
var obscuredAssetPaths = NuGetAssetResolver.GetPackageTargetDirectories(obscuredAssets);
if (ignoredAssetFolder != null)
{
string ignoredFolder = ignoredAssetFolder + '/';
obscuredAssetPaths = obscuredAssetPaths.Where(i => -1 == i.IndexOf(ignoredFolder, StringComparison.OrdinalIgnoreCase));
}
if (expectedAssetFolder != null)
{
var unexpectedAssetPaths = obscuredAssetPaths.Where(ri => !ri.StartsWith(expectedAssetFolder, StringComparison.OrdinalIgnoreCase));
foreach (var unexpectedAssetPath in unexpectedAssetPaths)
{
Log.LogWarning($"Unexpected targetPath {unexpectedAssetPath}. Expected only {expectedAssetFolder}.");
}
// filter after we've warned
obscuredAssetPaths = obscuredAssetPaths.Except(unexpectedAssetPaths);
}
if (!obscuredAssetPaths.Any())
{
// it's acceptable to have no override, this is the case for packages which
// carry implementation in a runtime-specific package
Log.LogMessage(LogImportance.Low, $"No {expectedAssetFolder} assets could be found to override inbox placeholder for {targetFrameworkName}.");
}
return obscuredAssetPaths;
}
示例4: GetEffectivePathForContentFile
private static string GetEffectivePathForContentFile(NuGetFramework nuGetFramework, string zipArchiveEntryFullName)
{
// Always use Path.DirectorySeparatorChar
var effectivePathForContentFile = PathUtility.ReplaceAltDirSeparatorWithDirSeparator(zipArchiveEntryFullName);
if (effectivePathForContentFile.StartsWith(Constants.ContentDirectory + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))
{
effectivePathForContentFile = effectivePathForContentFile.Substring((Constants.ContentDirectory + Path.DirectorySeparatorChar).Length);
if(!nuGetFramework.Equals(NuGetFramework.AnyFramework))
{
// Parsing out the framework name out of the effective path
int frameworkFolderEndIndex = effectivePathForContentFile.IndexOf(Path.DirectorySeparatorChar);
if (frameworkFolderEndIndex != -1)
{
if (effectivePathForContentFile.Length > frameworkFolderEndIndex + 1)
{
effectivePathForContentFile = effectivePathForContentFile.Substring(frameworkFolderEndIndex + 1);
}
}
return effectivePathForContentFile;
}
}
// Return the effective path with Path.DirectorySeparatorChar
return effectivePathForContentFile;
}