Esempio n. 1
0
 private void RevertFileButton_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         renamedFiles       = new RenamedFilesTextFile();
         richTextBox2.Text += renamedFiles.RevertFilesFrom(openFileDialog1.FileName);
     }
 }
Esempio n. 2
0
        private void RenameButton_Click(object sender, EventArgs e)
        {
            //fileNames = DateTime.Now + "\r\n";
            if (path != "" && textBox2.Text != "" || path != "" && !checkBox1.Checked)
            {
                var fileEntries = checkBox2.Checked ? Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) : Directory.EnumerateFiles(path);
                shownError = false;
                foreach (var item in fileEntries)
                {
                    FileInfo file = new FileInfo(item);
                    if (mediaExtensions.Contains(file.Extension, StringComparer.OrdinalIgnoreCase))
                    {
                        if (checkBox1.Checked) //tv shows
                        {
                            TvShowRename(path, file);
                        }
                        else //movies
                        {
                            if (!warnedAboutTvShows)
                            {
                                int i = 0;
                                foreach (var keyWords in checkKeyWords)
                                {
                                    bool keyword = path.ToLower().Contains(checkKeyWords[i]);
                                    i++;
                                    if (keyword)
                                    {
                                        var response = MessageBox.Show("Are you sure these folders only contain movies?", "Found tvshows label in path", MessageBoxButtons.OKCancel);
                                        if (response == DialogResult.Cancel)
                                        {
                                            warnedAboutTvShows = false;
                                            return;
                                        }
                                        warnedAboutTvShows = true;
                                    }
                                }
                            }

                            MoviesRename(path, file);
                        }
                    }
                }
                //Re-disable rename button
                renameButton.Enabled = false;
                //Output renamed files to a file for backup
                renamedFiles   = new RenamedFilesTextFile(fileNames);
                Revert.Enabled = true;
            }
            else
            {
                const string errorMsg = "Fill all the boxes";
                MessageBox.Show(errorMsg, title, MessageBoxButtons.OK);
            }
        }