示例#1
0
        /// <summary>
        /// 重载执行命令
        /// </summary>
        public void Dash()
        {
            // IF节点
            Dictionary <string, ArgumentPackage> ifArgDict = new Dictionary <string, ArgumentPackage>();

            ifArgDict.Add("op1", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.operand1
            });
            ifArgDict.Add("op2", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.operand2
            });
            ifArgDict.Add("opr", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.operateMode
            });
            ifArgDict.Add("expr", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.condExpr
            });
            ifArgDict.Add("?elseflag", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.isContainElse.ToString()
            });
            ActionPackage ap1 = new ActionPackage()
            {
                indent   = this.indent,
                argsDict = ifArgDict,
                nodeName = String.Format("{0}@{1}", this.commandLine, ActionPackageType.act_if.ToString()),
                nodeType = ActionPackageType.act_if
            };

            this.parent.AddAction(ap1, this.commandLine);
            HalationViewCommand.AddItemToCodeListbox(this.commandLine, ap1.indent,
                                                     String.Format("◆{0}{1}{2}", ap1.GetActionName(), ap1.GetSpace(), ap1.GetParaDescription()));
            // PAD节点
            ActionPackage ap2 = new ActionPackage()
            {
                indent   = this.indent + 2,
                argsDict = new Dictionary <string, ArgumentPackage>(),
                nodeName = "pad",
                nodeType = ActionPackageType.NOP
            };

            this.parent.AddAction(ap2, this.commandLine + 1);
            HalationViewCommand.AddItemToCodeListbox(this.commandLine + 1, ap2.indent, "◆");
            // 考虑ELSE子句
            if (this.isContainElse)
            {
                // ELSE节点
                ActionPackage ap3 = new ActionPackage()
                {
                    indent   = this.indent,
                    argsDict = new Dictionary <string, ArgumentPackage>(),
                    nodeName = String.Format("{0}@{1}", this.commandLine + 2, ActionPackageType.act_else.ToString()),
                    nodeType = ActionPackageType.act_else
                };
                this.parent.AddAction(ap3, this.commandLine + 2);
                HalationViewCommand.AddItemToCodeListbox(this.commandLine + 2, ap3.indent, ":除此以外的情况");
                // PAD节点
                ActionPackage ap4 = new ActionPackage()
                {
                    indent   = this.indent + 2,
                    argsDict = new Dictionary <string, ArgumentPackage>(),
                    nodeName = "pad",
                    nodeType = ActionPackageType.NOP
                };
                this.parent.AddAction(ap4, this.commandLine + 3);
                HalationViewCommand.AddItemToCodeListbox(this.commandLine + 3, ap4.indent, "◆");
                // ENDIF节点
                ActionPackage ap5 = new ActionPackage()
                {
                    indent   = this.indent,
                    argsDict = new Dictionary <string, ArgumentPackage>(),
                    nodeName = String.Format("{0}@{1}", this.commandLine + 2, ActionPackageType.act_endif.ToString()),
                    nodeType = ActionPackageType.act_endif
                };
                this.parent.AddAction(ap5, this.commandLine + 4);
                HalationViewCommand.AddItemToCodeListbox(this.commandLine + 4, ap5.indent, ":分支结束");
            }
            else
            {
                // ENDIF节点(这里不能与上面的endif合并,因为commandline有变化)
                ActionPackage ap6 = new ActionPackage()
                {
                    indent   = this.indent,
                    argsDict = new Dictionary <string, ArgumentPackage>(),
                    nodeName = String.Format("{0}@{1}", this.commandLine + 2, ActionPackageType.act_endif.ToString()),
                    nodeType = ActionPackageType.act_endif
                };
                this.parent.AddAction(ap6, this.commandLine + 2);
                HalationViewCommand.AddItemToCodeListbox(this.commandLine + 2, ap6.indent, ":分支结束");
            }
        }
        /// <summary>
        /// 执行这条指令
        /// </summary>
        public void Dash()
        {
            var ArgDict = this.ArgumentList.ToDictionary(kvp => kvp.Key, kvp => new ArgumentPackage()
            {
                aType = kvp.Value.Key, valueExp = kvp.Value.Value
            });
            ActionPackage ap = new ActionPackage()
            {
                indent   = this.indent,
                argsDict = ArgDict,
                nodeName = String.Format("{0}@{1}", this.commandLine, this.apType),
                nodeType = this.apType
            };

            this.parent.AddAction(ap, this.commandLine);
            HalationViewCommand.AddItemToCodeListbox(this.commandLine, ap.indent,
                                                     String.Format("◆{0}{1}{2}", ap.GetActionName(), ap.GetSpace(), ap.GetParaDescription()));
        }
        /// <summary>
        /// 执行这条指令
        /// </summary>
        public void Dash()
        {
            // 构造参数字典
            var ArgDict = this.ArgumentList.ToDictionary(kvp => kvp.Key, kvp => new ArgumentPackage()
            {
                aType = kvp.Value.Key, valueExp = kvp.Value.Value
            });
            // 构造新的动作包装
            ActionPackage ap = new ActionPackage()
            {
                indent   = this.indent,
                argsDict = ArgDict,
                nodeName = String.Format("{0}@{1}", this.commandLine, this.apType),
                nodeType = this.apType
            };

            // 缓存编辑前的动作
            this.LastAP = this.parent.GetAction(this.commandLine);
            // 更新后台
            this.parent.ReplaceAction(ap, this.commandLine);
            // 更新前端
            HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine);
            HalationViewCommand.AddItemToCodeListbox(this.commandLine, ap.indent,
                                                     String.Format("◆{0}{1}{2}", ap.GetActionName(), ap.GetSpace(), ap.GetParaDescription()));
        }
示例#4
0
        /// <summary>
        /// 重载执行命令
        /// </summary>
        public void Dash()
        {
            // IF节点
            Dictionary <string, ArgumentPackage> ifArgDict = new Dictionary <string, ArgumentPackage>();

            ifArgDict.Add("op1", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.operand1
            });
            ifArgDict.Add("op2", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.operand2
            });
            ifArgDict.Add("opr", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.operateMode
            });
            ifArgDict.Add("expr", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.condExpr
            });
            ifArgDict.Add("?elseflag", new ArgumentPackage()
            {
                aType = ArgType.unknown, valueExp = this.isContainElse.ToString()
            });
            ActionPackage ap1 = new ActionPackage()
            {
                indent   = this.indent,
                argsDict = ifArgDict,
                nodeName = String.Format("{0}@{1}", this.commandLine, ActionPackageType.act_if.ToString()),
                nodeType = ActionPackageType.act_if
            };

            // 缓存编辑前的动作
            this.LastAP = this.parent.GetAction(this.commandLine);
            // 更新后台
            this.parent.ReplaceAction(ap1, this.commandLine);
            // 更新前端
            HalationViewCommand.RemoveItemFromCodeListbox(this.commandLine);
            HalationViewCommand.AddItemToCodeListbox(this.commandLine, ap1.indent,
                                                     String.Format("◆{0}{1}{2}", ap1.GetActionName(), ap1.GetSpace(), ap1.GetParaDescription()));
        }