Exemplo n.º 1
0
        public async void PollMatchSummary(string matchId)
        {
            try
            {
                _logger.LogInformation("Poll Match Summary Request Started" + Environment.NewLine);

                //_pubGClientResponse = Task.Run(async () => await _servicerRequest.GetAsync(await _httpClient.CreateRequestHeader(), query));

                _pubGClientResponse = _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(), "shards/pc-tournaments/matches/" + matchId);

                if (_pubGClientResponse.Result.StatusCode == HttpStatusCode.OK && _pubGClientResponse != null)
                {
                    _logger.LogInformation("Poll Match Summary Requested Response Json" + Environment.NewLine);

                    var jsonResult = _pubGClientResponse.Result.Content.ReadAsStringAsync().Result;

                    await Task.Run(async() => InsertMatchSummary(jsonResult));

                    _logger.LogInformation("Completed Loading Poll Match Summary Response Json" + Environment.NewLine);
                }

                _logger.LogInformation("Poll Match Summary Request Completed" + Environment.NewLine);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public async void PollTelemetryPlayerKilled(string matchId)
        {
            try
            {
                _logger.LogInformation("Match Request Started" + Environment.NewLine);

                _pubGClientResponse = _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(), "shards/pc-tournaments/matches/" + matchId);

                if (_pubGClientResponse.Result.StatusCode == HttpStatusCode.OK && _pubGClientResponse != null)
                {
                    _logger.LogInformation("Match Player Stats  Response Json" + Environment.NewLine);

                    var jsonResult = _pubGClientResponse.Result.Content.ReadAsStringAsync().Result;

                    var _telemetryResponse = _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(GetTelemetryUrl(jsonResult)), string.Empty);

                    var telemetryJsonResult = _telemetryResponse.Result.Content.ReadAsStringAsync().Result;

                    await Task.Run(() => InsertPlayerKillTelemetry(telemetryJsonResult, matchId));

                    await Task.Run(() => _playerRepository.InsertLogPlayerPosition(telemetryJsonResult, matchId));

                    await Task.Run(() => _playerRepository.InsertVehicleLeaveTelemetry(telemetryJsonResult, matchId));

                    await Task.Run(() => _playerRepository.InsertParachuteLanding(telemetryJsonResult, matchId));

                    await Task.Run(() => _matchRepository.InsertMatchSafeZonePosition(telemetryJsonResult, matchId));

                    await Task.Run(() => _matchRepository.InsertMatchSummary(jsonResult, matchId));

                    //await Task.Run(async () => InsertMatchPlayerStats(jsonResult));

                    //await Task.Run(async () => _takeDamageRepository.InsertTakeDamageTelemetry(jsonResult));

                    _logger.LogInformation("Completed Loading Match Player Stats  Response Json" + Environment.NewLine);
                }

                _logger.LogInformation("Match Player Stats  Request Completed" + Environment.NewLine);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public async Task <JObject> GetMatchesDetailsByID(string id)
        {
            var clientResponse = _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(), "shards/pc-tournaments/matches/" + id).Result;

            var jsonResult = clientResponse.Content.ReadAsStringAsync().Result;

            var jsonResultConvertedToJObjectObject = JsonConvert.DeserializeObject <JObject>(jsonResult);

            return(await Task.FromResult(jsonResultConvertedToJObjectObject));
        }
        public async Task <Object> GetTournaments()
        {
            try
            {
                _logger.LogInformation("Tournament Open API Request Started" + Environment.NewLine);

                var tournamentsResponse = _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(), "tournaments");

                if (tournamentsResponse.Result.StatusCode == HttpStatusCode.OK && tournamentsResponse != null)
                {
                    _logger.LogInformation("Tournament Open API Response Json" + Environment.NewLine);

                    var response = tournamentsResponse.Result.Content.ReadAsStringAsync().Result;

                    var o = JObject.Parse(response);

                    var tournaments = o.SelectToken("data").Select(m =>
                                                                   new
                    {
                        Name        = (string)m.SelectToken("id"),
                        CreatedDate = (string)m.SelectToken("attributes.createdAt")
                    }
                                                                   ).ToList();

                    return(tournaments);
                }
                else
                {
                    return(tournamentsResponse.Result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public async void PollTelemetry()
        {
            var query = "2018/06/26/13/13/c845762d-7942-11e8-af88-0a5864603b03-telemetry.json";

            try
            {
                _logger.LogInformation("Telemetery Request Started" + Environment.NewLine);

                var pubGClientResponse = Task.Run(async() => await _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(), query));

                //_pubGClientResponse = _httpClientRequest.GetAsync(await _httpClientBuilder.CreateRequestHeader(), query);

                if (pubGClientResponse.Result.StatusCode == HttpStatusCode.OK && pubGClientResponse != null)
                {
                    _logger.LogInformation("Reading Telemetery Response Json" + Environment.NewLine);

                    var jsonResult = pubGClientResponse.Result.Content.ReadAsStringAsync().Result;

                    await Task.Run(async() => _playerKillRepository.InsertPlayerKillTelemetry(jsonResult, string.Empty));

                    await Task.Run(async() => _playerVehicleLeaveRepository.InsertVehicleLeaveTelemetry(jsonResult, string.Empty));

                    _logger.LogInformation("Completed Loading Telemetery Response Json" + Environment.NewLine);
                }

                _logger.LogInformation("Telemetery Request Completed" + Environment.NewLine);
            }
            catch (Exception)
            {
                throw;
            }
        }