void ToolStripButton2Click(object sender, EventArgs e) { TestScriptParser parser = new TestScriptParser(scintilla1.Text, 0); TestScriptDocument document = parser.Parse(); if (OpenConnection()) { TestScriptEvalContext context = new TestScriptEvalContext(protoSpecDocument, socket); TestScriptValue result = TestScriptEval.Do(document, context); treeView4.Nodes.Clear(); foreach (TestScriptValue item in (TestScriptValueList)result.Value) { TreeNode node = treeView4.Nodes.Add(item.ModuleName + ":" + item.ActionName); TestScriptValue value = (TestScriptValue)item.Value; ProtoSpecModule module = protoSpecDocument.Modules.GetByName(item.ModuleName, true); ProtoSpecAction action = module.Actions.GetByName(item.ActionName, true); ParseResponse2(value, action.Output, node.Nodes); } } }
public void Reset(string traceId, bool isIn, byte[] packet) { this.isIn = isIn; this.traceId = traceId; string moduleId = packet[0].ToString(); string actionId = packet[1].ToString(); foreach (ProtoSpecModule module in ProtoSpecModules) { if (module.ModuleId == moduleId) { ProtoSpecAction action = module.Actions.GetById(actionId); if (action != null) { pModule = module; pAction = action; } } } this.Text = traceId + " " + (pModule != null ? pModule.Name : moduleId.ToString()) + ":" + (pAction != null ? pAction.Name : actionId.ToString()); this.ImageIndex = isIn ? 0 : 1; this.data = packet; }
void ProtoSpecSubsetTree(ProtoSpecModule module, ProtoSpecAction action, TreeNode parent, ProtoSpecSubset subset) { foreach (ProtoSpecColumn column in subset.Columns) { string columnType = ColumnTypeToString(column.ColumnType); string className = ""; if (column.ClassName != null) { if (column.ClassModule != null) { className = "<" + column.ClassModule + "." + column.ClassName + ">"; } else { className = "<" + column.ClassName + ">"; } } TreeNode columnNode = parent.Nodes.Add(column.Name + " : " + columnType + className); if (column.Format != null) { ProtoSpecSubsetTree(module, action, columnNode, column.Format); } else if (column.Values != null) { foreach (ProtoSpecEnumValue value in column.Values) { columnNode.Nodes.Add(value.Name + " = " + value.Value); } } } }