Example #1
0
        public override void BuildChildNodes(ITreeBuilder treeBuilder, object dataObject)
        {
            var node = (DependenciesNode)dataObject;

            node.PackageDependencyCache.Refresh();

            var packagesNode = new PackageDependenciesNode(node);

            if (packagesNode.HasChildNodes())
            {
                treeBuilder.AddChild(packagesNode);
            }

            var sdkNode = new SdkDependenciesNode(node);

            treeBuilder.AddChild(sdkNode);

            var assembliesNode = new AssemblyDependenciesNode(node.Project);

            if (assembliesNode.HasChildNodes())
            {
                treeBuilder.AddChild(assembliesNode);
            }

            var projectsNode = new ProjectDependenciesNode(node.Project);

            if (projectsNode.HasChildNodes())
            {
                treeBuilder.AddChild(projectsNode);
            }
        }
        void AddLoadedDependencyNodes(ITreeBuilder treeBuilder, SdkDependenciesNode dependenciesNode)
        {
            var frameworkNodes = GetTargetFrameworkNodes(dependenciesNode).ToList();

            if (frameworkNodes.Count > 1)
            {
                treeBuilder.AddChildren(frameworkNodes);
            }
            else if (frameworkNodes.Any())
            {
                var frameworkNode = frameworkNodes.First();
                treeBuilder.AddChildren(frameworkNode.GetDependencyNodes());
            }
        }
        void AddLoadedDependencyNodes(ITreeBuilder treeBuilder, SdkDependenciesNode dependenciesNode)
        {
            var frameworkNodes = GetTargetFrameworkNodes(dependenciesNode).ToList();

            if (frameworkNodes.Count > 1)
            {
                treeBuilder.AddChildren(frameworkNodes);
            }
            else if (frameworkNodes.Any())
            {
                var frameworkNode = frameworkNodes.First();
                treeBuilder.AddChildren(frameworkNode.GetDependencyNodes());
            }
            else
            {
                // Projects sometimes return no dependencies from MSBuild initially so
                // add the default nodes until the dependencies are updated.
                treeBuilder.AddChildren(dependenciesNode.GetDefaultNodes());
            }
        }
Example #4
0
        internal IEnumerable <object> GetChildNodes(TargetFrameworkNode frameworkNode)
        {
            bool addedFrameworkReferencesNode = false;

            if (frameworkNode != null)
            {
                var frameworkReferencesNode = new FrameworkReferencesNode(this);
                if (frameworkReferencesNode.HasChildNodes())
                {
                    addedFrameworkReferencesNode = true;
                    yield return(frameworkReferencesNode);
                }

                var packagesNode = new PackageDependenciesNode(frameworkNode);
                if (packagesNode.HasChildNodes())
                {
                    yield return(packagesNode);
                }

                if (!addedFrameworkReferencesNode)
                {
                    var sdkNode = new SdkDependenciesNode(frameworkNode);
                    if (sdkNode.HasChildNodes())
                    {
                        yield return(sdkNode);
                    }
                }
            }
            else
            {
                var frameworkReferencesNode = new FrameworkReferencesNode(this);
                if (frameworkReferencesNode.HasChildNodes())
                {
                    addedFrameworkReferencesNode = true;
                    yield return(frameworkReferencesNode);
                }

                var packagesNode = new PackageDependenciesNode(this);
                if (packagesNode.HasChildNodes())
                {
                    yield return(packagesNode);
                }

                if (!addedFrameworkReferencesNode)
                {
                    var sdkNode = new SdkDependenciesNode(this);
                    if (sdkNode.HasChildNodes())
                    {
                        yield return(sdkNode);
                    }
                }
            }

            var assembliesNode = new AssemblyDependenciesNode(Project);

            if (assembliesNode.HasChildNodes())
            {
                yield return(assembliesNode);
            }

            var projectsNode = new ProjectDependenciesNode(Project);

            if (projectsNode.HasChildNodes())
            {
                yield return(projectsNode);
            }
        }