Пример #1
0
        public async Task <RuneStatic> RetrieveRuneData(CreepScore.Region region, int id, StaticDataConstants.RuneListData runeListData, string locale = "", string version = "")
        {
            Url url = UrlConstants.StaticDataUrlBuilder(region, UrlConstants.runePart).AppendPathSegment(id.ToString());

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

            string responseString;

            try
            {
                responseString = await GetWebData(uri);
            }
            catch (CreepScoreException)
            {
                throw;
            }
            return(HelperMethods.LoadRuneStatic(JObject.Parse(responseString)));
        }
Пример #2
0
        Dictionary <string, RuneStatic> LoadData(string s)
        {
            Dictionary <string, JObject>    values = JsonConvert.DeserializeObject <Dictionary <string, JObject> >(s);
            Dictionary <string, RuneStatic> tmp    = new Dictionary <string, RuneStatic>();

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

            return(tmp);
        }