private void toolStripButton_SaveChanges_Click(object sender, EventArgs e) { if (currentID == "") { return; } if (fileIndex >= 0 && fileIndex < detects.Length) { try { string filePath = detects[fileIndex].Path; switch (Path.GetExtension(filePath).ToLower()) { case ".rtf": case ".doc": richTextBox1.SaveFile(filePath); break; default: File.WriteAllLines(filePath, richTextBox1.Lines, Encoding.UTF8); break; } } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(ex.Message); } } }
private void toolStripButton_delete_Click(object sender, EventArgs e) { if (detects == null) { return; } if (fileIndex >= 0 && fileIndex < detects.Length) { ManagedMessageBoxResult res = ManagedMessageBox.ShowQuestionMessage( Program.ResourceManager.GetString("Message_AreYouSuretoRemoveManual"), Program.ResourceManager.GetString("MessageCaption_RemoveManual"), true, false, Program.ResourceManager.GetString("MessageCheckBox_RemoveFileFromDiskToo")); if (res.ClickedButtonIndex == 0)// Yes ! { if (res.Checked) { try { File.Delete(detects[fileIndex].Path); } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Text_UnableToRemoveFile") + ": " + detects[fileIndex].Path + "; ERROR: " + ex.Message); } } // Remove from database. MyNesDB.DeleteDetect("MANUALS", currentID, detects[fileIndex].Path); RefreshForEntry(currentID); } } }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { OpenFileDialog op = new OpenFileDialog(); op.Filter = Program.ResourceManager.GetString("Filter_PaletteFile"); if (op.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { try { if (!File.Exists(Application.StartupPath + "\\Palettes\\" + Path.GetFileName(op.FileName))) { ManagedMessageBoxResult res = ManagedMessageBox.ShowQuestionMessage(Program.ResourceManager.GetString("Message_ReplacePaletteFile")); if (res.ClickedButtonIndex == 0) { File.Delete(Application.StartupPath + "\\Palettes\\" + Path.GetFileName(op.FileName)); } else { return; } } // Copy the file into the palettes file File.Copy(op.FileName, Application.StartupPath + "\\Palettes\\" + Path.GetFileName(op.FileName)); // Refresh the combo box RefreshPaletteFilesList(); // Select this file comboBox1.SelectedItem = Application.StartupPath + "\\Palettes\\" + Path.GetFileName(op.FileName); } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(ex.Message); } } }
// Start private void button3_Click(object sender, EventArgs e) { // Make a check if (listView1.Items.Count == 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_NoFolderToSearch"), Program.ResourceManager.GetString("MessageCaption_Detect")); return; } if (textBox_extensions.Text.Length == 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_NoExtensionAddedYet"), Program.ResourceManager.GetString("MessageCaption_Detect")); return; } // Get options foldersToSearch = new List <string>(); foreach (ListViewItem item in listView1.Items) { if (Directory.Exists(item.Text)) { foldersToSearch.Add(item.Text); } } extensions = new List <string>(textBox_extensions.Text.ToLower().Split(new char[] { ';' })); includeSubFolders = checkBox_includeSubFolders.Checked; clearOldRomDetectedFiles = checkBox_deleteOldDetected.Checked; matchCase = checkBox_matchCase.Checked; matchWord = checkBox_matchWord.Checked; dontAllowSameFileDetectedByMoreThanOneRom = checkBox_dontAllowMoreThanOneFile.Checked; oneFilePerRom = checkBox_oneFilePerRom.Checked; useRomNameInsteadRomFileName = checkBox_useRomNameInstead.Checked; searchmode_FileInRom = radioButton_searchmode_fileinrom.Checked; searchmode_RomInFile = radioButton_searchmode_rominfile.Checked; searchmode_Both = radioButton_searchmode_both.Checked; startWith = radioButton_startWith.Checked; contains = radioButton_contains.Checked; endWith = radioButton_endwith.Checked; useNameWhenPathNotValid = checkBox_useNameWhenPathNotValid.Checked; finished = false; // Disable things listView1.Enabled = button1.Enabled = button2.Enabled = textBox_extensions.Enabled = checkBox_deleteOldDetected.Enabled = checkBox_includeSubFolders.Enabled = checkBox_matchCase.Enabled = checkBox_matchWord.Enabled = button3.Enabled = checkBox_oneFilePerRom.Enabled = checkBox_dontAllowMoreThanOneFile.Enabled = checkBox_useRomNameInstead.Enabled = button5.Enabled = radioButton_searchmode_both.Enabled = radioButton_searchmode_fileinrom.Enabled = radioButton_searchmode_rominfile.Enabled = radioButton_contains.Enabled = radioButton_endwith.Enabled = radioButton_startWith.Enabled = checkBox_useNameWhenPathNotValid.Enabled = false; progressBar1.Visible = label_status.Visible = groupBox1.Enabled = groupBox2.Enabled = true; timer1.Start(); button4.Text = Program.ResourceManager.GetString("Button_Stop"); // Start the thread ! mainThread = new Thread(new ThreadStart(SEARCH)); mainThread.CurrentUICulture = Program.CultureInfo; mainThread.Start(); }
private void button2_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 1) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectOneResultFirst")); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
// Set private void button2_Click(object sender, EventArgs e) { if (comboBox_device.SelectedIndex < 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectTheInputDeviceFirst")); return; } if (listView1.SelectedItems.Count != 1) { return; } SetPlayer(); }
private void button3_Click(object sender, EventArgs e) { if (listBox1.Items.Count == 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_YouMustSekectOneFolderToSearch")); return; } Program.Settings.Database_FoldersScanned = new System.Collections.Specialized.StringCollection(); foreach (string item in listBox1.Items) { Program.Settings.Database_FoldersScanned.Add(item); } this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { if (listView1.SelectedItems.Count != 1) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectOneResultFirst")); return; } Game game = GamesDB.GetGame((int)listView1.SelectedItems[0].Tag); listView2.Items.Clear(); listView2.Items.Add("Title"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Title); listView2.Items.Add("Platform"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Platform); listView2.Items.Add("ReleaseDate"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.ReleaseDate); listView2.Items.Add("Overview"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Overview); listView2.Items.Add("ESRB"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.ESRB); listView2.Items.Add("Players"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Players); listView2.Items.Add("Publisher"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Publisher); listView2.Items.Add("Developer"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Developer); listView2.Items.Add("Rating"); listView2.Items[listView2.Items.Count - 1].SubItems.Add(game.Rating); listView2.Items.Add("AlternateTitles"); string titles = ""; foreach (string t in game.AlternateTitles) { titles += t + ", "; } listView2.Items[listView2.Items.Count - 1].SubItems.Add(titles); listView2.Items.Add("Genres"); string genres = ""; foreach (string t in game.Genres) { genres += t + ", "; } listView2.Items[listView2.Items.Count - 1].SubItems.Add(genres); }
//ok private void button1_Click(object sender, EventArgs e) { if (radioButton_usaPaletteFile.Checked) { if (comboBox1.SelectedIndex <= 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PaletteFileNotExistOrSelected")); return; } if (!File.Exists(Application.StartupPath + "\\Palettes\\" + comboBox1.SelectedItem.ToString())) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PaletteFileNotExistOrSelected")); return; } } SaveSettings(); this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
private void CloseAfterFinish1() { finished = true; ManagedMessageBoxResult res = ManagedMessageBox.ShowMessage( Program.ResourceManager.GetString("Message_Done") + ", " + Program.ResourceManager.GetString("Message_LogFileSavedTo") + " '" + logPath + "'", Program.ResourceManager.GetString("MessageCaption_DetectAndDownloadFromTheGamesDB"), new string[] { Program.ResourceManager.GetString("Button_Ok"), Program.ResourceManager.GetString("Button_OpenLog") }, 0, null, ManagedMessageBoxIcon.Info); if (res.ClickedButtonIndex == 1) { try { Process.Start(HelperTools.GetFullPath(logPath)); } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(ex.Message); } } this.Close(); }
private void button1_Click(object sender, EventArgs e) { if (textBox_gameTitle.Text.Length == 0) { ManagedMessageBox.ShowErrorMessage("Please enter the game title first."); return; } ICollection <GameSearchResult> results = GamesDB.GetGames(textBox_gameTitle.Text, textBox_platform.Text, textBox_genre.Text); listView1.Items.Clear(); foreach (GameSearchResult result in results) { ListViewItem item = new ListViewItem(); item.Text = result.ID.ToString(); item.SubItems.Add(result.Title); item.SubItems.Add(result.ReleaseDate); item.SubItems.Add(result.Platform); item.Tag = result.ID; listView1.Items.Add(item); } }
private void UpdatePreview() { if (isLoadingSettings) { return; } if (tabControl1.SelectedIndex == 0) { // Settings tab if (radioButton_useGenerators.Checked) { if (radioButton_gen_auto.Checked || radioButton_gen_ntsc.Checked) { currentPalette = NTSCPaletteGenerator.GeneratePalette(); panel1.Invalidate(); } else { currentPalette = PALBPaletteGenerator.GeneratePalette(); panel1.Invalidate(); } } else { if (comboBox1 == null) { return; } if (comboBox1.SelectedIndex < 0) { currentPalette = new int[512]; } try { if (PaletteFileWrapper.LoadFile(Application.StartupPath + "\\Palettes\\" + comboBox1.SelectedItem.ToString(), out currentPalette)) { panel1.Invalidate(); } else { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_UnableToLoadPaletteFile")); currentPalette = new int[512]; panel1.Invalidate(); } } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(ex.Message); ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_UnableToLoadPaletteFile")); currentPalette = new int[512]; panel1.Invalidate(); } } } else { if (radioButton_ntsc.Checked) { currentPalette = NTSCPaletteGenerator.GeneratePalette(); panel1.Invalidate(); } else { currentPalette = PALBPaletteGenerator.GeneratePalette(); panel1.Invalidate(); } } }
// Find private void button1_Click(object sender, EventArgs e) { if (textBox_findWhat.Text.Length == 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseEnterTheSearchWordFirst"), Program.ResourceManager.GetString("MessageCaption_FindGames")); return; } if (comboBox_searchBy.SelectedIndex < 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectTheSearchByColumnFirst"), Program.ResourceManager.GetString("MessageCaption_FindGames")); return; } TextSearchCondition textCondition = TextSearchCondition.None; NumberSearchCondition numberCondition = NumberSearchCondition.None; bool isNumber = false; switch (comboBox_searchBy.SelectedItem.ToString()) { case "Size": case "Played": case "Play Time": case "Board Mapper": case "Rating": isNumber = true; break; } if (!isNumber) { switch (comboBox_condition.SelectedIndex) { case 0: textCondition = TextSearchCondition.Contains; break; case 1: textCondition = TextSearchCondition.DoesNotContain; break; case 2: textCondition = TextSearchCondition.Is; break; case 3: textCondition = TextSearchCondition.IsNot; break; case 4: textCondition = TextSearchCondition.StartWith; break; case 5: textCondition = TextSearchCondition.DoesNotStartWith; break; case 6: textCondition = TextSearchCondition.EndWith; break; case 7: textCondition = TextSearchCondition.DoesNotEndWith; break; } } else { switch (comboBox_condition.SelectedIndex) { case 0: numberCondition = NumberSearchCondition.Equal; break; case 1: numberCondition = NumberSearchCondition.DoesNotEqual; break; case 2: numberCondition = NumberSearchCondition.Larger; break; case 3: numberCondition = NumberSearchCondition.EuqalLarger; break; case 4: numberCondition = NumberSearchCondition.Smaller; break; case 5: numberCondition = NumberSearchCondition.EqualSmaller; break; } } // Raise the event ! if (SearchRequest != null) { SearchRequest(this, new SearchRequestArgs(textBox_findWhat.Text, comboBox_searchBy.SelectedItem.ToString(), isNumber, textCondition, numberCondition, checkBox_caseSensitive.Checked)); } }
private void button5_Click(object sender, EventArgs e) { if (!Directory.Exists(textBox_Sram.Text)) { ManagedMessageBoxResult res = ManagedMessageBox.ShowQuestionMessage( Program.ResourceManager.GetString("Message_TheSRAMFolderIsntExistAt") + " " + textBox_Sram.Text + ".\n" + Program.ResourceManager.GetString("Message_DoYouWantToCreateThisFolder")); if (res.ClickedButtonIndex == 1) { return; } else { try { Directory.CreateDirectory(textBox_Sram.Text); } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_UnableToCreateTheFolder") + ": " + ex.Message); } } } if (!Directory.Exists(textBox_state.Text)) { ManagedMessageBoxResult res = ManagedMessageBox.ShowQuestionMessage( Program.ResourceManager.GetString("Message_TheSTATEFolderIsntExistAt") + " " + textBox_state.Text + ".\n" + Program.ResourceManager.GetString("Message_DoYouWantToCreateThisFolder")); if (res.ClickedButtonIndex == 1) { return; } else { try { Directory.CreateDirectory(textBox_state.Text); } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_UnableToCreateTheFolder") + ": " + ex.Message); } } } if (!Directory.Exists(textBox_snapshots.Text)) { ManagedMessageBoxResult res = ManagedMessageBox.ShowQuestionMessage(Program.ResourceManager.GetString("Message_TheSnapshotsFolderIsntExistAt") + " " + textBox_snapshots.Text + ".\n" + Program.ResourceManager.GetString("Message_DoYouWantToCreateThisFolder")); if (res.ClickedButtonIndex == 1) { return; } else { try { Directory.CreateDirectory(textBox_snapshots.Text); } catch (Exception ex) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_UnableToCreateTheFolder") + ": " + ex.Message); } } } Program.Settings.Folder_Sram = textBox_Sram.Text; Program.Settings.Folder_State = textBox_state.Text; Program.Settings.Folder_Snapshots = textBox_snapshots.Text; Program.Settings.Save(); this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); }
// START !! private void button2_Click(object sender, EventArgs e) { // Make checks if (comboBox_platforms.SelectedIndex < 0) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_PleaseSelectAPlatformFirst")); return; } if (checkBox_include_banners.Checked) { if (!Directory.Exists(textBox_Banners_folder.Text)) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_TheFolderForBannersIsNotExist")); button_banners_Click(null, null); return; } } if (checkBox_add_boxart_back.Checked) { if (!Directory.Exists(textBox_boxart_back_folder.Text)) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_TheFolderForBoxartBackIsNotExist")); button4_Click(null, null); return; } } if (checkBox_include_boxart_front.Checked) { if (!Directory.Exists(textBox_boxart_front_folder.Text)) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_TheFolderForBoxartFrontIsNotExist")); button5_Click(null, null); return; } } if (checkBox_include_fanart.Checked) { if (!Directory.Exists(textBox_Fanart_folder.Text)) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_TheFolderForFanartIsNotExist")); button6_Click(null, null); return; } } if (checkBox_add_overview.Checked) { if (!Directory.Exists(textBox_overview_folder.Text)) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_TheFolderForOverviewIsNotExist")); button1_Click_1(null, null); return; } } if (checkBox_include_screenshots.Checked) { if (!Directory.Exists(textBox_overview_folder.Text)) { ManagedMessageBox.ShowErrorMessage(Program.ResourceManager.GetString("Message_TheFolderForScreenshotsIsNotExist")); button8_Click(null, null); return; } } // Poke options ... _clear_info_table = checkBox_clear_info_table.Checked; _clear_snaps_table = checkBox_clear_snapshots_table.Checked; _clear_covers_table = checkBox_clear_covers_table.Checked; matchCase = checkBox_matchCase.Checked; matchWord = checkBox_matchWord.Checked; useRomNameInsteadRomFileName = checkBox_useRomNameInstead.Checked; searchmode_FileInRom = radioButton_searchmode_fileinrom.Checked; searchmode_RomInFile = radioButton_searchmode_rominfile.Checked; searchmode_Both = radioButton_searchmode_both.Checked; startWith = radioButton_startWith.Checked; contains = radioButton_contains.Checked; endWith = radioButton_endwith.Checked; useNameWhenPathNotValid = checkBox_useNameWhenPathNotValid.Checked; _turbo_speed = checkBox_turboe.Checked; _db_selected_platform_id = ((PlatformSearchResult)comboBox_platforms.SelectedItem).ID; _db_rename_rom_using_title = checkBox_rename_rom.Checked; _db_banners_is_cover = radioButton_banners_to_covers.Checked; _db_boxart_front_is_cover = radioButton_boxart_front_to_covers.Checked; _db_boxart_back_is_cover = radioButton_boxart_back_to_covers.Checked; _db_fanart_is_cover = radioButton_fanart_to_covers.Checked; _db_screenshots_is_cover = radioButton_screenshots_to_covers.Checked; _db_add_overview_as_tab = checkBox_add_overview.Checked; _db_add_banners_as_tab = checkBox_include_banners.Checked; _db_add_boxart_front_as_tab = checkBox_include_boxart_front.Checked; _db_add_boxart_back_as_tab = checkBox_add_boxart_back.Checked; _db_add_fanart_as_tab = checkBox_include_fanart.Checked; _db_add_screenshots_as_tab = checkBox_include_screenshots.Checked; _db_overview_folder = textBox_overview_folder.Text; _db_banners_folder = textBox_Banners_folder.Text; _db_boxart_front_folder = textBox_boxart_front_folder.Text; _db_boxart_back_folder = textBox_boxart_back_folder.Text; _db_fanart_folder = textBox_Fanart_folder.Text; _db_screenshots_folder = textBox_Screenshots_folder.Text; _db_fanart_ic_limitdownload = checkBox_limit_download_fanart.Checked; _db_screenshots_ic_limitdownload = checkBox_limit_download_screenshots.Checked; _db_banners_ic_limitdownload = checkBox_limit_download_banners.Checked; // Disable everything groupBox1.Enabled = groupBox2.Enabled = groupBox3.Enabled = tabControl1.Enabled = groupBox_general.Enabled = button_set_all.Enabled = button_set_master_folder.Enabled = false; button_start.Enabled = false; // Start timer timer1.Start(); finished = false; // Start thread ! mainThread = new Thread(new ThreadStart(PROCESS)); mainThread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; mainThread.Start(); }