/// <summary> /// Reads project sections from the TextReader until the line "EndProject" is found and saves /// them into the specified sectionList. /// </summary> public static void ReadProjectSections(TextReader sr, ICollection <ProjectSection> sectionList) { while (true) { string line = sr.ReadLine(); if (line == null || line.Trim() == "EndProject") { break; } Match match = sectionHeaderPattern.Match(line); if (match.Success) { sectionList.Add(ProjectSection.ReadProjectSection(sr, match.Result("${Name}"), match.Result("${Type}"))); } } }
static ProjectSection ReadSection(TextReader sr, string name, string sectionType, string endTag) { ProjectSection newFolder = new ProjectSection(name, sectionType); while (true) { string line = sr.ReadLine(); if (line == null || line.Trim() == endTag) { break; } Match match = sectionPattern.Match(line); if (match.Success) { newFolder.Items.Add(new SolutionItem(match.Result("${Key}"), match.Result("${Value}"))); } } return(newFolder); }