public static LiveGameData GetLiveGame(string region, string summonerId) { var liveGameUrl = RiotUrl.GetLiveGameUrl(region, summonerId); var liveGame = JsonSettings.GetStats <LiveGameData>(liveGameUrl); return(liveGame); }
public static MatchHist GetMatchHistory(string region, string accId) { var matchHistUrl = RiotUrl.GetMatchHistUrl(region, accId); var matchHist = JsonSettings.GetStats <MatchHist>(matchHistUrl); return(matchHist); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitSummonerName(object sender, EventArgs e) { string region = RegionList.SelectedValue; //get summoners name from textbox string summonerName = ValidateName(SummonerName.Text); try { //get summoner info from user input through textbox Summoner currentSummoner = Summoner.GetSummonerInfo(region, summonerName); //get 2o match history games MatchHist matchHist = MatchHist.GetMatchHistory(region, currentSummoner.AccountId.ToString()); //get specific match information (NEEDS TO BE LOOPED FOR LAST 20) List <MatchInfo.SingleMatch> allMatchDetails = new List <MatchInfo.SingleMatch>(); allMatchDetails = MatchInfo.GetMatchDetails(region, matchHist); //get total champion mastery string masteryUrl = RiotUrl.GetTotalMasteryScoreUrl(region, currentSummoner.Id.ToString()); var mastery = new WebClient().DownloadString(masteryUrl); //get individual champion mastery levels string masteryProgressUrl = RiotUrl.GetMasteryProgressUrl(region, currentSummoner.Id.ToString()); IList <ProgressionContents> champMastery = JsonSettings.GetStats <IList <ProgressionContents> >(masteryProgressUrl); LiveGame.LiveGameData inGameData = new LiveGame.LiveGameData(); try { inGameData = LiveGame.GetLiveGame(region, currentSummoner.Id.ToString()); if (inGameData == null) { UpdateLiveGame(false); } else { UpdateLiveGame(true); } } catch (NullReferenceException) { UpdateLiveGame(false); } UpdatePageData(currentSummoner); UpdateGrid(matchHist, allMatchDetails); } catch (NullReferenceException) { UpdateSummonerNotFound(); Debug.WriteLine("No Summoner Found"); } }
public static List <SingleMatch> GetMatchDetails(string region, MatchHist matchHist) { List <SingleMatch> allMatchDetails = new List <SingleMatch>(); for (int i = 0; i < 20; ++i) { string matchUrl = RiotUrl.GetMatchUrl(region, matchHist.Matches[i].GameId.ToString()); allMatchDetails.Add(JsonSettings.GetStats <SingleMatch>(matchUrl)); } return(allMatchDetails); }