Example #1
0
 private void readModulesRecursive(Module mdl)
 {
     if (mdl is ModuleContainer)
     {
         ModuleContainer container = (ModuleContainer)mdl;
         foreach (Module childModule in container.ChildModules)
         {
             childModule.ContainerPage = this;
             readModulesRecursive(childModule);
         }
     }
 }
Example #2
0
        private List<Module> getModulesFromXML(XmlNode modulesNode, Module parentModule)
        {
            List<Module> res = new List<Module>();

            if (modulesNode == null || modulesNode.ChildNodes.Count==0)
                return res;

            foreach (XmlNode moduleNode in modulesNode.SelectNodes("module"))
            {
                XmlAttribute nameAttr = moduleNode.Attributes["name"];
                XmlNode serDataNode = moduleNode.SelectSingleNode("serializedData");

                if (nameAttr == null || String.IsNullOrEmpty(nameAttr.Value))
                    throw new Exception(Provider.GetResource("One of the module has no name attribute or it is invalid!"));

                if(serDataNode==null || String.IsNullOrEmpty(serDataNode.InnerText))
                    throw new Exception(Provider.GetResource("One of the module has no serializedData node or it is invalid!"));

                Module mdl = Module.Deserialize(nameAttr.Value, serDataNode.InnerText);
                res.Add(mdl);

                if (mdl is ModuleContainer)
                {
                    ModuleContainer container = mdl as ModuleContainer;
                    container._childModules = new List<Module>();
                    container._childModules.AddRange(getModulesFromXML(moduleNode.SelectSingleNode("modules"), mdl));
                }
            }
            return res;
        }