Ejemplo n.º 1
0
        private static void Process()
        {
            while (true)
            {
                var input = Console.ReadLine();

                bool commandFound = false;

                foreach (var command in _commandsFactory.GetAllCommands())
                {
                    if (command.Matches(input))
                    {
                        var result = command.Execute(input);
                        if (!string.IsNullOrEmpty(result.Message))
                        {
                            if (result.Success)
                            {
                                _logger.LogInformation(result.Message);
                            }
                            else
                            {
                                _logger.LogError(result.Message);
                            }
                        }
                        commandFound = true;
                    }
                }
                if (!commandFound)
                {
                    _logger.LogError("Command was not found write /help for all available commands");
                }
            }
        }