Exemple #1
0
 private ActionHandler(string action, string name, ParamNode[] parms, Client.Plugin plugin)
 {
     this.m_Action = action;
     this.m_Name = name;
     this.m_Params = parms;
     this.m_Plugin = plugin;
 }
Exemple #2
0
 public static string Find(string toFind, ParamNode n)
 {
     if (n.Param == toFind)
     {
         return(n.Name);
     }
     return(Find(toFind, n.Nodes));
 }
Exemple #3
0
 private string FindFirst(ParamNode node)
 {
     if (node.Param != null)
     {
         return node.Param;
     }
     return this.FindFirst(node.Nodes);
 }
Exemple #4
0
 private string FindFirst(ParamNode node)
 {
     if (node.Param != null)
     {
         return(node.Param);
     }
     return(this.FindFirst(node.Nodes));
 }
Exemple #5
0
 public void RegisterAsMacro(string action, params string[] list)
 {
     ParamNode[] options = new ParamNode[list.Length];
     for (int i = 0; i < options.Length; i++)
     {
         options[i] = new ParamNode(list[i], list[i]);
     }
     this.RegisterAsMacro(action, options);
 }
Exemple #6
0
 private string FindFirst(ParamNode[] nodes)
 {
     string str = null;
     for (int i = 0; ((nodes != null) && (str == null)) && (i < nodes.Length); i++)
     {
         str = this.FindFirst(nodes[i]);
     }
     return str;
 }
Exemple #7
0
 public void RegisterAsMacro(string action, string[,] list)
 {
     ParamNode[] options = new ParamNode[list.GetLength(0)];
     for (int i = 0; i < options.Length; i++)
     {
         options[i] = new ParamNode(list[i, 0], list[i, 1]);
     }
     this.RegisterAsMacro(action, options);
 }
Exemple #8
0
 public static ParamNode[] Count(int start, int count, string format)
 {
     ParamNode[] nodeArray = new ParamNode[count];
     for (int i = 0; i < count; i++)
     {
         string name = string.Format(format, 1 + i);
         nodeArray[i] = new ParamNode(name, i.ToString());
     }
     return(nodeArray);
 }
Exemple #9
0
 public GParamMenu(ParamNode param, ActionHandler handler, Client.Action action) : base(param.Name)
 {
     this.m_Param   = param;
     this.m_Handler = handler;
     this.m_Action  = action;
     if (this.m_Action == null)
     {
         base.Tooltip = new Tooltip(string.Format("Click here to add the instruction:\n{0} {1}", handler.Name, param.Name), true);
     }
     else
     {
         base.Tooltip = new Tooltip("Click here to change the parameter", true);
     }
     base.Tooltip.Delay = 3f;
 }
Exemple #10
0
 public GParamMenu(ParamNode param, ActionHandler handler, Client.Action action)
     : base(param.Name)
 {
     this.m_Param = param;
     this.m_Handler = handler;
     this.m_Action = action;
     if (this.m_Action == null)
     {
         base.Tooltip = new Tooltip(string.Format("Click here to add the instruction:\n{0} {1}", handler.Name, param.Name), true);
     }
     else
     {
         base.Tooltip = new Tooltip("Click here to change the parameter", true);
     }
     base.Tooltip.Delay = 3f;
 }
Exemple #11
0
        private GMenuItem GetMenuFrom(ParamNode n, Action a, ActionHandler ah)
        {
            GMenuItem item;

            if (n.Param != null)
            {
                item = new GParamMenu(n, ah, a);
            }
            else
            {
                item = new GMenuItem(n.Name);
            }
            if (n.Nodes != null)
            {
                for (int i = 0; i < n.Nodes.Length; i++)
                {
                    item.Add(this.GetMenuFrom(n.Nodes[i], a, ah));
                }
            }
            return(this.FormatMenu(item));
        }
Exemple #12
0
 public ParamNode(string name, ParamNode[] nodes)
     : this(name, null, nodes)
 {
 }
 public static string Find(string toFind, ParamNode n)
 {
     if (n.Param == toFind)
     {
         return n.Name;
     }
     return Find(toFind, n.Nodes);
 }
Exemple #14
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);
 }
 private GMenuItem GetMenuFrom(ParamNode n, Action a, ActionHandler ah)
 {
     GMenuItem item;
     if (n.Param != null)
     {
         item = new GParamMenu(n, ah, a);
     }
     else
     {
         item = new GMenuItem(n.Name);
     }
     if (n.Nodes != null)
     {
         for (int i = 0; i < n.Nodes.Length; i++)
         {
             item.Add(this.GetMenuFrom(n.Nodes[i], a, ah));
         }
     }
     return this.FormatMenu(item);
 }
Exemple #16
0
 public void RegisterAsMacro(string action, params string[] list)
 {
     ParamNode[] options = new ParamNode[list.Length];
     for (int i = 0; i < options.Length; i++)
     {
         options[i] = new ParamNode(list[i], list[i]);
     }
     this.RegisterAsMacro(action, options);
 }
Exemple #17
0
 public void RegisterAsMacro(string action, string[,] list)
 {
     ParamNode[] options = new ParamNode[list.GetLength(0)];
     for (int i = 0; i < options.Length; i++)
     {
         options[i] = new ParamNode(list[i, 0], list[i, 1]);
     }
     this.RegisterAsMacro(action, options);
 }
Exemple #18
0
 public static ParamNode[] Count(int start, int count, string format)
 {
     ParamNode[] nodeArray = new ParamNode[count];
     for (int i = 0; i < count; i++)
     {
         string name = string.Format(format, 1 + i);
         nodeArray[i] = new ParamNode(name, i.ToString());
     }
     return nodeArray;
 }
Exemple #19
0
 private ParamNode(string name, string param, ParamNode[] nodes)
 {
     this.m_Name = name;
     this.m_Param = param;
     this.m_Nodes = nodes;
 }
 public static string Find(string toFind, ParamNode[] nodes)
 {
     for (int i = 0; (nodes != null) && (i < nodes.Length); i++)
     {
         string str = Find(toFind, nodes[i]);
         if (str != null)
         {
             return str;
         }
     }
     return null;
 }