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


C# IGraphNode.DepthFirstPreOrderWalk方法代码示例

本文整理汇总了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));
                    }
                }
            }
        }
开发者ID:henghu-bai,项目名称:dnx,代码行数:33,代码来源:AssemblyWalker.cs

示例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;
        }
开发者ID:nagyistoce,项目名称:dnx,代码行数:25,代码来源:LibraryDependencyFlatRenderer.cs

示例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;
        }
开发者ID:leloulight,项目名称:dnx,代码行数:28,代码来源:LibraryDependencyFlatRenderer.cs

示例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);
            }
        }
开发者ID:leloulight,项目名称:dnx,代码行数:28,代码来源:MismatchedDependencyRenderer.cs

示例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;
        }
开发者ID:nagyistoce,项目名称:dnx,代码行数:8,代码来源:AssemblyWalker.cs


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