private void renameButton_Click(object sender, EventArgs e) { try { if (!CheckFileTypeMatch()) { MessageBox.Show("Rename aborted", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FileList finalFilePaths = InitializeRenameList(); List <string> errorList = RenameOperations.RenameFiles(subtitleFilePathList, finalFilePaths); if (errorList.Count > 0) { if ( MessageBox.Show("At least an error occurred during renaming. Do you want to check details?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { ResultForm previewForm = new ResultForm(subtitleFilePathList, finalFilePaths, errorList); previewForm.RenameTitle("Result"); previewForm.ShowDialog(); } } else { MessageBox.Show("All files have been renamed successfully.", "Conguratulations", MessageBoxButtons.OK, MessageBoxIcon.Information); if (optionClearSubtitlesAfterRename.Checked) { clearSubtitleList(); } if (optionClearMoviesAfterRename.Checked) { clearMovieList(); } } } catch (ArgumentException ex) { MessageBox.Show("An error occurred\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (InvalidOperationException ex) { MessageBox.Show("An error occurred\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void previewButton_Click(object sender, EventArgs e) { try { if (!CheckFileTypeMatch()) { MessageBox.Show("Preview aborted", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FileList finalFilePaths = InitializeRenameList(); ResultForm previewForm = new ResultForm(subtitleFilePathList, finalFilePaths); previewForm.RenameTitle("Preview"); previewForm.ShowDialog(); } catch (ArgumentException ex) { MessageBox.Show("An error occurred\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (InvalidOperationException ex) { MessageBox.Show("An error occurred\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }