private void buttonAddEmulator_Click(object sender, EventArgs e) { textBoxEmuName.Text = RomFunctions.FillEmuName(textBoxEmuName.Text, textBoxPath.Text, checkBoxUseRetroarch.Checked); if (textBoxEmuName.Text == "" || textBoxPath.Text == "" || textBoxCommand.Text == "") { FormCustomMessage.ShowError("Fill the name, path and command first."); return; } if (emulators.Any(x => x.Name.ToLower() == textBoxEmuName.Text.ToLower())) { FormCustomMessage.ShowError("There is an emulator using the name " + textBoxEmuName.Text); return; } emulators.Add(new Emulator() { Name = textBoxEmuName.Text, Path = textBoxPath.Text, Command = textBoxCommand.Text }); FillGridEmulators(); textBoxEmuName.Text = ""; textBoxPath.Text = ""; textBoxCommand.Text = ""; checkBoxUseRetroarch.CheckState = CheckState.Unchecked; }
private void addRomPackInDirectoryStructureToolStripMenuItem_Click(object sender, EventArgs e) { try { FolderBrowserDialog open = new FolderBrowserDialog(); open.SelectedPath = Environment.CurrentDirectory; if (open.ShowDialog() == DialogResult.Cancel) { return; } if (open.SelectedPath.Length == 0) { return; } Platform selected = null; if (FormChoose.ChoosePlatform(out selected)) { RomFunctions.AddRomPacksFromDirectory(selected, open.SelectedPath); FilterRoms(); } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void comboBoxPlatform_SelectedIndexChanged(object sender, EventArgs e) { try { if (updating) { return; } showFileExistsAuditToolStripMenuItem.Checked = false; showIncorrectPlatformAuditToolStripMenuItem.Checked = false; showMissingPicsAuditToolStripMenuItem.Checked = false; ColumnFileExists.Visible = false; ColumnIncorrectPlatform.Visible = false; ColumnMissingPics.Visible = false; FilterRoms(); buttonRescan.Enabled = comboBoxPlatform.Text != string.Empty; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonClear_Click(object sender, EventArgs e) { try { updating = true; textBoxFilter.Text = ""; comboBoxPlatform.SelectedIndex = 0; comboBoxGenre.SelectedIndex = 0; comboBoxLabels.SelectedIndex = 0; comboBoxDeveloper.SelectedIndex = 0; comboBoxPublisher.SelectedIndex = 0; comboBoxYearReleased.SelectedIndex = 0; comboBoxStatus.SelectedIndex = 0; updating = false; FilterRoms(); SelectRandomRom(); LoadPictures(); } catch (OperationCanceledException ioex) { return; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void syncRomsToolStripMenuItem_Click(object sender, EventArgs e) { try { FormSyncRomData form = new FormSyncRomData(); var currentGenre = comboBoxGenre.Text; if (form.ShowDialogUpdated()) { RomBusiness.Fill(); FillGenreFilter(); FilterRoms(); FillPlatformGrid(); FillPublisherFilter(); FillDeveloperFilter(); FillYearReleasedFilter(); comboBoxGenre.Text = currentGenre; } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { try { if (dataGridView.SelectedRows.Count == 0) { return; } Rom rom = (Rom)dataGridView.SelectedRows[0].Tag; try { ProcessStartInfo sInfo = new ProcessStartInfo(rom.Platform.DefaultRomPath + "\\" + rom.FileName); Process.Start(sInfo); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void FormMain_Resize(object sender, EventArgs e) { try { // When window state changes if (WindowState != LastWindowState) { LastWindowState = WindowState; if (WindowState == FormWindowState.Maximized) { FormMain_ResizeEnd(sender, e); } if (WindowState == FormWindowState.Normal) { FormMain_ResizeEnd(sender, e); } } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void manageRomToolStripMenuItem_Click(object sender, EventArgs e) { try { if (dataGridView.SelectedRows.Count == 0) { return; } var currentGenre = comboBoxGenre.Text; var row = dataGridView.SelectedRows[0]; Rom rom = (Rom)dataGridView.SelectedRows[0].Tag; FormManageRom form = new FormManageRom(rom); if (form.ShowDialogUpdated()) { LoadGridRow(rom, row); FillLabelCell(rom, dataGridView.SelectedRows[0]); LoadPictures(); if (rom.Genre != null && currentGenre != rom.Genre.Name) { FillGenreFilter(); comboBoxGenre.Text = currentGenre; } } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void dataGridViewPlatforms_DoubleClick(object sender, EventArgs e) { try { if (dataGridViewPlatforms.SelectedRows.Count > 1) { FormCustomMessage.ShowError("Cannot initialize multiple emulators"); return; } Platform platform = null; if (dataGridViewPlatforms.SelectedRows.Count == 0) { platform = (Platform)dataGridViewPlatforms.Rows[dataGridViewPlatforms.SelectedCells[0].RowIndex].Tag; } else { platform = (Platform)dataGridViewPlatforms.SelectedRows[0].Tag; } RunAppFunctions.RunPlatform(platform); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void dataGridView_MouseDown(object sender, MouseEventArgs e) { try { if ((dataGridView.Location.X + dataGridView.Size.Width) < e.X) { return; } if (e.Button == MouseButtons.Right) { var hti = dataGridView.HitTest(e.X, e.Y); if (hti.RowIndex == -1) { return; } dataGridView.ClearSelection(); dataGridView.Rows[hti.RowIndex].Selected = true; } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonDelete_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count < 1) { return; } Genre genre = (Genre)dataGridView.SelectedRows[0].Tag; if (MessageBox.Show(string.Format("Do you want do delete the genre {0} ?", genre.Name), "Warning", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } int romCount = RomBusiness.GetAll().Where(x => x.Genre == genre).Count(); if (romCount > 0) { FormCustomMessage.ShowError(string.Format("The genre {0} is associated with {1} roms. You cannot delete it.", genre.Name, romCount)); return; } foreach (DataGridViewRow item in dataGridView.SelectedRows) { GenreBusiness.Delete(item.Cells[0].Value.ToString()); dataGridView.Rows.Remove(item); } Updated = true; Clean(); }
private void LoadPictures() { try { pictureBoxBoxart.Image = null; pictureBoxTitle.Image = null; pictureBoxGameplay.Image = null; if (!string.IsNullOrEmpty(RomFunctions.GetRomPicture(SelectedRom, Values.BoxartFolder))) { pictureBoxBoxart.Image = Functions.CreateBitmap(RomFunctions.GetRomPicture(SelectedRom, Values.BoxartFolder)); } if (!string.IsNullOrEmpty(RomFunctions.GetRomPicture(SelectedRom, Values.TitleFolder))) { pictureBoxTitle.Image = Functions.CreateBitmap(RomFunctions.GetRomPicture(SelectedRom, Values.TitleFolder)); } if (!string.IsNullOrEmpty(RomFunctions.GetRomPicture(SelectedRom, Values.GameplayFolder))) { pictureBoxGameplay.Image = Functions.CreateBitmap(RomFunctions.GetRomPicture(SelectedRom, Values.GameplayFolder)); } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void removeRomEntryToolStripMenuItem_Click(object sender, EventArgs e) { try { if (dataGridView.SelectedRows.Count == 0) { return; } List <Rom> roms = new List <Rom>(); foreach (DataGridViewRow row in dataGridView.SelectedRows) { if (!row.Visible) { continue; } roms.Add((Rom)row.Tag); } var message = string.Empty; if (roms.Count == 1) { message = string.Format("Do you want to remove \"{0}\" ? (Keep the rom file)", roms[0].Name); } else { message = string.Format("Do you want to remove {0} roms ? (Keep the rom files)", roms.Count); } var result = MessageBox.Show(message, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.ToString() == "No") { return; } foreach (var rom in roms) { RomFunctions.RemoveRomPics(rom); FilteredRoms.Remove(rom); } RomBusiness.DeleteRom(roms); foreach (DataGridViewRow row in dataGridView.SelectedRows) { dataGridView.Rows.Remove(row); } labelTotalRomsCount.Text = FilteredRoms.Count.ToString(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonPurge_Click(object sender, EventArgs e) { try { foreach (var item in Roms) { if (checkBoxId.Checked) { item.Id = string.Empty; } if (checkBoxPublisher.Checked) { item.Publisher = string.Empty; } if (checkBoxDeveloper.Checked) { item.Developer = string.Empty; } if (checkBoxDescription.Checked) { item.Description = string.Empty; } if (checkBoxDBName.Checked) { item.DBName = string.Empty; } if (checkBoxYearReleased.Checked) { item.YearReleased = string.Empty; } if (checkBoxGenre.Checked) { item.Genre = null; } if (checkBoxRating.Checked) { item.Rating = 0; } } RomBusiness.SetRom(Roms); FormCustomMessage.ShowSuccess("Data purged successfully!"); comboBoxPlatform_SelectedIndexChanged(sender, e); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } Updated = true; }
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, Keys keyData) { if (keyData == (Keys.Control | Keys.F)) { FormCustomMessage.ShowError("What the Ctrl+F?"); return(true); } return(base.ProcessCmdKey(ref msg, keyData)); }
private void changeSeriesToolStripMenuItem_Click(object sender, EventArgs e) { try { string selected = ""; List <Rom> romList = new List <Rom>(); foreach (DataGridViewRow row in dataGridView.SelectedRows) { romList.Add((Rom)row.Tag); } if (romList.Count == 1) { selected = romList[0].Series; } else if (romList.Count > 1) { selected = romList[0].Series; foreach (var rom in romList) { if (rom.Series != selected) { selected = ""; break; } } } if (!FormSeries.ChooseSeries(selected, out selected)) { return; } foreach (var rom in romList) { rom.Series = selected; } RomBusiness.SetRom(romList); foreach (DataGridViewRow row in dataGridView.SelectedRows) { Rom rom = (Rom)row.Tag; row.Cells[columnSeries.Index].Value = rom.Series; } dataGridView.Refresh(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void dataGridView_Click(object sender, EventArgs e) { try { EnableDisableButtonsBySelection(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void dataGridView_Enter(object sender, EventArgs e) { try { selectedRomsOptionsToolStripMenuItem.Enabled = false; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void batchAddPicturesToolStripMenuItem_Click(object sender, EventArgs e) { try { FormBatchAddPictures form = new FormBatchAddPictures(); form.ShowDialog(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void changeStatusToolStripMenuItem_Click(object sender, EventArgs e) { try { if (dataGridView.SelectedRows.Count == 0) { return; } RomStatus status = ((Rom)dataGridView.SelectedRows[0].Tag).Status; var statusvalue = status == null ? "" : status.Status; string newstatus = ""; if (!FormChoose.ChooseStatus(statusvalue, out newstatus)) { return; } List <Rom> romList = new List <Rom>(); foreach (DataGridViewRow row in dataGridView.SelectedRows) { var rom = (Rom)row.Tag; romList.Add(rom); } RomStatusBusiness.SetRomStatus(romList, newstatus); foreach (DataGridViewRow row in dataGridView.SelectedRows) { Rom rom = (Rom)row.Tag; if (rom.Status != null && !string.IsNullOrEmpty(rom.Status.Status)) { row.Cells[columnStatus.Index].Value = rom.Status.Status; row.Cells[columnStatus.Index].Style.BackColor = Color.Navy; row.Cells[columnStatus.Index].Style.ForeColor = Color.White; } else { row.Cells[columnStatus.Index].Value = ""; row.Cells[columnStatus.Index].Style.ForeColor = dataGridView.RowTemplate.DefaultCellStyle.ForeColor; row.Cells[columnStatus.Index].Style.BackColor = dataGridView.RowTemplate.DefaultCellStyle.BackColor; } } dataGridView.Refresh(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonSave_Click(object sender, EventArgs e) { try { List <RomLabel> labels = new List <RomLabel>(); foreach (DataGridViewRow row in dataGridView.Rows) { if (((CheckState)row.Cells[columnCheck.Index].Value) == CheckState.Checked) { RomLabel label = (RomLabel)row.Tag; labels.Add(label); } } var emulator = comboBoxChooseEmulator.Text; if (comboBoxChooseEmulator.SelectedIndex == 0) { emulator = ""; } SelectedRom = RomBusiness.SetRom(SelectedRom, textBoxId.Text, textBoxFileName.Text, textBoxRomName.Text, textBoxSeries.Text, comboBoxGenre.Text, comboBoxChooseStatus.Text, labels, textBoxPublisher.Text, textBoxDeveloper.Text, textBoxDescription.Text, textBoxYearReleased.Text, textBoxDBName.Text, textBoxRating.Text, checkBoxIdLocked.Checked, checkBoxChangeZippedName.Checked, textBoxBoxartPicture.Text, textBoxTitlePicture.Text, textBoxGameplayPicture.Text, checkBoxSaveAsJpg.Checked, emulator); Updated = true; Close(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonColor_Click(object sender, EventArgs e) { try { if (colorDialog1.ShowDialog() == DialogResult.OK) { buttonColor.BackColor = colorDialog1.Color; } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void textBoxFilter_KeyPress(object sender, KeyPressEventArgs e) { try { if (e.KeyChar == '\r') { FilterRoms(); } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonOpenDB_Click(object sender, EventArgs e) { if (textBoxId.Text == string.Empty) { FormCustomMessage.ShowError("TheGameDB Id is empty."); return; } var access = ""; var game = APIFunctions.GetGameDetails(textBoxId.Text, SelectedRom.Platform, out access); game.Id = textBoxId.Text; StringBuilder text = new StringBuilder(""); text.Append("ID" + Environment.NewLine); text.Append(game.Id + Environment.NewLine + Environment.NewLine); text.Append("NAME" + Environment.NewLine); text.Append(game.DBName + Environment.NewLine + Environment.NewLine); text.Append("PLATFORM" + Environment.NewLine); text.Append(game.Platform.Id + " - " + game.Platform.Name + Environment.NewLine + Environment.NewLine); text.Append("PUBLISHER" + Environment.NewLine); text.Append(game.Publisher + Environment.NewLine + Environment.NewLine); text.Append("DEVELOPER" + Environment.NewLine); text.Append(game.Developer + Environment.NewLine + Environment.NewLine); text.Append("DESCRIPTION" + Environment.NewLine); text.Append(game.Description + Environment.NewLine + Environment.NewLine); text.Append("YEAR RELEASED" + Environment.NewLine); text.Append(game.YearReleased + Environment.NewLine + Environment.NewLine); text.Append("GENRE" + Environment.NewLine); text.Append(game.Genre != null ? game.Genre.Name + Environment.NewLine + Environment.NewLine : "" + Environment.NewLine + Environment.NewLine); text.Append("RATING" + Environment.NewLine); text.Append(game.Rating != 0 ? game.Rating.ToString("#.#") : "" + Environment.NewLine + Environment.NewLine); text.Append("remaining access to api" + Environment.NewLine); text.Append(access); FormInfo info = new FormInfo(text.ToString()); info.Show(); }
private void LoadPictures() { try { pictureBoxBoxart.Image = null; pictureBoxTitle.Image = null; pictureBoxGameplay.Image = null; if (dataGridView.SelectedRows.Count == 0) { return; } Rom rom = (Rom)dataGridView.SelectedRows[0].Tag; if (rom == null) { return; } if (rom.Platform == null) { return; } var box = RomFunctions.GetRomPicture(rom, Values.BoxartFolder); var title = RomFunctions.GetRomPicture(rom, Values.TitleFolder); var gameplay = RomFunctions.GetRomPicture(rom, Values.GameplayFolder); if (!string.IsNullOrEmpty(box)) { pictureBoxBoxart.Image = Functions.CreateBitmap(box); } if (!string.IsNullOrEmpty(title)) { pictureBoxTitle.Image = Functions.CreateBitmap(title); } if (!string.IsNullOrEmpty(gameplay)) { pictureBoxGameplay.Image = Functions.CreateBitmap(gameplay); } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void comboBoxGenre_SelectedIndexChanged(object sender, EventArgs e) { try { if (updating) { return; } FilterRoms(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void checkBoxFavorite_CheckedChanged(object sender, EventArgs e) { try { if (updating) { return; } FilterRoms(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void openAppFolderToolStripMenuItem_Click(object sender, EventArgs e) { try { Process.Start("explorer.exe", Environment.CurrentDirectory); } catch (OperationCanceledException ioex) { return; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void buttonCleanIncorrectRomPlatform_Click(object sender, EventArgs e) { if (comboBoxPlatform.Text == "" || comboBoxPlatform.Text == "none") { FormCustomMessage.ShowError("Select a platform"); } var json = RomFunctions.GetPlatformJson(comboBoxPlatform.Text); if (json == "") { return; } var roms = RomBusiness.GetAll(PlatformBusiness.Get(comboBoxPlatform.Text)); int count = 0; List <Rom> romsUpdate = new List <Rom>(); foreach (var rom in roms) { if (string.IsNullOrEmpty(rom.Id)) { continue; } if (!json.Contains("\"id\": " + rom.Id + ",")) { rom.Id = ""; rom.Name = rom.FileNameNoExt; rom.DBName = ""; rom.Description = ""; rom.IdLocked = false; rom.Publisher = ""; rom.YearReleased = ""; rom.Developer = ""; rom.Rating = 0; romsUpdate.Add(rom); count++; Updated = true; } } RomBusiness.SetRom(romsUpdate); FormCustomMessage.ShowSuccess("Roms updated successfully! " + count.ToString() + " roms cleaned"); }
private void checkBoxCD_CheckedChanged(object sender, EventArgs e) { try { if (updating) { return; } timerFilter.Start(); FillPlatformFilter(); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }