protected bool Get(string id, out MobyGamesResult result) { string cache = CreateAndGetCacheName(id, "details"); string url = string.Format("{0}/{1}/{2}", BASE_URL, GET_PATH, id); result = _downloader.Download <MobyGamesResult>(url, cache); return(result != null); }
protected bool TryGetFromStorage(string searchTerm, string platform, out MobyGamesResult result) { List <GameMatch <string> > matches = _storage.GetMatches(); GameMatch <string> match = matches.Find(m => string.Equals(m.ItemName, searchTerm, StringComparison.OrdinalIgnoreCase) && string.Equals(m.Platform, platform, StringComparison.OrdinalIgnoreCase)); if (match != null && !string.IsNullOrEmpty(match.Id)) { return(Get(match.Id, out result)); } result = null; return(false); }
protected void UpdateGameInfo(GameInfo gameInfo, MobyGamesResult game) { gameInfo.GameName = game.Title; gameInfo.MatcherId = MatcherId; gameInfo.OnlineId = game.Id; gameInfo.Certification = game.ESRB; gameInfo.Description = game.Overview; gameInfo.Developer = game.Developer; gameInfo.Genres.AddRange(game.Genres); gameInfo.Rating = game.Rating; DateTime releaseDate; if (DateTime.TryParse(game.ReleaseDate, CultureInfo.InvariantCulture, DateTimeStyles.None, out releaseDate)) { gameInfo.ReleaseDate = releaseDate; } }