public void load_cmds(utente u, string path_cmds) { this.list = new List <cmd>(); mwl.xml.xml_doc d = new mwl.xml.xml_doc(path_cmds); foreach (mwl.xml.xml_node ng in d.nodes("//cmds/cmd-group")) { cmd_group grp = new cmd_group(ng.get_attr("title"), ng.get_attr("view") , ng.get_attr("type") != "" ? (cmd.type_cmd)Enum.Parse(typeof(cmd.type_cmd), ng.get_attr("type")) : cmd.type_cmd.none); if (grp.type == cmd.type_cmd.admin && !u.is_admin) { continue; } foreach (mwl.xml.xml_node nc in ng.nodes("cmd")) { cmd c = new cmd(grp) { prefix = nc.get_attr("prefix"), only_active_view = nc.get_bool("only_active_view"), view = nc.get_attr("view", grp.view) , action = nc.get_attr("action"), des = nc.get_attr("des"), action_optional = nc.get_attr("action-opt") == "true" , obj = nc.get_attr("object"), subobj = nc.get_attr("subobj"), subobj2 = nc.get_attr("subobj2") , hidden = nc.get_attr("hidden") == "true" , type = nc.get_attr("type") != "" ? (cmd.type_cmd)Enum.Parse(typeof(cmd.type_cmd), nc.get_attr("type")) : cmd.type_cmd.none }; if (c.type == cmd.type_cmd.admin && !u.is_admin) { continue; } this.list.Add(c); } } }
public cmd(cmd_group grp) { this.type = type_cmd.none; this.group = grp; }