コード例 #1
0
        public void populateRootElements(Projects projects)
        {
            List <String> names = new List <String>();

            foreach (NugetProject project in projects.projects)
            {
                List <String> projectDependencies = new List <string>();
                Component     comp = new Component()
                {
                    Key    = project.name,
                    Group  = project.name,
                    Issues = new List <Issue>()
                };
                Severity topSeverity = Severity.Unknown;
                if (project.dependencies != null && project.dependencies.Length > 0)
                {
                    foreach (Dependency dep in project.dependencies)
                    {
                        Component depComponent = getComponent(dep);
                        if (Severities.Contains(depComponent.TopSeverity))
                        {
                            projectDependencies.Add(depComponent.Key);
                        }
                        topSeverity = getTopComponentSeverity(topSeverity, depComponent);
                        foreach (Issue issue in depComponent.Issues)
                        {
                            if (!comp.Issues.Contains(issue))
                            {
                                comp.Issues.Add(issue);
                            }
                        }
                    }
                }

                comp.TopSeverity  = topSeverity;
                comp.Dependencies = projectDependencies;
                names.Add(project.name);
                // Adding to the data service components the project itself
                if (!getComponents().ContainsKey(comp.Key))
                {
                    getComponents().Add(comp.Key, comp);
                }
                else
                {
                    if (!getComponents().ContainsValue(comp))
                    {
                        //New value for the same key
                        getComponents().Remove(comp.Key);
                        getComponents().Add(comp.Key, comp);
                    }
                }
            }

            RootElements.Clear();
            foreach (String name in names)
            {
                RootElements.Add(name);
            }
        }
コード例 #2
0
ファイル: Model.cs プロジェクト: marcueberschaer/NMF
 protected internal virtual void EnsureAllElementsContained()
 {
     foreach (var element in this.Descendants())
     {
         foreach (var referenced in element.ReferencedElements)
         {
             var ancestor = referenced;
             while (ancestor.Parent != null)
             {
                 ancestor = ancestor.Parent;
             }
             if (ancestor.Model == null)
             {
                 RootElements.Add(ancestor);
             }
         }
     }
 }