本文整理汇总了C#中IGraphNode.DepthFirstPreOrderWalk方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphNode.DepthFirstPreOrderWalk方法的具体用法?C# IGraphNode.DepthFirstPreOrderWalk怎么用?C# IGraphNode.DepthFirstPreOrderWalk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphNode
的用法示例。
在下文中一共展示了IGraphNode.DepthFirstPreOrderWalk方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Walk
public void Walk(IGraphNode<LibraryDescription> root)
{
_assemblyFilePaths = new HashSet<string>(StringComparer.Ordinal);
_dependencyAssemblySources = new Dictionary<string, HashSet<string>>(StringComparer.Ordinal);
_dependencyPackageSources = new Dictionary<string, HashSet<string>>(StringComparer.Ordinal);
var libraries = new HashSet<LibraryDescription>();
root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries));
_reports.Information.WriteLine("\n[Target framework {0} ({1})]\n",
_framework.ToString(), VersionUtility.GetShortFrameworkName(_framework));
foreach (var assemblyFilePath in _assemblyFilePaths.OrderBy(assemblyName => assemblyName))
{
_reports.Information.WriteLine(assemblyFilePath);
if (_showDetails)
{
var assemblyName = Path.GetFileNameWithoutExtension(assemblyFilePath);
HashSet<string> packagesSources;
if (_dependencyPackageSources.TryGetValue(assemblyName, out packagesSources) && packagesSources.Any())
{
_reports.Information.WriteLine(" by package: {0}", string.Join(", ", packagesSources));
}
HashSet<string> assemblySources;
if (_dependencyAssemblySources.TryGetValue(assemblyName, out assemblySources) && assemblySources.Any())
{
_reports.Information.WriteLine(" by assembly: {0}", string.Join(", ", assemblySources));
}
}
}
}
示例2: FindImmediateDependent
private IDictionary<Library, ISet<Library>> FindImmediateDependent(IGraphNode<Library> root)
{
var result = new Dictionary<Library, ISet<Library>>();
root.DepthFirstPreOrderWalk(
visitNode: (node, ancestors) =>
{
ISet<Library> slot;
if (!result.TryGetValue(node.Item, out slot))
{
slot = new HashSet<Library>();
result.Add(node.Item, slot);
}
// first item in the path is the immediate parent
if (ancestors.Any())
{
slot.Add(ancestors.First().Item);
}
return true;
});
return result;
}
示例3: FindImmediateDependent
private IDictionary<LibraryDescription, ISet<LibraryDescription>> FindImmediateDependent(IGraphNode<LibraryDependency> root)
{
var result = new Dictionary<LibraryDescription, ISet<LibraryDescription>>();
root.DepthFirstPreOrderWalk(
(node, ancestors) =>
{
ISet<LibraryDescription> slot;
if (!result.TryGetValue(node.Item.Library, out slot))
{
slot = new HashSet<LibraryDescription>();
result.Add(node.Item.Library, slot);
}
// first item in the path is the immediate parent
if (ancestors.Any())
{
slot.Add(ancestors.First().Item.Library);
}
return true;
});
// removing the root package
result.Remove(root.Item.Library);
return result;
}
示例4: Render
public void Render(IGraphNode<LibraryDependency> root)
{
// tuples of <Library Name, Requested Version, Actual Version>
var results = new HashSet<Tuple<string, string, string>>();
root.DepthFirstPreOrderWalk(
(node, ancestors) =>
{
var dependency = node.Item;
if (IsLibraryMismatch(dependency))
{
results.Add(Tuple.Create(
dependency.Library.Identity.Name,
dependency.LibraryRange.VersionRange?.MinVersion.ToString(),
dependency.Library.Identity.Version?.ToString()));
}
return true;
});
if (results.Any())
{
var format = GetFormat(results, padding: 2);
RenderTitle(format);
RenderMismatches(format, results);
}
}
示例5: Walk
public ISet<string> Walk(IGraphNode<Library> root)
{
var assemblies = new HashSet<string>();
var libraries = new HashSet<Library>();
root.DepthFirstPreOrderWalk(visitNode: (node, _) => VisitLibrary(node, _, libraries, assemblies));
return assemblies;
}