Ejemplo n.º 1
0
        public SolutionView(List<string> lines, string rootPath)
        {
            List<string> allProjectLines = Common.ApplyFilter(lines, Constants.PROJECT, null);
            List<string> solutionFolderLines = Common.GetSolutionFolders(allProjectLines);
            List<string> csprojLines = Common.ApplyFilter(allProjectLines, null, Constants.CSPROJ);
            List<string> nestedProjectsSection = Common.GetNestedProjects(lines);

            SolutionFolders = new List<SolutionFolderObject>();
            foreach(string line in solutionFolderLines) {
                SolutionFolderLine solutionFolderLine = new SolutionFolderLine(line);
                SolutionFolderObject solutionFolder = new SolutionFolderObject(solutionFolderLine,
                                                                               nestedProjectsSection,
                                                                               csprojLines,
                                                                               solutionFolderLines);
                SolutionFolders.Add(solutionFolder);
            }

            ProjectsNotInASolutionFolder = BuildListOfProjectsNotInASolutionFolder(csprojLines, SolutionFolders);
        }
Ejemplo n.º 2
0
        private static List<SolutionFolderObject> BuildSolutionFoldersSkeleton(IEnumerable<string> rootParents, List<string> allProjectLines)
        {
            //This needs to create all nested folders not just the rootParents. Utilise NestedProjectCollection.NestedFolders
            Common.CheckNull(rootParents, "rootParents");
            Common.CheckNull(allProjectLines, "allProjectLines");
            //int foldersToBePlaced = NestedProjectCollection.NestedFolders.Count;
            //int foldersPlaced = 0;

            var sfos = new List<SolutionFolderObject>();
            foreach (var rootParent in rootParents) {
                var sfo = new SolutionFolderObject { FolderGuid = rootParent, Name = GetName(allProjectLines, rootParent) };
                sfos.Add(sfo);
            }

            //var tempCopyOfNestedFolders = new List<string>(NestedProjectCollection.NestedFolders);

            //while (foldersPlaced != foldersToBePlaced) {
            //    foreach(var nestedFolder in tempCopyOfNestedFolders) {
            //        PlaceNestedFolderInStructure(nestedFolder, sfos);
            //    }
            //}
            return sfos;
        }
Ejemplo n.º 3
0
 private void AddChildIntoStructure(SolutionFolderObject sfo, string child, IEnumerable<string> allProjectLines)
 {
     if(NestedProjectCollection.IsNestedProject(child)) {
         if(sfo.NestedProjects == null) {
             sfo.NestedProjects = new List<string>();
         }
         sfo.NestedProjects.Add(child);
     } else {
         if(sfo.NestedFolders == null) {
             sfo.NestedFolders = new List<SolutionFolderObject>();
         }
         sfo.NestedFolders.Add(new SolutionFolderObject {FolderGuid = child, Name = GetName(allProjectLines, child)});
     }
 }