public async Task <Res> CmdAsync <Res>(CommandModel cmd) where Res : class { if (cmd.ResultType != CommandType.NoResult) { _operations.Add(cmd); } if (cmd.Cmd != DebuggerCommandEnum.custom) { _transport.Send($"{cmd.Cmd} {cmd.Arg}"); OnOutput?.Invoke($"<--{cmd.Cmd} {cmd.Arg}"); } else { _transport.Send(cmd.Arg); OnOutput?.Invoke($"<--{cmd.Arg}"); } _lasCommand = cmd.Cmd; if (cmd.ResultType != CommandType.NoResult) { cmd.Wait(); return(cmd.Result as Res); } return(null); }