Beispiel #1
0
 internal void Load(string path)
 {
     if (Document != null)
     {
         Document.RemoveAll();
         Document = null;
         TemplateSelector.ClearTemplates();
     }
     Document = new XmlDocument();
     Document.Load(path);
     LoadTemplates();
 }
Beispiel #2
0
        internal void Load(string path)
        {
            if (Document != null)
            {
                Document.RemoveAll();
                Document = null;
                TemplateSelector.ClearTemplates();
            }
            Document = new XmlDocument();
            Document.Load(path);

            XmlNodeList blockList = Document.GetElementsByTagName("blocks");

            BlockManager = new BlockManager(RootPath);
            foreach (XmlNode block in blockList[0])
            {
                if (block.Name != "block")
                {
                    continue;
                }
                BlockDefinition blockDef = ProxyDeserializer.DeserializeBlock(BlockManager, block);
                BlockManager.AddBlock(blockDef);
            }

            XmlNodeList templateList = Document.GetElementsByTagName("template");

            foreach (XmlNode template in templateList)
            {
                if (template.Name != "template")
                {
                    continue;
                }
                TemplateDefinition templateDef = ProxyDeserializer.DeserializeTemplate(template);
                templateDef.rootPath = RootPath;
                TemplateSelector.AddTemplate(templateDef);
            }
        }