コード例 #1
0
ファイル: StaticRiotApi.cs プロジェクト: Karunp/RiotSharp
        /// <summary>
        /// Get a list of all champions synchronously.
        /// </summary>
        /// <param name="region">Region from which to retrieve the data.</param>
        /// <param name="championData">Data to retrieve.</param>
        /// <param name="language">Language of the data to be retrieved.</param>
        /// <returns>A ChampionListStatic object containing all champions.</returns>
        public ChampionListStatic GetChampions(Region region, ChampionData championData = ChampionData.none
                                               , Language language = Language.en_US)
        {
            var wrapper = Cache.Get <ChampionListStaticWrapper>(ChampionsCacheKey);

            if (wrapper == null || language != wrapper.Language || championData != wrapper.ChampionData)
            {
                var json = requester.CreateRequest(string.Format(ChampionRootUrl, region.ToString())
                                                   , new List <string>()
                {
                    string.Format("locale={0}", language.ToString())
                    , championData == ChampionData.none ? string.Empty
                            : string.Format("champData={0}", championData.ToString())
                });
                var champs = JsonConvert.DeserializeObject <ChampionListStatic>(json);
                wrapper = new ChampionListStaticWrapper(champs, language, championData);
                Cache.Add <ChampionListStaticWrapper>(ChampionsCacheKey, wrapper);
            }
            return(wrapper.ChampionListStatic);
        }
コード例 #2
0
        /// <summary>
        /// Get the list of shards synchronously.
        /// </summary>
        /// <returns>A list of shards.</returns>
        public List <Shard> GetShards()
        {
            var json = requester.CreateRequest(StatusRootUrl, RootDomain, null, false);

            return(JsonConvert.DeserializeObject <List <Shard> >(json));
        }
コード例 #3
0
        public Tourneys GetTourneys()
        {
            var json = requester.CreateRequest("/api/tournament.json?published=1", RootDomain);

            return(JsonConvert.DeserializeObject <Tourneys>(json, new TourneyConverter()));
        }