示例#1
0
        public Dictionary <int, ChampionMatchDTO> GetUniqueChampionsPlayedById(MatchlistDTO matchlist, string accountId)
        {
            Dictionary <int, ChampionMatchDTO> uniqueChampionDictionary = new Dictionary <int, ChampionMatchDTO>();

            foreach (MatchReferenceDTO match in matchlist.matches)
            {
                if (uniqueChampionDictionary.ContainsKey(match.champion))
                {
                    uniqueChampionDictionary[match.champion].matchIds.Add(match.gameId);
                }
                else
                {
                    string championName = GetChampionNameById(match.champion);

                    uniqueChampionDictionary.Add(match.champion, new ChampionMatchDTO()
                    {
                        championId   = match.champion,
                        championName = championName,
                        matchIds     = new List <long>()
                        {
                            match.gameId
                        },
                    });
                }
            }

            return(GetWinRateByChampionAndReturn(LimitToTop5PlayedChamps(uniqueChampionDictionary), accountId));
        }
示例#2
0
        public async Task <MatchlistDTO> GetMatchHistory(string path)
        {
            using (HttpResponseMessage response = await client.GetAsync(path).ConfigureAwait(false))
            {
                if (response.IsSuccessStatusCode)
                {
                    string jsonResponse = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                    MatchlistDTO matchlist = JsonConvert.DeserializeObject <MatchlistDTO>(jsonResponse);

                    return(matchlist);
                }
            }

            return(null);
        }