Esempio n. 1
0
        public async Task <ChampionStatic> RetrieveChampionData(CreepScore.Region region, int id, StaticDataConstants.ChampData champData, string locale = "", string version = "", bool dataById = false)
        {
            Url url = UrlConstants.StaticDataUrlBuilder(region, UrlConstants.championPart).AppendPathSegment(id.ToString());

            url.SetQueryParams(new
            {
                locale    = locale,
                version   = version,
                dataById  = dataById.ToString(),
                champData = StaticDataConstants.GetChampData(champData),
                api_key   = apiKey
            });
            Uri uri = new Uri(url.ToString());

            string responseString;

            try
            {
                responseString = await GetWebData(uri);
            }
            catch (CreepScoreException)
            {
                throw;
            }
            return(HelperMethods.LoadChampionStatic(JObject.Parse(responseString)));
        }
Esempio n. 2
0
        void LoadData(string s)
        {
            Dictionary <string, JObject> tmp = JsonConvert.DeserializeObject <Dictionary <string, JObject> >(s);

            foreach (KeyValuePair <string, JObject> t in tmp)
            {
                data.Add(t.Key, HelperMethods.LoadChampionStatic(t.Value));
            }
        }