public override void BuildGraph(
            IGraphContext graphContext,
            string projectPath,
            IDependency dependency,
            GraphNode dependencyGraphNode,
            TargetedDependenciesSnapshot targetedSnapshot)
        {
            // store refreshed dependency info
            dependencyGraphNode.SetValue(DependenciesGraphSchema.DependencyIdProperty, dependency.Id);
            dependencyGraphNode.SetValue(DependenciesGraphSchema.ResolvedProperty, dependency.Resolved);

            ImmutableArray <IDependency> children = targetedSnapshot.GetDependencyChildren(dependency);

            if (children.IsEmpty)
            {
                return;
            }

            foreach (IDependency childDependency in children)
            {
                if (!childDependency.Visible)
                {
                    continue;
                }

                Builder.AddGraphNode(
                    graphContext,
                    projectPath,
                    dependencyGraphNode,
                    childDependency.ToViewModel(targetedSnapshot));
            }
        }
示例#2
0
 public virtual bool ApplyChanges(
     IGraphContext graphContext,
     string nodeProjectPath,
     IDependency updatedDependency,
     GraphNode dependencyGraphNode,
     TargetedDependenciesSnapshot targetedSnapshot)
 {
     return(ApplyChangesInternal(
                graphContext,
                updatedDependency,
                dependencyGraphNode,
                updatedChildren: targetedSnapshot.GetDependencyChildren(updatedDependency),
                nodeProjectPath: nodeProjectPath,
                targetedSnapshot));
 }
示例#3
0
        public override void BuildGraph(
            IGraphContext graphContext,
            string projectPath,
            IDependency dependency,
            GraphNode dependencyGraphNode,
            TargetedDependenciesSnapshot targetedSnapshot)
        {
            // store refreshed dependency info
            dependencyGraphNode.SetValue(DependenciesGraphSchema.DependencyIdProperty, dependency.Id);
            dependencyGraphNode.SetValue(DependenciesGraphSchema.ResolvedProperty, dependency.Resolved);

            ImmutableArray <IDependency> children = targetedSnapshot.GetDependencyChildren(dependency);

            if (children.IsEmpty)
            {
                return;
            }

            var regularChildren      = new List <IDependency>();
            var fxAssembliesChildren = new List <IDependency>();

            foreach (IDependency childDependency in children)
            {
                if (!childDependency.Visible)
                {
                    continue;
                }

                if (childDependency.Flags.Contains(DependencyTreeFlags.FxAssemblyDependency))
                {
                    fxAssembliesChildren.Add(childDependency);
                }
                else
                {
                    regularChildren.Add(childDependency);
                }
            }

            bool isFxAssembliesFolder = dependencyGraphNode.GetValue <bool>(DependenciesGraphSchema.IsFrameworkAssemblyFolderProperty);

            if (isFxAssembliesFolder)
            {
                foreach (IDependency fxAssembly in fxAssembliesChildren)
                {
                    Builder.AddGraphNode(
                        graphContext,
                        projectPath,
                        dependencyGraphNode,
                        fxAssembly.ToViewModel(targetedSnapshot));
                }
            }
            else
            {
                foreach (IDependency childDependency in regularChildren)
                {
                    Builder.AddGraphNode(
                        graphContext,
                        projectPath,
                        dependencyGraphNode,
                        childDependency.ToViewModel(targetedSnapshot));
                }

                if (fxAssembliesChildren.Count > 0)
                {
                    GraphNode fxAssembliesNode = Builder.AddGraphNode(graphContext, projectPath, dependencyGraphNode, PackageFrameworkAssembliesViewModel.Instance);
                    fxAssembliesNode.SetValue(DgmlNodeProperties.ContainsChildren, true);
                    fxAssembliesNode.SetValue(DependenciesGraphSchema.IsFrameworkAssemblyFolderProperty, true);
                    fxAssembliesNode.SetValue(DependenciesGraphSchema.DependencyIdProperty, dependency.Id);
                    fxAssembliesNode.SetValue(DependenciesGraphSchema.ResolvedProperty, dependency.Resolved);
                }
            }
        }