private TemplateSection GetOrAddSection(SectionId sectionId) { TemplateSection section; if (!_sectionsTemplates.TryGetValue(sectionId, out section)) { section = new TemplateSection(); _sectionsTemplates.Add(sectionId, section); } return(section); }
public void Load(XElement patternsElement) { _sectionsTemplates.Clear(); foreach (XElement sectionElement in patternsElement.Elements("Section")) { var sectionId = XmlParseHelper.ParseAttribute <SectionId>(sectionElement, "Id"); var pageId = XmlParseHelper.ParseAttribute <PageId>(sectionElement, "PageId"); TemplateSection templateSection = GetOrAddSection(sectionId); Dictionary <TemplateId, string> templates = XmlParseHelper.GetDictionary <TemplateId, string>(sectionElement, "Template"); foreach (var template in templates) { templateSection.Set(pageId, template.Key, template.Value); } } }