Ejemplo n.º 1
0
        public ILabelCommand AddLabelCommand(string id)
        {
            var cmd = new LabelCommand();

            commands.Add(id, cmd);
            return(cmd);
        }
 public EventCommandLabel(LabelCommand refCommand, FrmEvent editor)
 {
     InitializeComponent();
     mMyCommand   = refCommand;
     mEventEditor = editor;
     InitLocalization();
     txtLabel.Text = mMyCommand.Label;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var videoEditor = new VideoEditor();
            var history     = new History();


            var setTextCommand = new LabelCommand("label", history, videoEditor);

            setTextCommand.execute();
            Console.WriteLine("Text: " + videoEditor);

            setTextCommand = new LabelCommand("New Label", history, videoEditor);
            setTextCommand.execute();
            Console.WriteLine("Text: " + videoEditor);


            var setContrastCommand = new ContrastCommand(100.65f, history, videoEditor);

            setContrastCommand.execute();
            Console.WriteLine("Contrast: " + videoEditor);

            setContrastCommand = new ContrastCommand(1.05f, history, videoEditor);
            setContrastCommand.execute();
            Console.WriteLine("Contrast: " + videoEditor);


            var undoCommand = new UndoCommand(history);

            undoCommand.execute();
            Console.WriteLine("Undo: " + videoEditor);

            undoCommand.execute();
            Console.WriteLine("Undo: " + videoEditor);

            undoCommand.execute();
            Console.WriteLine("Undo: " + videoEditor);

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        public void DashLabel(string label)
        {
            IHalationCommand cmd = new LabelCommand(Halation.CurrentSelectedLine, this.GetIndent(Halation.CurrentSelectedLine), Halation.currentCodePackage, label);

            HalationInvoker.Dash(Halation.currentScriptName, cmd);
        }
Ejemplo n.º 5
0
            public void ToLabel(LabelCommand command)
            {
                _file.WriteLine($"// Label argument {command.Arg1}");

                _file.WriteLine($"({command.Arg1})");
            }
Ejemplo n.º 6
0
 protected internal override void VisitLabelCommand(LabelCommand labelCommand)
 {
     this.WriteIndent();
     this.writer.WriteLine("label {0}", labelCommand.Label);
 }
Ejemplo n.º 7
0
 private static string GetCommandText(LabelCommand command, MapInstance map)
 {
     return(Strings.EventCommandList.label.ToString(command.Label));
 }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            using (reader = File.OpenText("input.txt"))
                using (writer = new StreamWriter(File.Create("output.txt")))
                {
                    QuackVM  vm = new QuackVM();
                    Workflow wf = new Workflow(vm);

                    while (!reader.EndOfStream)
                    {
                        string   str = reader.ReadLine();
                        ICommand cmd = null;
                        switch (str[0])
                        {
                        case '+':
                            cmd = new PlusCommand();
                            break;

                        case '-':
                            cmd = new MinusCommand();
                            break;

                        case '*':
                            cmd = new MultiplyCommand();
                            break;

                        case '/':
                            cmd = new DivideCommand();
                            break;

                        case '%':
                            cmd = new ModuloCommand();
                            break;

                        case '>':
                            cmd = new SetRegisterCommand(str[1]);
                            break;

                        case '<':
                            cmd = new GetRegisterCommand(str[1]);
                            break;

                        case 'P':
                            if (str.Length > 1)
                            {
                                cmd = new PrintRegisterCommand(str[1]);
                            }
                            else
                            {
                                cmd = new PrintCommand();
                            }
                            break;

                        case 'C':
                            if (str.Length > 1)
                            {
                                cmd = new PrintRegisterCharCommand(str[1]);
                            }
                            else
                            {
                                cmd = new PrintCharCommand();
                            }
                            break;

                        case ':':
                            cmd = new LabelCommand(str.Substring(1));
                            break;

                        case 'J':
                            cmd = new GoToLabelCommand(str.Substring(1));
                            break;

                        case 'Z':
                            cmd = new GoToLabelZCommand(str[1], str.Substring(2));
                            break;

                        case 'E':
                            cmd = new GoToLabelECommand(str[1], str[2], str.Substring(3));
                            break;

                        case 'G':
                            cmd = new GoToLabelGCommand(str[1], str[2], str.Substring(3));
                            break;

                        case 'Q':
                            cmd = new QuitCommand();
                            break;

                        default:
                            cmd = new NumberCommand(int.Parse(str));
                            break;
                        }
                        wf.AddCommand(cmd);
                    }

                    while (!wf.IsCompleted())
                    {
                        wf.ExecuteCurrentCommand();
                    }
                }
        }