/// <summary> /// Gets the games. /// </summary> /// <returns>All <see cref="Game"/>s.</returns> public List <SimpleGame> GetGames() { return((from game in _achievementManager.GetGames() select new SimpleGame { Id = game.Id.ToString(), Name = game.Name }).ToList()); }
/// <summary> /// Gets the achievements from http://steamcommunity.com/id/[customurl]/stats/[game]/?xml=1. /// </summary> /// <param name="steamUserId">The steam user id.</param> /// <returns></returns> public IEnumerable <Achievement> GetAchievements(string steamUserId) { AchievementXmlParser parser = new AchievementXmlParser(); List <Achievement> achievements = new List <Achievement>(); IEnumerable <Game> games = _service.GetGames(); foreach (Game game in games) { int gameId = game.Id; string statsUrl = String.Format("http://steamcommunity.com/id/{0}/stats/{1}/?xml=1", steamUserId, game.Abbreviation); string xml; using (WebClient client = new WebClient()) { xml = client.DownloadString(statsUrl); } IEnumerable <Achievement> gameAchievements = parser.Parse(xml, gameId); achievements.AddRange(gameAchievements); } return(achievements); }
/// <summary> /// Gets the games. /// </summary> /// <returns>All <see cref="Game"/>s.</returns> public List <Game> GetGames() { return(_service.GetGames().ToList()); }