private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            //handle global key shortcuts
            if (e.KeyCode == Keys.F1)
            {
                AutoDetectAutoMatchListViews();
            }

            if (e.KeyCode == Keys.F2)
            {
                DeepDetectAutoMatchListViews();
            }

            if (e.KeyCode == Keys.F4)
            {
                folderBrowserDialog1.ShowDialog();
                LoadTargetDirectory(true);
            }

            if (e.KeyCode == Keys.F5)
            {
                bFilterLeft.PerformClick();
                bFilterRight.PerformClick();
            }

            if (e.KeyCode == Keys.F8)
            {
                RenameUtils.ClearMathingLeftRight(lvFilesLeft, lvFilesRight);
            }

            if (e.KeyCode == Keys.F12)
            {
                StartAutomaticDownloadSubtitles();
            }

            if (e.KeyCode == Keys.Enter)
            {
                Match();
            }

            if (e.KeyCode == Keys.Add)
            {
                cbRegexes.SelectedIndex = cbRegexes.SelectedIndex < cbRegexes.Items.Count - 1 ? cbRegexes.SelectedIndex + 1 : 0;
            }

            if (e.KeyCode == Keys.Subtract)
            {
                cbRegexes.SelectedIndex = cbRegexes.SelectedIndex > 0 ? cbRegexes.SelectedIndex - 1 : cbRegexes.Items.Count - 1;
            }

            if (e.KeyCode == Keys.Multiply)
            {
                cbUseComplexRegex.Checked = !cbUseComplexRegex.Checked;
            }

            if (e.KeyCode == Keys.Divide)
            {
                cbAutoClear.Checked = !cbAutoClear.Checked;
            }
        }
        private void MainForm_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

            foreach (string file in files)
            {
                bool flagPass = false;
                if (Directory.Exists(file.ToString()))
                {
                    folderBrowserDialog1.SelectedPath = file.ToString();
                    flagPass = true;
                }
                if (File.Exists(file.ToString()))
                {
                    FileInfo ddFile = new FileInfo(file.ToString());
                    folderBrowserDialog1.SelectedPath = ddFile.Directory.FullName.ToString();
                    flagPass = true;
                }
                if (flagPass)
                {
                    RenameUtils.PopulateFiles(lvFilesLeft, tbSearchPatternLeft.Text, folderBrowserDialog1);
                    RenameUtils.PopulateFiles(lvFilesRight, tbSearchPatternRight.Text, folderBrowserDialog1);
                    LogUtils.AddLogTextLine("Populating form with content from path: " + RenameUtils.GetFullPath(folderBrowserDialog1).ToString());
                    break;
                }
            }
        }
        public MainForm(string path)
        {
            InitializeComponent();

            consoleLogForm = new ConsoleLogForm(this)
            {
                StartPosition = FormStartPosition.CenterParent
            };
            consoleLogForm.Hide();

            //Handle version title.
            string LongVersion   = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            string VersionNumber = LongVersion.Substring(0, LongVersion.Length - 2);

            Text = "MatchSubs4Vids (v" + VersionNumber + ")";

            renameUtils = new RenameUtils();
            renameUtils.InitializeUtils();
            renameUtils.LoadFilters(tbSearchPatternLeft, tbSearchPatternRight);
            renameUtils.LoadRegexesIntoComboBox(cbRegexes);

            if (path.Length > 0 && Directory.Exists(path))
            {
                DisplayStatus("Directory from startup parameter /path exists - " + path + " - preloading data", false);
                this.pathViaAppParams             = true;
                folderBrowserDialog1.SelectedPath = path;
                LoadTargetDirectory(true);
            }
        }
 private void LoadTargetDirectory(bool autoDetetect)
 {
     RenameUtils.PopulateFiles(lvFilesLeft, tbSearchPatternLeft.Text, folderBrowserDialog1);
     RenameUtils.PopulateFiles(lvFilesRight, tbSearchPatternRight.Text, folderBrowserDialog1);
     LogUtils.AddLogTextLine("Populating form with content from path: " + RenameUtils.GetFullPath(folderBrowserDialog1).ToString());
     if (autoDetetect)
     {
         AutoDetectAutoMatchListViews();
     }
 }
 private void lvFilesRight_ItemChecked(object sender, ItemCheckedEventArgs e)
 {
     RenameUtils.BehaveLikeRadioCheckBox(lvFilesRight, e.Item);
 }
 private void bClearMatching_Click(object sender, EventArgs e)//Clear matches.
 {
     RenameUtils.ClearMathingLeftRight(lvFilesLeft, lvFilesRight);
 }
 private void bFilterRight_Click(object sender, EventArgs e)
 {
     RenameUtils.PopulateFiles(lvFilesRight, tbSearchPatternRight.Text, folderBrowserDialog1);
 }