public async Task <ServerStatusDetails> GetStatus(ServerRequest request) { var pingResponse = await _pingClient.Ping(request.IpAddress); var serverResponse = pingResponse.Success ? await _gameClient.GetStatus(request.IpAddress, request.Port) : BuildNullServerResponse(); var mappedResponse = serverResponse.Success ? _q3aServerResponseMapper.Map(serverResponse.Data) : BuildNullServerDetails(); mappedResponse.IpAddress = request.IpAddress; mappedResponse.Port = request.Port; mappedResponse.Ping = pingResponse.Milliseconds; return(mappedResponse); }
public async Task <ServerInfoDetails> GetInfo(ServerRequest request) { var pingResponse = await _pingClient.Ping(request.IpAddress); var serverResponse = pingResponse.Success ? await _serverClient.GetInfo(request.IpAddress, request.Port) : BuildNullServerResponse(); var mappedResponse = serverResponse.Success ? _infoResponseMapper.Map(serverResponse.Data) : new ServerInfoDetails { HostName = "Null response" }; mappedResponse.Ping = pingResponse.Milliseconds; return(mappedResponse); }