Exemplo n.º 1
0
        /// <summary>
        /// Processes the command.
        /// </summary>
        /// <param name="command">The command from user.</param>
        /// <param name="commandFactory">The instance of CommandFactory.</param>
        public static void ProcessCommand(string command, CommandFactory commandFactory)
        {
            AbstractCommand commandInstance = commandFactory.GetCommand(command);

            if (commandInstance != null)
            {
                commandInstance.GetParameters();
                commandInstance.RunCommand();
                commandInstance.ShowResult();
            }
            else
            {
                Console.WriteLine($"Command '{command}' is invalid. Enter help to get instructions.");
            }
        }