public Game(MatchSummary match, ChampionListStatic champions) { IIsolatedStorageManager storageService = SimpleIoc.Default.GetInstance<IIsolatedStorageManager>(); this.ID = match.MatchId; this.DatePlayed = match.MatchCreation; var participant = match.Participants.First(); var championID = participant.ChampionId; var championName = this.FindChampionName(championID, champions); var championImage = storageService.GetImageSource(IMGCHAMPIONPATH + championName + ".png"); this.Champion = new Champion(championID, championName, championImage); this.Lane = participant.Timeline.Lane; var stats = participant.Stats; this.Kda = this.CalculKda(stats.Kills, stats.Deaths, stats.Assists); this.Gold = stats.GoldEarned; this.Cs = (int)stats.MinionsKilled + (int)stats.NeutralMinionsKilled; this.CsPer10min = this.CalculCsPer10min(this.Cs, match.MatchDuration); this.Win = stats.Winner; this.Dammage = stats.TotalDamageDealtToChampions; this.Ward = stats.WardsPlaced; }
private string FindChampionName(int id, ChampionListStatic champions) { return (from c in champions.Champions where c.Value.Id == id select c).First().Value.Name; }