public override ICommand Execute(WSCommandTypeBase command, ExecuteCommandContext context) { SetCommandParserRequest cmd = new SetCommandParserRequest(command); SetCommandParserResponse response = new SetCommandParserResponse(); response.IsSuccess = false; if (context != null && context.CommandSession != null) { if (Parsers.ContainsKey(cmd.Type)) { context.CommandSession.CommandParser = Parsers[cmd.Type]; response.IsSuccess = true; } else { response.Message = "未知的命令格式"; } } else { response.Message = "内部错误,会话为空"; } return(response); }
public override ICommand Parse(WSCommandTypeBase command) { SetCommandParserRequest cmd = new SetCommandParserRequest(); cmd.LoadCommand(command); return(cmd); }