Ejemplo n.º 1
0
        public async Task <SummonerSpellStatic> RetrieveSummonerSpellData(CreepScore.Region region, int id, StaticDataConstants.SpellData spellData, string locale = "", string version = "")
        {
            Url url = UrlConstants.StaticDataUrlBuilder(region, UrlConstants.summonerSpellPart).AppendPathSegment(id.ToString());

            url.SetQueryParams(new
            {
                locale    = locale,
                version   = version,
                spellData = StaticDataConstants.GetSpellData(spellData),
                api_key   = apiKey
            });
            Uri uri = new Uri(url.ToString());

            string responseString;

            try
            {
                responseString = await GetWebData(uri);
            }
            catch (CreepScoreException)
            {
                throw;
            }
            return(HelperMethods.LoadSummonerSpellStatic(JObject.Parse(responseString)));
        }
Ejemplo n.º 2
0
        Dictionary <string, SummonerSpellStatic> LoadData(string s)
        {
            Dictionary <string, JObject>             values = JsonConvert.DeserializeObject <Dictionary <string, JObject> >(s);
            Dictionary <string, SummonerSpellStatic> tmp    = new Dictionary <string, SummonerSpellStatic>();

            foreach (KeyValuePair <string, JObject> pair in values)
            {
                tmp.Add(pair.Key, HelperMethods.LoadSummonerSpellStatic(pair.Value));
            }

            return(tmp);
        }