public ModuleData(ProjectData projectData, XmlNode xmlNode, XmlNode Elements) { XmlNode = xmlNode; Parent = projectData; Native = false; Name = xmlNode.Attributes["name"].Value; ClassicName = Name.Replace("/", "_").Replace(" ", "_").ToLower(); if (xmlNode.Attributes["xmi:id"] != null) { ID = xmlNode.Attributes["xmi:id"].Value; } else { ID = xmlNode.Attributes["xmi:idref"].Value; } NameDirectory = xmlNode.Attributes["name"].Value; NameDirectory = NameDirectory.Replace("/", "_"); NameDirectory = NameDirectory.ToLower(); Data = new Dictionary <string, object>(); Depends = new List <string>(); Depends.Add("base"); Depends.Add("board"); Documentation = ""; ListOfClass = new List <ClassData>(); ListOfMenu = new Dictionary <string, string>(); Menus = ""; Dashboard = ""; menu_count = 1; ModuleName = Utils.getExtra(xmlNode, "module", ClassicName)[0]; ModulePath = Utils.getExtra(xmlNode, "modulepath", ModuleName.Replace('.', '_'))[0]; foreach (XmlNode element in Elements.ChildNodes) { if (element.Attributes["name"] != null) { if (element.Attributes["xmi:idref"].Value.Equals(ID)) { if (element["properties"] != null) { Documentation = (element["properties"].Attributes["documentation"] != null) ? element["properties"].Attributes["documentation"].Value : "Gestion du module : " + Utils.firstCharUpper(Name.Replace("_", " ")); Alias = (element["properties"].Attributes["alias"] != null) ? element["properties"].Attributes["alias"].Value : Utils.firstCharUpper(Name.Replace("_", " ")); Menus = "<menuitem name=\"" + Alias + "\" id=\"menu_" + ClassicName + "\" web_icon=\"images/icon.png\" web_icon_hover=\"images/icon-hover.png\"/>"; Menus += "\r\n\t\t" + "<menuitem name=\"" + Alias + "\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_" + ClassicName + "\" sequence=\"" + menu_count.ToString() + "\"/>"; //Menus = "<menuitem name=\"" + Alias + "\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_" + ClassicName + "\" sequence=\"" + menu_count.ToString() + "\"/>"; if (!ListOfMenu.ContainsKey("default")) { ListOfMenu["default"] = "leftmenu_" + ClassicName; } ListOfMenu["leftmenu_" + ClassicName] = "leftmenu_" + ClassicName; menu_count++; //------------------------ Menus += "\r\n\t\t" + "<menuitem name=\"Rapports\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_rapport_" + ClassicName + "\" sequence=\"%sequence1%\"/>"; ListOfMenu["leftmenu_rapport_" + ClassicName] = "leftmenu_rapport_" + ClassicName; Menus += "\r\n\t\t" + "<menuitem name=\"" + Alias + "\" parent=\"leftmenu_rapport_" + ClassicName + "\" id=\"leftsubmenu_rapport_" + ClassicName + "\" sequence=\"%sequence2%\"/>"; ListOfMenu["leftsubmenu_rapport_" + ClassicName] = "leftsubmenu_rapport_" + ClassicName; } if (element["tags"] != null) { foreach (XmlNode tagNode in element["tags"].ChildNodes) { switch (tagNode.Attributes["name"].Value) { case "category": { Category = tagNode.Attributes["value"].Value; break; } case "menu": { /* * string[] menu = tagNode.Attributes["value"].Value.Split(new char[]{ ':' }); * * Menus += "\r\n\t\t" + "<menuitem name=\"" + menu[1].Trim() + "\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_" + menu[0].Trim() + "\" sequence=\"" + menu_count.ToString() + "\"/>"; * * if (!ListOfMenu.ContainsKey("default")) * { * ListOfMenu["default"] = "leftmenu_" + menu[0].Trim(); * } * * ListOfMenu["leftmenu_" + menu[0].Trim()] = "leftmenu_" + menu[0].Trim(); * * menu_count++; * */ break; } } } } } else if (element.Attributes["name"].Value.Equals("Class Model")) { if (element["model"].Attributes["package"].Value.Equals(ID)) { string ClassModelID = element.Attributes["xmi:idref"].Value; foreach (XmlNode subElementXmlNode in Elements.ChildNodes) { if (subElementXmlNode.Attributes["xmi:type"] != null) { if (subElementXmlNode.Attributes["xmi:type"].Value.Equals("uml:Class")) { if (subElementXmlNode["model"].Attributes["package"].Value.Equals(ClassModelID)) { ClassData classData = new ClassData(this, subElementXmlNode); ListOfClass.Add(classData); } } } } } } else if (xmlNode.Attributes["xmi:id"] == null) { if (element.Attributes["xmi:type"] != null) { if (element.Attributes["xmi:type"].Value.Equals("uml:Class")) { if (element["model"].Attributes["package"].Value.Equals(ID)) { ClassData classData = new ClassData(this, element); ListOfClass.Add(classData); } } } } } } if (!Menus.Equals("")) { Menus = Menus.Replace("%sequence1%", menu_count.ToString()); menu_count++; Menus = Menus.Replace("%sequence2%", menu_count.ToString()); menu_count++; } }
public ModuleData(ProjectData projectData, XmlNode xmlNode, XmlNode Elements) { XmlNode = xmlNode; Parent = projectData; Native = false; Name = xmlNode.Attributes["name"].Value; ClassicName = Name.Replace("/", "_").Replace(" ", "_").ToLower(); if (xmlNode.Attributes["xmi:id"] != null) { ID = xmlNode.Attributes["xmi:id"].Value; } else { ID = xmlNode.Attributes["xmi:idref"].Value; } NameDirectory = xmlNode.Attributes["name"].Value; NameDirectory = NameDirectory.Replace("/", "_"); NameDirectory = NameDirectory.ToLower(); Data = new Dictionary<string, object>(); Depends = new List<string>(); Depends.Add("base"); Depends.Add("board"); Documentation = ""; ListOfClass = new List<ClassData>(); ListOfMenu = new Dictionary<string, string>(); Menus = ""; Dashboard = ""; menu_count = 1; ModuleName = Utils.getExtra(xmlNode, "module", ClassicName)[0]; ModulePath = Utils.getExtra(xmlNode, "modulepath", ModuleName.Replace('.', '_'))[0]; foreach (XmlNode element in Elements.ChildNodes) { if (element.Attributes["name"] != null) { if (element.Attributes["xmi:idref"].Value.Equals(ID)) { if (element["properties"] != null) { Documentation = (element["properties"].Attributes["documentation"] != null) ? element["properties"].Attributes["documentation"].Value : "Gestion du module : " + Utils.firstCharUpper(Name.Replace("_", " ")); Alias = (element["properties"].Attributes["alias"] != null) ? element["properties"].Attributes["alias"].Value : Utils.firstCharUpper(Name.Replace("_", " ")); Menus = "<menuitem name=\"" + Alias + "\" id=\"menu_" + ClassicName + "\" web_icon=\"images/icon.png\" web_icon_hover=\"images/icon-hover.png\"/>"; Menus += "\r\n\t\t" + "<menuitem name=\"" + Alias + "\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_" + ClassicName + "\" sequence=\"" + menu_count.ToString() + "\"/>"; //Menus = "<menuitem name=\"" + Alias + "\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_" + ClassicName + "\" sequence=\"" + menu_count.ToString() + "\"/>"; if (!ListOfMenu.ContainsKey("default")) { ListOfMenu["default"] = "leftmenu_" + ClassicName; } ListOfMenu["leftmenu_" + ClassicName] = "leftmenu_" + ClassicName; menu_count++; //------------------------ Menus += "\r\n\t\t" + "<menuitem name=\"Rapports\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_rapport_" + ClassicName + "\" sequence=\"%sequence1%\"/>"; ListOfMenu["leftmenu_rapport_" + ClassicName] = "leftmenu_rapport_" + ClassicName; Menus += "\r\n\t\t" + "<menuitem name=\"" + Alias + "\" parent=\"leftmenu_rapport_" + ClassicName + "\" id=\"leftsubmenu_rapport_" + ClassicName + "\" sequence=\"%sequence2%\"/>"; ListOfMenu["leftsubmenu_rapport_" + ClassicName] = "leftsubmenu_rapport_" + ClassicName; } if (element["tags"] != null) { foreach (XmlNode tagNode in element["tags"].ChildNodes) { switch (tagNode.Attributes["name"].Value) { case "category": { Category = tagNode.Attributes["value"].Value; break; } case "menu": { /* string[] menu = tagNode.Attributes["value"].Value.Split(new char[]{ ':' }); Menus += "\r\n\t\t" + "<menuitem name=\"" + menu[1].Trim() + "\" parent=\"menu_" + ClassicName + "\" id=\"leftmenu_" + menu[0].Trim() + "\" sequence=\"" + menu_count.ToString() + "\"/>"; if (!ListOfMenu.ContainsKey("default")) { ListOfMenu["default"] = "leftmenu_" + menu[0].Trim(); } ListOfMenu["leftmenu_" + menu[0].Trim()] = "leftmenu_" + menu[0].Trim(); menu_count++; */ break; } } } } } else if (element.Attributes["name"].Value.Equals("Class Model")) { if (element["model"].Attributes["package"].Value.Equals(ID)) { string ClassModelID = element.Attributes["xmi:idref"].Value; foreach (XmlNode subElementXmlNode in Elements.ChildNodes) { if (subElementXmlNode.Attributes["xmi:type"] != null) { if (subElementXmlNode.Attributes["xmi:type"].Value.Equals("uml:Class")) { if (subElementXmlNode["model"].Attributes["package"].Value.Equals(ClassModelID)) { ClassData classData = new ClassData(this, subElementXmlNode); ListOfClass.Add(classData); } } } } } } else if (xmlNode.Attributes["xmi:id"] == null) { if (element.Attributes["xmi:type"] != null) { if (element.Attributes["xmi:type"].Value.Equals("uml:Class")) { if (element["model"].Attributes["package"].Value.Equals(ID)) { ClassData classData = new ClassData(this, element); ListOfClass.Add(classData); } } } } } } if (!Menus.Equals("")) { Menus = Menus.Replace("%sequence1%", menu_count.ToString()); menu_count++; Menus = Menus.Replace("%sequence2%", menu_count.ToString()); menu_count++; } }