public void Run() { string input; while ((input = reader.ReadLine()) != "Exit") { var args = input.Split(" ", StringSplitOptions.RemoveEmptyEntries); using (var context = new BillsPaymentSystemContext()) { string result; try { result = commandInterpreter.Read(args, context); } catch (InvalidOperationException ex) { result = "ERROR: " + ex.Message; } catch (Exception ex) { result = "ERROR: " + ex.Message; } writer.WriteLine(result); } } }
public void Run() { IDatabaseInitializerService initializeService = this.serviceProvider.GetService <IDatabaseInitializerService>(); initializeService.InitializeDatabase(); ICommandInterpreter commandInterpreter = this.serviceProvider.GetService <ICommandInterpreter>(); while (true) { try { Console.WriteLine("Enter command:"); string[] input = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string result = commandInterpreter.Read(input); Console.WriteLine(result); Console.WriteLine(); } catch (Exception exception) when(exception is SqlException || exception is ArgumentException || exception is InvalidOperationException) { Console.WriteLine(exception.Message); Console.WriteLine(); } } }
public void Run() { string input = Console.ReadLine(); while (input != "End") { try { string[] inputArgs = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string result = commandInterpreter.Read(animalCentre, inputArgs); Console.WriteLine(result); } catch (TargetInvocationException tie) { Console.WriteLine($"{tie.InnerException.InnerException.GetType().Name}: " + tie.InnerException.InnerException.Message); } input = Console.ReadLine(); } string adoptedAnimals = animalCentre.AllAdoptedAnimals(); Console.WriteLine(adoptedAnimals); }
public void Run() { Console.WriteLine(AvailableCommands()); while (true) { try { Console.Write("Enter new command: "); string[] args = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); if (args[0] == "Exit") { break; } using (BillsPaymentSystemContext context = new BillsPaymentSystemContext()) { string result = commandInterpreter.Read(args, context); Console.WriteLine(result); } } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } } }
public void Run() { IDatabaseService databaseInitializer = this.serviceProvider.GetService <IDatabaseService>(); databaseInitializer.Initialize(); ICommandInterpreter commandInterpreter = this.serviceProvider.GetService <ICommandInterpreter>(); IReader reader = this.serviceProvider.GetService <IReader>(); IWriter writer = this.serviceProvider.GetService <IWriter>(); while (true) { string[] inputArgs = reader.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); try { string result = commandInterpreter.Read(inputArgs, this.serviceProvider); writer.WriteLine(result); } catch (ArgumentNullException ane) { writer.WriteLine(ane.Message); } catch (ArgumentException ae) { writer.WriteLine(ae.Message); } } }
public void Run() { while (true) { Console.WriteLine(commandInterpreter.Read(Console.ReadLine())); } }
public void Run() { while (true) { string input = Console.ReadLine(); Console.WriteLine(commandInterpreter.Read(input)); } }
public void Run() { while (true) { var input = Console.ReadLine(); var result = commandInterpreter.Read(input); Console.WriteLine(result); } }
public void Run() { while (true) { string command = Console.ReadLine(); string result = commandInterpreter.Read(command); Console.WriteLine(result); } }
public void Run() { while (true) { string input = Console.ReadLine(); var result = _command.Read(input); Console.WriteLine(result); } }
public void Run() { while (true) { string input = Console.ReadLine(); string result = _commandInterpretator.Read(input); Console.WriteLine(result); } }
public void Run() { string input; while ((input = Console.ReadLine()) != "Exit") { string result = commandInterpreter.Read(input); Console.WriteLine(result); } }
public void Run() { string line = Console.ReadLine(); while (true) { Console.WriteLine(commandInterpreter.Read(line)); line = Console.ReadLine(); } }
public void Run() { while (true) { string input = Console.ReadLine(); string output = command.Read(input); Console.WriteLine(output); } }
public void Run() { int userId = int.Parse(Console.ReadLine()); using (BillsPaymentSystemContext context = new BillsPaymentSystemContext()) { string result = commandInterpreter.Read(userId, context); } //TODO: Add catch exceptions }
public void Run() { string input = ""; while ((input = Console.ReadLine()) != "Exit") { string[] commandParams = input.Split(); ICommandInterpreter commandInterpreter = provider.GetService <ICommandInterpreter>(); string result = commandInterpreter.Read(commandParams); Console.WriteLine(result); } }
public void Run() { while (true) { //read data from console string input = Console.ReadLine(); //pass it to proper CommandInterpreter and receive it var result = commandInterpreter.Read(input); //print output data Console.WriteLine(result); } }
public void Run() { while (true) { string input = Console.ReadLine(); string result = commandInterpreter.Read(input); if (result == null) { break; } Console.WriteLine(result); } }
public void Run() { //TODO: Try catch blocks while (true) { string[] inputParams = Console.ReadLine() .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .ToArray(); ICommandInterpreter commandInterpreter = this.serviceProvider.GetService <ICommandInterpreter>(); string result = commandInterpreter.Read(inputParams); Console.WriteLine(result); } }
public void Run() { string args = Console.ReadLine(); try { string result = commandInterpreter.Read(args); Console.WriteLine(result); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } }
public void Run() { IDbInitializerService initialzeDb = this.serviceProvider.GetService <IDbInitializerService>(); initialzeDb.InitializeDatabase(); ICommandInterpreter commandInterpreter = this.serviceProvider.GetService <ICommandInterpreter>(); while (true) { string[] input = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string result = commandInterpreter.Read(input); Console.WriteLine(result); } }
public void Run() { while (true) { string commandInput = Console.ReadLine(); string commandResult = command.Read(commandInput); if (commandResult == null) { return; } Console.WriteLine(commandResult); } }
public void Run() { while (true) { try { string output = commandInterpreter.Read(Console.ReadLine()); Console.WriteLine(output); } catch (Exception ae) { Console.WriteLine(ae.Message); } } }
public void Run() { while (true) { string input = Console.ReadLine(); string output = command.Read(input); Console.WriteLine(output); } HelloCommand hc = new HelloCommand(); Console.WriteLine(hc.GetType().FullName); }
public void Run() { while (true) { string line = Console.ReadLine(); string result = command.Read(line); if (result == null) { break; } Console.WriteLine(result); } }
public void Run() { string input = Console.ReadLine(); while (true) { string result = commandInterpreter.Read(input); if (result == null) { Environment.Exit(1); } Console.WriteLine(result); input = Console.ReadLine(); } }
public void Run() { while (true) { var inputArgs = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries) .ToArray(); using (BookShopContext context = new BookShopContext()) { var result = commandInterpreter.Read(inputArgs, context); Console.WriteLine(result); } } }
public void Run() { string input; while ((input = Console.ReadLine()) != string.Empty) { var inputParams = input.Split(" ", StringSplitOptions.RemoveEmptyEntries); using (var context = new BillsPaymentSystemContext()) { var result = _commandInterpreter.Read(inputParams, context); Console.WriteLine(result); } //TODO } }
public void Run() { string command = string.Empty; while ((command = Console.ReadLine()) != "Exit") { string result = commandInterpreter.Read(command); if (result == null) { break; } Console.WriteLine(result); } }
public void Run() { while (true) { try { var commandRead = Console.ReadLine(); var commandResult = commandInterpreter.Read(commandRead); Console.WriteLine(commandResult); } catch (Exception e) { Console.WriteLine(e.Message); } } }