Example #1
0
        private static List <Spell> GetChampionAbilities(string championId)
        {
            var pathBuilder = new UrlPathBuilder();
            var spells      = new List <Spell>();

            using (var client = new WebClient())
            {
                try
                {
                    var championJson = client.DownloadString(pathBuilder.GetSpecificChampionUrl(championId));
                    var jsonObject   = JObject.Parse(championJson);
                    var champSpells  = jsonObject["data"][championId]["spells"];
                    spells = champSpells.ToObject <List <Spell> >();
                    foreach (var spell in spells)
                    {
                        spell.IconFullUrl = pathBuilder.GetSpellIcon(spell.Id);
                    }

                    return(spells);
                }
                catch (Exception) { return(null); }
            }
        }