public static Rom GetGameDetails(string gameId, Platform platform, out string access) { access = ""; try { var publishers = GetPublishers(); var developers = GetDevelopers(); string key = Functions.LoadAPIKEY(); string json = string.Empty; var url = Values.BaseAPIURL + "/v1/Games/ByGameID?apikey=" + key + "&id=" + gameId; using (WebClient client = new WebClient()) { client.Encoding = System.Text.Encoding.UTF8; try { json = client.DownloadString(new Uri(url)); if (string.IsNullOrEmpty(json)) { throw new Exception(); } } catch { if (platform != null) { var pjson = RomFunctions.GetPlatformJson(platform.Name); var list = GetGamesListByPlatform(platform.Id, pjson, platform.Name); return(list.FirstOrDefault(x => x.Id == gameId)); } } } if (string.IsNullOrEmpty(json)) { return(null); } var result = new Rom(); access = json.Substring(json.IndexOf("remaining_monthly_allowance") + "remaining_monthly_allowance:".Length + 1, 5).Replace(":", "").Replace(",", "").Trim(); var jobject = (JObject)JsonConvert.DeserializeObject(json); var jgame = jobject.SelectToken("data.games").First(); result.Id = gameId; result.DBName = jgame.SelectToken("game_title").ToString(); result.YearReleased = RomFunctions.GetYear(jgame.SelectToken("release_date").ToString()); //result.Description = jobject.SelectToken("data.games").First().SelectToken("description").ToString(); result.Platform = new Platform(); try { var jplatform = jgame.SelectToken("platform"); if (jplatform != null) { result.Platform.Id = jplatform.ToString(); var list = Functions.GetPlatformsXML(); result.Platform.Name = list[result.Platform.Id]; } } catch { } try { var jpublisher = jgame.SelectToken("publisher"); if (jpublisher != null) { result.Publisher = publishers[Convert.ToInt32(jpublisher.ToString())]; } } catch { } try { var jdevelopers = jgame.SelectToken("developers"); if (jdevelopers != null) { result.Developer = developers[Convert.ToInt32(jdevelopers.First().ToString())]; } } catch { } return(result); } catch (APIException ex) { throw new Exception(ex.Message); } catch (Exception ex) { return(null); } return(null); }