private void DoneExit_Click(object sender, EventArgs e)
 {
     RegexFinal = "";
     if (DefaultAndAdvancedTab.SelectedTab == DefaultAndAdvancedTab.TabPages["Default"])
     {
         foreach (var a in TagGroupList)
         {
             if (a.Item1 == 0)
             {
                 RegexFinal += "(" + Regex.Escape(a.Item2) + ")";
             }
             if (a.Item1 == 1)
             {
                 RegexFinal += "([0-9]*)";
             }
             if (a.Item1 == 2)
             {
                 RegexFinal += "([a-zA-Z]*)";
             }
             if (a.Item1 == 3)
             {
                 RegexFinal += "(.*)";
             }
             if (a.Item1 == 4)
             {
                 RegexFinal += "([^a-zA-Z]*)";
             }
             if (a.Item1 == 5)
             {
                 RegexFinal += "([^0-9]*)";
             }
         }
         if (count != 0)
         {
             NameFormatDefault NameSpecifierDefault = new NameFormatDefault(TagGroupList, RegexFinal, FileTypeForPassing);
             NameSpecifierDefault.ShowDialog();
             NameSpecifierDefault.Close();
             EnteredUserNameFormat = NameSpecifierDefault.FinalUserNameFormat;
             Close();
         }
     }
     else
     {
         if (UserRegexBox.Text != "")
         {
             RegexFinal = UserRegexBox.Text;
             NameFormatAdvanced NameSpecifierAdvanced = new NameFormatAdvanced(FileTypeForPassing);
             NameSpecifierAdvanced.ShowDialog();
             NameSpecifierAdvanced.Close();
             EnteredUserNameFormat = NameSpecifierAdvanced.FinalUserNameFormat;
             Close();
         }
     }
 }
 private void UserRegexBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         try {
             Regex regex = new Regex(@UserRegexBox.Text);
         } catch (Exception ex) {
             MessageBox.Show("The Regex you provided seems to have generated an error." + Environment.NewLine + "Exception Message : " + ex.Message, "Invalid Regex", MessageBoxButtons.OK, MessageBoxIcon.Error);
             UserRegexBox.Text = "";
             UserRegexBox.Focus();
         }
         if (UserRegexBox.Text != "")
         {
             RegexFinal = UserRegexBox.Text;
             NameFormatAdvanced NameSpecifierAdvanced = new NameFormatAdvanced(FileTypeForPassing);
             NameSpecifierAdvanced.ShowDialog();
             NameSpecifierAdvanced.Close();
             EnteredUserNameFormat = NameSpecifierAdvanced.FinalUserNameFormat;
             Close();
         }
     }
 }
 private void UserRegexBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
     if (e.KeyCode == Keys.Enter) {
         try {
             Regex regex = new Regex(@UserRegexBox.Text);
         } catch (Exception ex) {
             MessageBox.Show("The Regex you provided seems to have generated an error." + Environment.NewLine + "Exception Message : " + ex.Message, "Invalid Regex", MessageBoxButtons.OK, MessageBoxIcon.Error);
             UserRegexBox.Text = "";
             UserRegexBox.Focus();
         }
         if (UserRegexBox.Text != "") {
             RegexFinal = UserRegexBox.Text;
             NameFormatAdvanced NameSpecifierAdvanced = new NameFormatAdvanced(FileTypeForPassing);
             NameSpecifierAdvanced.ShowDialog();
             NameSpecifierAdvanced.Close();
             EnteredUserNameFormat = NameSpecifierAdvanced.FinalUserNameFormat;
             Close();
         }
     }
 }
 private void DoneExit_Click(object sender, EventArgs e) {
     RegexFinal = "";
     if (DefaultAndAdvancedTab.SelectedTab == DefaultAndAdvancedTab.TabPages["Default"]) {
         foreach (var a in TagGroupList) {
             if (a.Item1 == 0) {
                 RegexFinal += "(" + Regex.Escape(a.Item2) + ")";
             }
             if (a.Item1 == 1) {
                 RegexFinal += "([0-9]*)";
             }
             if (a.Item1 == 2) {
                 RegexFinal += "([a-zA-Z]*)";
             }
             if (a.Item1 == 3) {
                 RegexFinal += "(.*)";
             }
             if (a.Item1 == 4) {
                 RegexFinal += "([^a-zA-Z]*)";
             }
             if (a.Item1 == 5) {
                 RegexFinal += "([^0-9]*)";
             }
         }
         if (count != 0) {
             NameFormatDefault NameSpecifierDefault = new NameFormatDefault(TagGroupList, RegexFinal, FileTypeForPassing);
             NameSpecifierDefault.ShowDialog();
             NameSpecifierDefault.Close();
             EnteredUserNameFormat = NameSpecifierDefault.FinalUserNameFormat;
             Close();
         }
     } else {
         if (UserRegexBox.Text != "") {
             RegexFinal = UserRegexBox.Text;
             NameFormatAdvanced NameSpecifierAdvanced = new NameFormatAdvanced(FileTypeForPassing);
             NameSpecifierAdvanced.ShowDialog();
             NameSpecifierAdvanced.Close();
             EnteredUserNameFormat = NameSpecifierAdvanced.FinalUserNameFormat;
             Close();
         }
     }
 }