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; }
public static string Find(string toFind, ParamNode n) { if (n.Param == toFind) { return(n.Name); } return(Find(toFind, n.Nodes)); }
private string FindFirst(ParamNode node) { if (node.Param != null) { return node.Param; } return this.FindFirst(node.Nodes); }
private string FindFirst(ParamNode node) { if (node.Param != null) { return(node.Param); } return(this.FindFirst(node.Nodes)); }
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); }
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; }
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); }
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); }
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; }
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)); }
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); }
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); }
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; }
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; }