private SolutionSection ReadSection(Match match) { var section = new SolutionSection(); section.Name = match.Groups["Name"].Value; section.SectionType = match.Groups["SectionType"].Value; section.Type = match.Groups["Type"].Value; ReadNextLine(); Match sectionMatch; while (IsAtKeyValuePair(out sectionMatch)) { section.Add(ReadKeyValuePair(sectionMatch)); ReadNextLine(); } if (_currentLine != string.Format("End{0}Section", section.SectionType)) { ThrowSyntaxError(string.Format("Expected \"End{0}Section\" keyword.", section.SectionType)); } return(section); }
private void WriteSection(SolutionSection section) { _writer.WriteLine("\t{0}Section({1}) = {2}", section.SectionType, section.Name, section.Type); foreach (var entry in section) { _writer.WriteLine("\t\t{0} = {1}", entry.Key, entry.Value); } _writer.WriteLine("\tEnd{0}Section", section.SectionType); }
private SolutionSection GetGlobalSection(string name, string type, bool createIfNotExist) { SolutionSection section; if ((section = GlobalSections.FirstOrDefault(x => x.Name == name && x.Type == type)) == null && createIfNotExist) { section = new SolutionSection() { Name = name, Type = type, SectionType = "Global", }; GlobalSections.Add(section); } return(section); }