示例#1
0
        private void HandleMessage(MessageRequest messageRequest)
        {
            var timer = Stopwatch.StartNew();

            if (messageRequest.Text[0] != _source.MessageFlag)
            {
                return;
            }

            _log.LogInformation("Received command request");
            var commandRequest = _argumentParser.ParseCommandRequest(messageRequest);
            var command        = _commandAccessor.LocateCommandGroup(commandRequest.CommandName);

            _commandAccessor.PopulateCommand(command, commandRequest);
            if (command == null)
            {
                return;
            }

            var pid = _commandEngine.StartCommand(command, commandRequest, _source);

            _log.LogInformation($"Started process with pid of {pid}");
            timer.Stop();
            _log.LogWarning($"Took {timer.ElapsedMilliseconds}ms to find and execute command!");
        }