예제 #1
0
        private TemplateSection GetOrAddSection(SectionId sectionId)
        {
            TemplateSection section;

            if (!_sectionsTemplates.TryGetValue(sectionId, out section))
            {
                section = new TemplateSection();
                _sectionsTemplates.Add(sectionId, section);
            }
            return(section);
        }
예제 #2
0
        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);
                }
            }
        }