示例#1
0
        private void ParseNestedProjects(Solution solution)
        {
            SolutionGlobal.Section nestedProjectsSection = null;
            foreach (var section in solution.Global.Sections)
            {
                if (section.SectionName == Solution.NestedProjectsSectionName)
                {
                    foreach (string item in section.SectionItems)
                    {
                        int  index     = item.IndexOf('{') + 1;
                        Guid projectId = new Guid(item.Substring(index, item.IndexOf('}', index) - index));
                        index = item.LastIndexOf('{') + 1;
                        Guid parentProjectId = new Guid(item.Substring(index, item.IndexOf('}', index) - index));

                        var project       = solution.FindProject(projectId);
                        var parentProject = solution.FindProject(parentProjectId);
                        if (project != null && parentProject != null)
                        {
                            project.ParentProject = parentProject;
                        }
                    }
                }
            }
            if (nestedProjectsSection != null)
            {
                solution.Global.Sections.Remove(nestedProjectsSection);
            }
        }
示例#2
0
        private void ParseGlobalSection(SolutionGlobal global, List <string> lines, ref int lineIndex)
        {
            var section = new SolutionGlobal.Section();

            global.Sections.Add(section);
            bool more = true;

            while (more && lineIndex < lines.Count)
            {
                string line = lines[lineIndex++];
                if (line.StartsWith("\tEndGlobalSection"))
                {
                    more = false;
                }
                else if (line.StartsWith("\tGlobalSection"))
                {
                    int index = line.IndexOf('(') + 1;
                    section.SectionName = line.Substring(index, line.IndexOf(')', index) - index);
                    index = line.IndexOf("= ", index) + 2;
                    section.PrePostSolution = line.Substring(index);
                }
                else
                {
                    section.SectionItems.Add(line.Trim());
                }
            }
        }