Ejemplo n.º 1
0
 public static void Register(string action, ParamNode[] parms, Client.Plugin plugin)
 {
     string str;
     if (m_Table == null)
     {
         m_Table = new Hashtable();
     }
     if (m_List == null)
     {
         m_List = new ArrayList();
     }
     if (m_RootNode == null)
     {
         m_RootNode = new ActionNode("-root-");
     }
     string[] strArray = action.Split(new char[] { '|' });
     ActionNode rootNode = m_RootNode;
     for (int i = 0; i < (strArray.Length - 1); i++)
     {
         ActionNode node = rootNode.GetNode(strArray[i]);
         if (node == null)
         {
             rootNode.Nodes.Add(node = new ActionNode(strArray[i]));
             rootNode.Nodes.Sort();
         }
         rootNode = node;
     }
     action = strArray[strArray.Length - 1];
     int index = action.IndexOf('@');
     if (index >= 0)
     {
         str = action.Substring(index + 1);
         action = action.Substring(0, index);
     }
     else
     {
         str = action;
     }
     ActionHandler handler = new ActionHandler(action, str, parms, plugin);
     rootNode.Handlers.Add(handler);
     rootNode.Handlers.Sort();
     m_Table[action] = handler;
     m_List.Add(handler);
 }
Ejemplo n.º 2
0
 private GMenuItem GetMenuFrom(ActionNode n)
 {
     GMenuItem mi = new GMenuItem(n.Name);
     for (int i = 0; i < n.Nodes.Count; i++)
     {
         mi.Add(this.GetMenuFrom((ActionNode) n.Nodes[i]));
     }
     for (int j = 0; j < n.Handlers.Count; j++)
     {
         ActionHandler action = (ActionHandler) n.Handlers[j];
         GMenuItem item2 = new GNewActionMenu(this, this.m_Macro, action);
         for (int k = 0; (action.Params != null) && (k < action.Params.Length); k++)
         {
             item2.Add(this.GetMenuFrom(action.Params[k], null, action));
         }
         mi.Add(this.FormatMenu(item2));
     }
     return this.FormatMenu(mi);
 }