Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 2
0
        public RegexRunner(RegexTester parent, string input, string replace, Regex regex)
        {
            Parent  = parent;
            Input   = input;
            Replace = replace;
            _Regex  = regex;

            Thr          = new Thread(ThreadFunc);
            Thr.Priority = ThreadPriority.BelowNormal;
            Thr.Name     = "RegexRunner";
            Thr.Start();
        }
Ejemplo n.º 3
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());
            }
        }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
0
        private void launchRegexTester(object sender, EventArgs e)
        {
            RegexTester = new RegexTester();

            if (txtEdit.SelectionLength > 0 && MessageBox.Show("Would you like to transfer the currently selected Article Text to the Regex Tester?", "Transfer Article Text?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                RegexTester.ArticleText = txtEdit.SelectedText;

            RegexTester.Show();
        }
Ejemplo n.º 6
0
        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;
            }
        }
Ejemplo n.º 7
0
        public RegexRunner(RegexTester parent, string input, string replace, Regex regex)
        {
            Parent = parent;
            Input = input;
            Replace = replace;
            _Regex = regex;

            Thr = new Thread(ThreadFunc);
            Thr.Priority = ThreadPriority.BelowNormal;
            Thr.Name = "RegexRunner";
            Thr.Start();
        }
Ejemplo n.º 8
0
 public RegexRunner(RegexTester parent, string input, Regex regex)
     : this(parent, input, null, regex)
 { }
Ejemplo n.º 9
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());
            }
        }
Ejemplo n.º 10
0
 public RegexRunner(RegexTester parent, string input, Regex regex)
     : this(parent, input, null, regex)
 {
 }
        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;
            }
        }