private static ProjectSection CreateProjectSectionFromMatch(Match sectionMatch) { var projectType = (sectionMatch.Groups["type"].Value == "preProject") ? ProjectSectionType.PreProject : ProjectSectionType.PostProject; var section = new ProjectSection(sectionMatch.Groups["name"].Value, projectType); return(section); }
private static void ParseSectionEntries(Match sectionMatch, ProjectSection section) { var entries = sectionMatch.Groups["entries"].Value; var entryMatch = s_entryPattern.Match(entries); while (entryMatch.Success) { var entryKey = entryMatch.Groups["key"].Value.Trim(); var entryValue = entryMatch.Groups["value"].Value.Trim(); section.Entries[entryKey] = entryValue; entryMatch = entryMatch.NextMatch(); } }
private static void ParseProjectContent(Match match, Project project) { var content = match.Groups["content"].Value.Trim(); if (string.IsNullOrEmpty(content)) { return; } var sectionMatch = s_sectionPattern.Match(content); ProjectSection section = null;// CreateProjectSectionFromMatch(sectionMatch); while (sectionMatch.Success) { if (section == null) { section = CreateProjectSectionFromMatch(sectionMatch); project.ProjectSection = section; } ParseSectionEntries(sectionMatch, section); sectionMatch = sectionMatch.NextMatch(); } }