public HashSet <string> FlatProjectDependency() { var hashSet = new HashSet <string>(); Horizontals.ForAll(h => { hashSet.Add(h.ProjectName); h.Project .FlatProjectDependency() .ForAll(hfpd => hashSet.Add(hfpd)); }); Verticals.ForAll(v => { hashSet.Add(v.ProjectName); v.Project .FlatProjectDependency() .ForAll(vfpd => hashSet.Add(vfpd)); }); PlainProjectRefs.ForAll(p => { hashSet.Add(p.ProjectName); p.Project .FlatProjectDependency() .ForAll(pfpd => hashSet.Add(pfpd)); }); return(hashSet); }
private void ResolveDependentProjects(DependencyContext context) { //first resolve the projects Verticals.ForAll(v => { v.Project = context.ProjectTable.GetOrAdd( v.ProjectName, _ => new Project(new FileInfo(v.ProjectPath), context)); }); Horizontals.ForAll(h => { h.Project = context.ProjectTable.GetOrAdd( h.ProjectName, _ => new Project(new FileInfo(h.ProjectPath), context)); }); PlainProjectRefs.ForAll(p => { p.Project = context.ProjectTable.GetOrAdd( p.ProjectName, _ => new Project(new FileInfo(p.ProjectPath), context)); }); //now remove transient references var refs = new HashSet <string>(Horizontals .SelectMany(h => h.Project.FlatProjectDependency()) .Concat(Verticals .SelectMany(v => v.Project.FlatProjectDependency()) .Concat(PlainProjectRefs .SelectMany(p => p.Project.FlatProjectDependency())))); Verticals.ToArray().ForAll(v => { if (refs.Contains(v.ProjectName)) { Verticals.Remove(v); } }); Horizontals.ToArray().ForAll(h => { if (refs.Contains(h.ProjectName)) { Horizontals.Remove(h); } }); PlainProjectRefs.ToArray().ForAll(p => { if (refs.Contains(p.ProjectName)) { PlainProjectRefs.Remove(p); } }); }