public void Start() { while (true) { // read from console var reader = new ConsoleReaderProvider(); var writer = new ConsoleWriterProvider(); var commandFromInput = reader.ReadLine(); if (commandFromInput.ToLower() == TerminationCommand.ToLower()) { writer.WriteLine("Program terminated."); break; } try { var executionResult = this.processor.Process(commandFromInput); } catch (UserValidationException ex) { writer.WriteLine(ex.Message); } catch (Exception ex) { writer.WriteLine(ex.Message); this.logger.Error(ex.Message); } } }
public EngineModule(ConsoleReaderProvider consoleReaderProvider, ConsoleWriterProvider consoleWriterProvider, CommandParserProvider commandParserProvider) { this.consoleReaderProvider = consoleReaderProvider; this.consoleWriterProvider = consoleWriterProvider; this.commandParserProvider = commandParserProvider; }
private static Engine GetEngineInstance() { IWriterProvider writer = new ConsoleWriterProvider(); IReaderProvider reader = new ConsoleReaderProvider(); ICommandProvider commandProvider = new CommandProvider(); Engine engine = new Engine(reader, writer, commandProvider); return(engine); }
public static void Main() { var readerProvider = new ConsoleReaderProvider(); var writerProvider = new ConsoleWriterProvider(); var parserProvider = new CommandParserProvider(); var engine = new Engine(readerProvider, writerProvider, parserProvider); engine.Run(); }
public static void Main() { IReader reader = new ConsoleReaderProvider(); IWriter writer = new ConsoleWriterProvider(); IParser parser = new CommandParserProvider(); Engine engine = new Engine(reader, writer, parser); engine.Start(); }
public static void Main() { var reader = new ConsoleReaderProvider(); var writer = new ConsoleWriterProvider(); var commandFactory = new CommandFactory(reader, writer); var menu = new Menu(reader, writer, commandFactory); menu.Start(); }
public static void Main() { var reader = new ConsoleReaderProvider(); var writer = new ConsoleWriterProvider(); var levelFactory = new LevelFactory(); var engine = new GameEngine(levelFactory, reader, writer); engine.StartGame(); }
public static void Main() { var modelsFactory = new ModelsFactory(); var database = new Database(); var commandsFactory = new CommandsFactory(database, modelsFactory); var commandProcessor = new CommandProcessor(commandsFactory); var fileLogger = new FileLogger(); var engineReader = new ConsoleReaderProvider(); var engineWriter = new ConsoleWriterProvider(); var engine = new Engine(fileLogger, commandProcessor, engineReader, engineWriter); var provider = new EngineProvider(engine); provider.StartEngine(); }