public override void StartProcessing(string filePath) { DisplayConsole.ShowMessage("You can run commands from the console by removing the filepath argument when starting this application."); if (!File.Exists(filePath)) { DisplayConsole.ShowMessage($"The file {filePath} does not exist.\r\n Please check that you have entered the proper path."); return; } DisplayConsole.ShowMessage($"Processing commands from {filePath}"); var lines = File.ReadLines(filePath); foreach (var input in lines) { DisplayConsole.ShowMessage($"Command: {input}"); if (string.IsNullOrEmpty(input)) { break; } else { this.OnNext(input); } } }
public Engine() { World = new World(38); PathFinder = new PathFinder(World); Characters = new Dictionary <int, Character>(); console = new DisplayConsole(); gridWindow = console.AddWindow("grid", 2, 2, 40, 40); logWindow = console.AddWindow("log", 44, 2, 30, 40); }
public void TestMethod2() { TestOutput output = new TestOutput(); DisplayConsole displayConsole = new DisplayConsole(output, 15); displayConsole.WriteLine("uno-due"); displayConsole.WriteLine("tre"); string expected = "uno-due" + Environment.NewLine + "tre"; string actual = output.currentText; Assert.AreEqual(expected, actual); }
static void Main(string[] args) { // Assemble your system here from all the classes Door door = new Door(); RfidReader rfidReader = new RfidReader(); ChargeControl charger = new ChargeControl(new UsbChargerSimulator(), new DisplayConsole()); DisplayConsole display = new DisplayConsole(); StationControl statCtrl = new StationControl(charger, display, door, rfidReader); bool finish = false; do { string input; System.Console.WriteLine("Indtast E, O, C, R: "); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': finish = true; break; case 'O': door.OnDoorOpened(); break; case 'C': door.OnDoorClosed(); break; case 'R': System.Console.WriteLine("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); rfidReader.OnRfidRead(id); break; default: break; } } while (!finish); }
public override void StartProcessing(string parameter) { DisplayConsole.ShowMessage("You can use file input by typing RobotSimulor <FilePath>\r\nWaiting for command...\r\nPress ENTER to exit"); while (true) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } else { this.OnNext(input); } } }
public Gui() { console = new DisplayConsole(); gridWindow = console.AddWindow("grid", 2, 2, 18, 18); chunksWindow = console.AddWindow("chunks", 23, 2, 10, 18); }