Exemple #1
0
        public static void Test(Form parent, TextBox find, TextBox replace,
                                CheckBox multiline, CheckBox singleline, CheckBox caseSensitive)
        {
            using (RegexTester t = new RegexTester(true))
            {
                t.Find = find.Text;
                if (replace != null)
                {
                    t.Replace = replace.Text;
                }
                t.Multiline  = multiline.Checked;
                t.Singleline = singleline.Checked;
                t.IgnoreCase = !caseSensitive.Checked;

                if (Variables.MainForm != null && Variables.MainForm.EditBox.Enabled)
                {
                    t.ArticleText = Variables.MainForm.EditBox.Text;
                }

                if (t.ShowDialog(parent) == DialogResult.OK)
                {
                    find.Text = t.Find;
                    if (replace != null)
                    {
                        replace.Text = t.Replace;
                    }
                    multiline.Checked     = t.Multiline;
                    singleline.Checked    = t.Singleline;
                    caseSensitive.Checked = !t.IgnoreCase;
                }
            }
        }
Exemple #2
0
        private void TestRegex(object sender, EventArgs e)
        {
            TypoStatsListViewItem typo = SelectedItem;

            if (typo == null)
            {
                return;
            }

            using (RegexTester t = new RegexTester())
            {
                t.Find    = typo.Typo.Find;
                t.Replace = typo.Typo.Replace;
                if (Variables.MainForm != null && Variables.MainForm.EditBox.Enabled)
                {
                    t.ArticleText = Variables.MainForm.EditBox.Text;
                }

                t.ShowDialog(FindForm());
            }
        }
        public static void Test(Form parent, TextBox find, TextBox replace, 
            CheckBox multiline, CheckBox singleline, CheckBox caseSensitive)
        {
            using (RegexTester t = new RegexTester(true))
            {
                t.Find = find.Text;
                if (replace != null) t.Replace = replace.Text;
                t.Multiline = multiline.Checked;
                t.Singleline = singleline.Checked;
                t.IgnoreCase = !caseSensitive.Checked;

                if (Variables.MainForm != null && Variables.MainForm.EditBox.Enabled)
                    t.ArticleText = Variables.MainForm.EditBox.Text;

                if (t.ShowDialog(parent) == DialogResult.OK)
                {
                    find.Text = t.Find;
                    if (replace != null) replace.Text = t.Replace;
                    multiline.Checked = t.Multiline;
                    singleline.Checked = t.Singleline;
                    caseSensitive.Checked = !t.IgnoreCase;
                }
            }
        }
        private void testRegexToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            if (row == null) return;

            using (RegexTester t = new RegexTester(true))
            {
                t.Find = (string)row.Cells["find"].Value;
                t.Replace = (string)row.Cells["replace"].Value;
                t.Multiline = (bool)row.Cells["multi"].FormattedValue;
                t.Singleline = (bool)row.Cells["single"].FormattedValue;
                t.IgnoreCase = !(bool)row.Cells["casesensitive"].FormattedValue;

                if (Variables.MainForm != null && Variables.MainForm.EditBox.Enabled)
                    t.ArticleText = Variables.MainForm.EditBox.Text;

                if (t.ShowDialog(this) != DialogResult.OK) return;
                row.Cells["find"].Value = t.Find;
                row.Cells["replace"].Value = t.Replace;
                row.Cells["multi"].Value = t.Multiline;
                row.Cells["single"].Value = t.Singleline;
                row.Cells["casesensitive"].Value = !t.IgnoreCase;
            }
        }
        private void TestRegex(object sender, EventArgs e)
        {
            TypoStatsListViewItem typo = SelectedItem;
            if (typo == null) return;

            using (RegexTester t = new RegexTester())
            {
                t.Find = typo.Typo.Find;
                t.Replace = typo.Typo.Replace;
                if (Variables.MainForm != null && Variables.MainForm.EditBox.Enabled)
                    t.ArticleText = Variables.MainForm.EditBox.Text;

                t.ShowDialog(FindForm());
            }
        }
        private void copyToRegexTesterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (RegexTester t = new RegexTester(true))
            {
                t.Find = RegexTextBox.Text;
                t.IgnoreCase = !CaseSensitiveCheckBox.Checked;
                t.Multiline = MultiLineCheckBox.Checked;
                t.Singleline = SingleLineCheckBox.Checked;

                if (t.ShowDialog(this) != DialogResult.OK) return;

                RegexTextBox.Text = t.Find;
                CaseSensitiveCheckBox.Checked = t.IgnoreCase;
                MultiLineCheckBox.Checked = t.Multiline;
                SingleLineCheckBox.Checked = t.Singleline;
            }
        }