/// <summary> /// create command and execute it /// </summary> /// <param name="commandLine">string from command line</param> public void Process(string commandLine) { if (commandLine.Contains(CommandInfo.Exit)) { Console.WriteLine("Goodbye!"); } else { command = creator.CreateCommand(commandLine); if (command == null) { Console.WriteLine("Incorrect command!"); } else { try { command.Execute(); } catch (NullReferenceException) { Console.WriteLine("Connection not established"); } catch (IndexOutOfRangeException) { Console.WriteLine("Incorrect conection data"); } } } }
/// <summary> /// create command and execute it /// </summary> /// <param name="commandLine">string from command line</param> public void Process(string commandLine) { if (commandLine.Contains(CommandInfo.Exit)) { Console.WriteLine("Goodbye!"); } else { command = creator.CreateCommand(commandLine); if (command == null) { Console.WriteLine("Incorrect command!"); } else { ExecuteCommand(); } } }