コード例 #1
0
ファイル: Program.cs プロジェクト: vejuhust/msft-scooter
        private static void ExecuteInstructionFromFile(string filename)
        {
            var parser = new InstructionInterpreter(filename);
            var controller = new HardwareInstructionController();

            HardwareInstruction instruction;
            while ((instruction = parser.GetNextInstruction()) != null)
            {
                Console.WriteLine("\n[{0}{1}]", instruction.Operator, instruction.HasOperand ? " " + instruction.Operand : string.Empty);

                if (instruction.Operator == HardwareOperator.NoOp || instruction.Operator == HardwareOperator.Exit)
                {
                    break;
                }
                else
                {
                    controller.ExecuteInstruction(instruction);
                }
            }
        }
コード例 #2
0
        private static void ExecuteInstructionFromFile(string filename)
        {
            var parser     = new InstructionInterpreter(filename);
            var controller = new HardwareInstructionController();

            HardwareInstruction instruction;

            while ((instruction = parser.GetNextInstruction()) != null)
            {
                Console.WriteLine("\n[{0}{1}]", instruction.Operator, instruction.HasOperand ? " " + instruction.Operand : string.Empty);

                if (instruction.Operator == HardwareOperator.NoOp || instruction.Operator == HardwareOperator.Exit)
                {
                    break;
                }
                else
                {
                    controller.ExecuteInstruction(instruction);
                }
            }
        }