internal void macroPlaySetInput(string method, string field, string value, MacroPlayer.MacroCallbackType macroCallbackType) { macroCallback = macroCallbackType; if (macroPlaySelectNode(method, treeMethods.Nodes, treeMethods) != null) { TreeNode body = treeInput.Nodes.Find("Body", true)[0]; foreach (TreeNode tn in body.Nodes) { TreeNodeProperty tnp = (tn.Tag as TreeNodeProperty); if (tnp != null) { if (string.Compare(field, tnp.Name, StringComparison.InvariantCultureIgnoreCase) == 0) { treeInput.SelectedNode = tn; object ovalue = value; if (!tnp.Type.Equals(typeof(String))) { if (tnp.Type.Equals(typeof(DateTime)) && value.Equals("TODAY")) { value = DateTime.Now.ToString("yyyy-MM-dd"); } MethodInfo[] mi = tnp.Type.GetMethods(); foreach (MethodInfo m in mi) { if ("Parse".Equals(m.Name)) { ParameterInfo[] pi = m.GetParameters(); if ((pi.Length == 1) && (pi[0].ParameterType.Equals(typeof(String)))) { ovalue = m.Invoke(m, new object[] { value }); break; } } } } TreeNodeProperty property2 = TreeNodeProperty.CreateTreeNodeProperty(tnp, ovalue); property2.TreeNode = tnp.TreeNode; property2.RecreateSubtree(null); this.treeInput.SelectedNode = property2.TreeNode; macroCallback.Invoke(); } } } } }
private void buttonMacroPlay_Click(object sender, EventArgs e) { if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift) || string.IsNullOrEmpty(macroFile)) { OpenFileDialog dialog = new OpenFileDialog(); dialog.CheckFileExists = true; dialog.CheckPathExists = true; dialog.Multiselect = false; dialog.Filter = "Text files (*.txt)|*.txt|Macro files (*.macro)|*.macro|All files (*.*)|*.*"; dialog.Title = "Select a macro file to play"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) macroFile = dialog.FileName; else return; } if (!string.IsNullOrEmpty(macroFile)) { MacroPlayer macroPlayer = new MacroPlayer(this, macroFile); macroPlayer.Play(); } }
internal void macroPlayInvoke(string method, MacroPlayer.MacroCallbackType macroCallbackType) { macroCallback = macroCallbackType; if (macroPlaySelectNode(method, treeMethods.Nodes, treeMethods) != null) buttonInvoke.PerformClick(); }
public void macroPlayGetWsdl(string uri, MacroPlayer.MacroCallbackType macroCallbackType) { macroCallback = macroCallbackType; comboEndPointUri.Text = uri; buttonGet.PerformClick(); }
public void macroPlaySort(MacroPlayer.MacroCallbackType macroCallbackType) { treeMethods.Sort(); }
public string macroPlayLogT(MacroPlayer.Trees t) { string s = string.Empty; switch (t) { case MacroPlayer.Trees.METHODS: if (treeMethods.Nodes.Count > 0) s = Serializer.SerializeToString(treeMethods.Nodes); break; case MacroPlayer.Trees.INPUT: if (treeInput.SelectedNode != null) s = Serializer.SerializeToString(treeInput.Nodes); break; case MacroPlayer.Trees.OUTPUT: if (treeOutput.Nodes.Count > 0) s = Serializer.SerializeToString(treeOutput.Nodes); break; } return s; }
internal void macroPlayCopy(string output, string fieldOut, string method, string fieldIn, MacroPlayer.MacroCallbackType macroCallbackType) { macroCallback = macroCallbackType; string v = macroPlayGetValue(output, fieldOut, treeOutput.Nodes); macroPlaySetInput(method, fieldIn, v, macroCallbackType); }