/// <summary> /// Gets the achievements from http://steamcommunity.com/id/[customurl]/stats/[game]/?xml=1. /// </summary> /// <param name="steamUserId">The steam user id.</param> /// <param name="games">The games.</param> /// <returns></returns> public IEnumerable <Achievement> GetAchievements(string steamUserId, IEnumerable <Game> games) { if (steamUserId == null) { throw new ArgumentNullException("steamUserId"); } if (games == null) { throw new ArgumentNullException("games"); } AchievementXmlParser parser = new AchievementXmlParser(); List <Achievement> achievements = new List <Achievement>(); 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); }