public static string GetGamesListJSONByPlatform(string platformId, string platformName) { try { string games = string.Empty; string key = Functions.LoadAPIKEY(); string json = string.Empty; var url = Values.BaseAPIURL + "/v1/Games/ByPlatformID?apikey=" + key + "&id=" + platformId; while (true) { using (WebClient client = new WebClient()) { client.Encoding = System.Text.Encoding.UTF8; json = client.DownloadString(new Uri(url)); } if (string.IsNullOrEmpty(json)) { return(null); } var jobject = (JObject)JsonConvert.DeserializeObject(json); games += jobject.SelectToken("data.games").ToString(); var next = jobject.SelectToken("pages.next").ToString(); if (string.IsNullOrEmpty(next)) { break; } url = next; } games = games.Replace("][", ","); var platform = PlatformBusiness.GetAll().FirstOrDefault(x => x.Name == platformName); if (platform != null) { if (!Directory.Exists(Values.JsonFolder)) { Directory.CreateDirectory(Values.JsonFolder); } File.WriteAllText(Values.JsonFolder + "\\" + platform.Name + ".json", games); } return(games); } catch (APIException ex) { throw new Exception(ex.Message); } catch (Exception ex) { return(null); } }
private void FormEmulator_Load(object sender, EventArgs e) { buttonAdd.Click += buttonAdd_Click; buttonDelete.Click += buttonDelete_Click; buttonCancel.Click += buttonCancel_Click; updating = true; dataGridView.ClearSelection(); dataGridView.Rows.Clear(); List <Platform> emus = PlatformBusiness.GetAll(); foreach (Platform emu in emus) { AddToGrid(emu, -1); } comboBoxPlatformsDB.ValueMember = "Key"; comboBoxPlatformsDB.DisplayMember = "Value"; var list = Functions.GetPlatformsXML(); var keyvalue = new List <KeyValuePair <string, string> >(); foreach (var item in list) { keyvalue.Add(new KeyValuePair <string, string>(item.Key, item.Value)); } comboBoxPlatformsDB.DataSource = keyvalue; updating = false; Clean(); }
private void FormBase_Load(object sender, EventArgs e) { List <Platform> emus = PlatformBusiness.GetAll(); comboBoxChoosePlatform.DataSource = emus; comboBoxChoosePlatform.DisplayMember = "Name"; comboBoxChoosePlatform.ValueMember = "Name"; comboBoxChoosePlatform.SelectedIndex = 0; }
private void FormSyncRomData_Load(object sender, EventArgs e) { Updated = false; var platforms = PlatformBusiness.GetAll(); comboBoxPlatform.DisplayMember = "Name"; comboBoxPlatform.ValueMember = "Id"; comboBoxPlatform.DataSource = platforms; }
public FormAudit() { InitializeComponent(); List <Platform> platforms = PlatformBusiness.GetAll(); platforms.Insert(0, new Platform()); comboBoxPlatform.DataSource = platforms; comboBoxPlatform.DisplayMember = "Name"; comboBoxPlatform.ValueMember = "Name"; }
private void FormSyncRomData_Load(object sender, EventArgs e) { Updated = false; var platforms = PlatformBusiness.GetAll(); comboBoxPlatform.DisplayMember = "Name"; comboBoxPlatform.ValueMember = "Id"; comboBoxPlatform.DataSource = platforms; threadSetIdAndYear = new Thread(SetIdAndYear); threadSetOtherProperties = new Thread(SetOtherProperties); checkBoxBasicSync_CheckedChanged(sender, e); }
private void buttonSearchInDB_Click(object sender, EventArgs e) { string url = "https://thegamesdb.net/search.php?name={0}&platform_id%5B%5D={1}"; string name = textBoxRomName.Text.Replace("[!]", string.Empty).Replace("!", string.Empty).Replace("&", " ").Replace(" ", "+"); name = Functions.RemoveSubstring(name, '[', ']'); name = Functions.RemoveSubstring(name, '(', ')'); var platform = PlatformBusiness.GetAll().Where(x => x.Name == labelPlatform.Text).FirstOrDefault(); if (platform != null) { url = string.Format(url, name, platform.Id); } else { url = string.Format(url, name, labelPlatform.Text); } ProcessStartInfo sInfo = new ProcessStartInfo(url); Process.Start(sInfo); }
private void FillPlatformGrid() { var emus = PlatformBusiness.GetAll().Where(x => x.ShowInList).ToList(); dataGridViewPlatforms.Rows.Clear(); foreach (var platform in emus) { int rowId = dataGridViewPlatforms.Rows.Add(); DataGridViewRow row = dataGridViewPlatforms.Rows[rowId]; if (platform.Icon != null) { row.Cells[ColumnIcon.Index].Value = platform.Icon; } row.Cells[columnPlatforms.Index].Value = platform.Name; row.Cells[columnPlatforms.Index].Style.BackColor = platform.Color; row.Cells[columnPlatforms.Index].Style.ForeColor = Functions.SetFontContrast(platform.Color); row.Tag = platform; } }