private void ParseUserPage() { GetUserRanks(); ProfilePortraitURL = userPage.QuerySelector(".player-portrait").GetAttribute("src"); CasualStats = new OverwatchStats(); CompetitiveStats = new OverwatchStats(); Achievements = new OverwatchAchievements(); Achievements.UpdateAchievementsFromPage(userPage); CasualStats.UpdateStatsFromPage(userPage, Mode.Casual); CompetitiveStats.UpdateStatsFromPage(userPage, Mode.Competitive); if (CompetitiveStats.Count == 0) { CompetitiveStats = null; } ProfileLastDownloaded = DateTime.UtcNow; }
/// <summary> /// Downloads and parses the players profile /// </summary> /// <returns></returns> public async Task UpdateStats() { if (Region == Region.none && Platform == Platform.pc) { throw new UserRegionNotDefinedException(); } if (Platform == Platform.none) { throw new UserPlatformNotDefinedException(); } var userpage = await DownloadUserPage(); GetUserRanks(userpage); GetProfilePortrait(userpage); CasualStats = new OverwatchStats(); CompetitiveStats = new OverwatchStats(); Achievements = new OverwatchAchievements(); Achievements.UpdateAchievementsFromPage(userpage); CasualStats.UpdateStatsFromPage(userpage, Mode.Casual); CompetitiveStats.UpdateStatsFromPage(userpage, Mode.Competitive); ProfileLastDownloaded = DateTime.UtcNow; }