예제 #1
0
        public void SetUserInterfaceTexts()
        {
            InitializeContextMenuForReplacement();

            label1.Text       = ResxManager.GetResourceString(FormStringKeys.STR_LBL_REPLACE_PATTERN);
            label2.Text       = ResxManager.GetResourceString(FormStringKeys.STR_LBL_REPLACE_RESULT);
            cbAllowEmpty.Text = ResxManager.GetResourceString(FormStringKeys.STR_LBL_ALLOW_EMPTY_REPLACE);
        }
예제 #2
0
        public void SetUserInterfaceTexts()
        {
            tabControl1.TabPages[0].Text = ResxManager.GetResourceString(FormStringKeys.STR_PAGE_MATCHES);
            tabControl1.TabPages[1].Text = ResxManager.GetResourceString(FormStringKeys.STR_PAGE_REPLACE);
            tabControl1.TabPages[2].Text = ResxManager.GetResourceString(FormStringKeys.STR_PAGE_TEMPLATE);

            this.matchResult1.SetUserInterfaceTexts();
            this.replacePage1.SetUserInterfaceTexts();
            this.templatePage1.SetUserInterfaceTexts();
        }
예제 #3
0
 public void SetUserInterfaceTexts()
 {
     lblFilter.Text   = ResxManager.GetResourceString(FormStringKeys.STR_LBL_FILTER);
     btnSearch.Text   = ResxManager.GetResourceString(FormStringKeys.STR_BTN_SEARCH);
     btnClear.Text    = ResxManager.GetResourceString(FormStringKeys.STR_BTN_CLEAR);
     btnCollapse.Text = ResxManager.GetResourceString(FormStringKeys.STR_BTN_COLLAPSE);
     btnExpend.Text   = ResxManager.GetResourceString(FormStringKeys.STR_BTN_EXPEND);
     ttMatchResultPage.SetToolTip(cbRegexMode, ResxManager.GetResourceString(FormStringKeys.TIP_CB_FILTER_AS_REGEX));
     ttMatchResultPage.SetToolTip(cbWhole, ResxManager.GetResourceString(FormStringKeys.TIP_CB_FILTER_WHOLEWORD));
 }
예제 #4
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
 private void SetUserInterfaceTexts()
 {
     tsmiHome.Text = ResxManager.GetResourceString(FormStringKeys.STR_MENU_HOME);
     //tsmiMisc.Text = ResxManager.GetResourceString(FormStringKeys.STR_MENU_MISC);
     tsmiSettings.Text    = ResxManager.GetResourceString(FormStringKeys.STR_MENU_SETTINGS);
     tsmiLanguage.Text    = ResxManager.GetResourceString(FormStringKeys.STR_MENU_LANGUAGE);
     tsmiNewComparer.Text = ResxManager.GetResourceString(FormStringKeys.STR_MENU_NEW_WINDOW);
     tsmiHelp.Text        = ResxManager.GetResourceString(FormStringKeys.STR_MENU_HELP);
     tsmiAbout.Text       = ResxManager.GetResourceString(FormStringKeys.STR_ABOUT);
 }
예제 #5
0
        /// <summary>
        /// we only want the first tab got ads enabled.
        /// </summary>
        /// <param name="showAds"></param>
        /// <returns></returns>
        public TabPage AddNew(bool showAds)
        {
            var tpage = new TabPage(ResxManager.GetResourceString(FormStringKeys.STR_UNTITLED_PROJECT));

            var body = new ToolBody(showAds);

            body.Dock = DockStyle.Fill;
            tpage.Controls.Add(body);
            _tabControl.TabPages.Add(tpage);
            _tabControl.SelectedTab = tpage;

            return(tpage);
        }
예제 #6
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
        private void SetUserInterfaceTexts()
        {
            tsmiHome.Text = ResxManager.GetResourceString(FormStringKeys.STR_MENU_HOME);
            tsmiMisc.Text = ResxManager.GetResourceString(FormStringKeys.STR_MENU_MISC);
            var sc = tsmiMisc.DropDownItems.Find("tsmiSimpleComparer", false);

            if (sc != null && sc.Length > 0)
            {
                sc[0].Text = ResxManager.GetResourceString(FormStringKeys.STR_MENU_SIMPLE_COMPARER);
            }

            tsmiSettings.Text      = ResxManager.GetResourceString(FormStringKeys.STR_MENU_SETTINGS);
            tsmiLanguage.Text      = ResxManager.GetResourceString(FormStringKeys.STR_MENU_LANGUAGE);
            tsmiDonate.Text        = ResxManager.GetResourceString(FormStringKeys.STR_MENU_DONATE);
            tsmiDonate.ToolTipText = "We really appreciate your support. Thank you!";
            tsmiHelp.Text          = ResxManager.GetResourceString(FormStringKeys.STR_MENU_HELP);

            tsbAbout.Text                 = ResxManager.GetResourceString(FormStringKeys.STR_ABOUT);
            tsbNew.Text                   = this.tsbNew2.Text = ResxManager.GetResourceString(FormStringKeys.STR_NEW_PROJECT);
            this.tsbOpen.Text             = this.tsbOpen2.Text = ResxManager.GetResourceString(FormStringKeys.STR_OPEN_PROJECT);
            this.tsbSave.Text             = tsbSave2.Text = ResxManager.GetResourceString(FormStringKeys.STR_SAVE_PROJECT);
            this.tsbSave.Tag              = tsbSave2.Tag = FormStringKeys.STR_SAVE_PROJECT.ToString();
            this.tsbSaveAs.Text           = ResxManager.GetResourceString(FormStringKeys.STR_TITLE_SAVE_PROJECT_AS);
            this.tsbSaveAs.Tag            = FormStringKeys.STR_TITLE_SAVE_PROJECT_AS.ToString();
            tsbCloseProject.Text          = this.tsmiClose.Text = ResxManager.GetResourceString(FormStringKeys.STR_CLOSE_PROJECT);
            this.tsmiExit.Text            = ResxManager.GetResourceString(FormStringKeys.STR_EXIT);
            this.tsmiHistory.Text         = ResxManager.GetResourceString(FormStringKeys.STR_HISTORY);
            this.tsmiHomepage.Text        = ResxManager.GetResourceString(FormStringKeys.STR_HOMEPAGE);
            this.tsmiMatch.Text           = tsmiMatch2.Text = ResxManager.GetResourceString(FormStringKeys.STR_MATCH);
            tsmiOnlineDoc.Text            = ResxManager.GetResourceString(FormStringKeys.STR_ONLINE_DOC);
            tsmiOpenInternetExplorer.Text = ResxManager.GetResourceString(FormStringKeys.STR_OPEN_BROWSER);
            tsmiOpenNotepad.Text          = ResxManager.GetResourceString(FormStringKeys.STR_OPEN_NOTEPAD);
            tsmiRecentFiles.Text          = ResxManager.GetResourceString(FormStringKeys.STR_RECENT_FILES);
            tsmiRecentProjects.Text       = ResxManager.GetResourceString(FormStringKeys.STR_RECENT_PROJECTS);
            tsmiStop.Text                 = ResxManager.GetResourceString(FormStringKeys.STR_STOP);

            foreach (TabPage item in this.tcMain.TabPages)
            {
                var t = item.Controls[0] as ToolBody;

                if (t != null)
                {
                    t.SetUserInterfaceTexts();
                }
            }
        }
예제 #7
0
파일: ToolBody.cs 프로젝트: sw0/RegexTool
        internal void OpenFileOrUrl(string file)
        {
            if (false == Uri.IsWellFormedUriString(file, UriKind.Absolute) &&
                !File.Exists(file))
            {
                var dr = MessageBox.Show(ResxManager.GetResourceString(FormStringKeys.STR_RECENT_FILE_NOT_FOUND),
                                         ResxManager.GetResourceString(FormStringKeys.STR_TITLE_WARNNING),
                                         MessageBoxButtons.OKCancel);

                if (dr == DialogResult.OK)
                {
                    UIManager.Current.RemoveRecentFile(file);
                }
                return;
            }
            bodyLeft.OpenFileOrUrl(file);
        }
예제 #8
0
파일: ToolBody.cs 프로젝트: sw0/RegexTool
        public void Run()
        {
            lock (_lockFlag)
            {
                _isRunning = true;
            }

            UIManager.Current.SetMatchStopButtonStatus();

            var pattern = bodyLeft.RegexPattern;
            var options = bodyLeft.Options;
            var input   = bodyLeft.SourceText;
            //todo do we allow selection match?
            var replacement           = bodyRight.Replacement;
            var allowEmptyReplacement = bodyRight.AllowEmptyReplacement;
            var template = bodyRight.Template;

            if (pattern == string.Empty)
            {
                lock (_lockFlag)
                {
                    _isRunning = false;
                }
                UIManager.Current.SetMatchStopButtonStatus();
                MessageBox.Show(ResxManager.GetResourceString(FormStringKeys.STR_MSG_EMPTY_REGEXEXPRESSION));
                return;
            }

            var info = new RegexFullInfo(pattern, options, input,
                                         replacement, allowEmptyReplacement,
                                         template, bodyRight.TplPage.TplParameters);

            _regexInfo = info;

            if (_threadMatch == null || _threadMatch.IsAlive == false)
            {
                _threadMatch = new Thread(RunInternal);
                _threadMatch.IsBackground = true;
                _threadMatch.Start(info);
            }
            else
            {
                UIManager.Current.SetStatusInfo("It's still running...");
            }
        }
예제 #9
0
        public void SetUserInterfaceTexts()
        {
            InitializeContextMenuForTemplate();

            label1.Text            = ResxManager.GetResourceString(FormStringKeys.STR_PAGE_TEMPLATE);
            label2.Text            = ResxManager.GetResourceString(FormStringKeys.STR_LBL_TEMPLATE_RESULT);
            lblBatchSeparator.Text = ResxManager.GetResourceString(FormStringKeys.STR_LBL_BATCH_SEPARATOR);

            tsbTemplateOptions.Text             = ResxManager.GetResourceString(FormStringKeys.STR_OPTIONS);
            cbAutoTrunDigitsToNumberInSort.Text = ResxManager.GetResourceString(FormStringKeys.STR_BTN_ALLOW_DIGIT_2_NUM);
            cbIngoreDuplicated.Text             = ResxManager.GetResourceString(FormStringKeys.STR_BTN_INGORE_DUPLICATED);
            cbShowDuplicatedOnly.Text           = ResxManager.GetResourceString(FormStringKeys.STR_BTN_DUPLICATED_ONLY);

            txtOrderBy.ToolTipText       = ResxManager.GetResourceString(FormStringKeys.STR_TIP_ORDER_BY);
            tsbOrderBy.ToolTipText       = ResxManager.GetResourceString(FormStringKeys.STR_TIP_ORDER_BY);
            txtItemsPerBatch.ToolTipText = ResxManager.GetResourceString(FormStringKeys.STR_TIP_ITEMS_PER_BATCH);
            _tsmiRowNumber.ToolTipText   = ResxManager.GetResourceString(FormStringKeys.TIP_ROWNUMBER);
        }
예제 #10
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
        private void OpenPage(string path)
        {
            var existedTabPage = UIManager.Current.FindByFileName(path);

            if (existedTabPage == null)
            {
                try
                {
                    if (false == File.Exists(path))
                    {
                        var dr = MessageBox.Show(ResxManager.GetResourceString(FormStringKeys.STR_RECENT_FILE_NOT_FOUND),
                                                 ResxManager.GetResourceString(FormStringKeys.STR_TITLE_WARNNING),
                                                 MessageBoxButtons.OKCancel);

                        if (dr == DialogResult.OK)
                        {
                            UIManager.Current.RemoveRecentProject(path);
                        }
                        return;
                    }

                    var tp = UIManager.Current.AddNew();

                    var tb = tp.Controls[0] as ToolBody;

                    tb.OpenProject(path);

                    tcMain.SelectedTab.Text = Path.GetFileNameWithoutExtension(path);

                    tcMain_SelectedIndexChanged(null, null);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("MainForm.OpenPage error: " + ex.Message);
                }
            }
            else
            {
                UIManager.Current.Select(existedTabPage);

                var tb = existedTabPage.Controls[0] as ToolBody;
                tb.OpenProject(path);
            }
        }
예제 #11
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
        public MainForm()
        {
            InitializeComponent();

            splitContainer1.Panel1Collapsed = true;

            //SysInfoHelper sih = new SysInfoHelper();
            ////initial the value
            //sih.GetUserAgentForIE();

            AppHelper     ah       = new AppHelper();
            AsyncCallback callBack = new AsyncCallback(ProcessUpdateResponse);

            Action <AppStartRequest> startUp = AppHelper.StartUp;

            var ui = new AppStartRequest();

            startUp.BeginInvoke(ui, callBack, ui);
            //AppHelper.StartUp();

            UIManager.Current = new UIManager(this, tcMain);

            {
                var tabNewProject = new ToolStripMenuItem();
                tabNewProject.Tag    = tabNewProject.Name = tabNewProject.Text = ResxManager.GetResourceString(FormStringKeys.STR_NEW_PROJECT.ToString());
                tabNewProject.Click += mNew_Click;
                tcMain.TabCMS.Items.Add(tabNewProject);

                var tabClose = new ToolStripMenuItem();
                tabClose.Name   = tabClose.Text = ResxManager.GetResourceString(FormStringKeys.STR_CLOSE_PROJECT.ToString());
                tabClose.Click += tsmiClose_Click;
                tcMain.TabCMS.Items.Add(tabClose);

                var tabClose2 = new ToolStripMenuItem();
                tabClose2.Name   = tabClose2.Text = ToolHelper.STR_MENUITEM_CLOSE_WITHOUT_SAVE;
                tabClose2.Click += tsmiClose_Click;
                tabClose2.Tag    = ToolHelper.STR_MENUITEM_CLOSE_WITHOUT_SAVE;
                tcMain.TabCMS.Items.Add(tabClose2);
            }

            UIManager.Current.AddNew();

            SetUserInterfaceTexts();
        }
예제 #12
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
        private void tsbSave_Click(object sender, EventArgs e)
        {
            var toolbody = UIManager.Current.CurrentTool;

            if (toolbody != null)
            {
                string cmd = string.Empty;

                if (sender is ToolStripItem)
                {
                    cmd = ((ToolStripItem)sender).Tag as string;
                }
                if (FormStringKeys.STR_TITLE_SAVE_PROJECT_AS.ToString() == cmd ||
                    string.IsNullOrWhiteSpace(toolbody.FileLocation))
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Title = FormStringKeys.STR_TITLE_SAVE_PROJECT_AS.ToString() == cmd
                                    ? ResxManager.GetResourceString(FormStringKeys.STR_TITLE_SAVE_PROJECT_AS)
                                    : sfd.Title = ResxManager.GetResourceString(FormStringKeys.STR_TITLE_SAVE_PROJECT);

                    sfd.Filter = ToolHelper.STR_FILE_FILTER;
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        toolbody.SaveProject(sfd.FileName);
                        string filename = Path.GetFileNameWithoutExtension(sfd.FileName);
                        tcMain.SelectedTab.Text = filename;
                        tcMain_SelectedIndexChanged(null, null);
                    }
                }
                else
                {
                    toolbody.SaveProject(toolbody.FileLocation);
                }
            }
            else
            {
                throw new Exception("1232dsdsdsdsdd");
            }
        }
예제 #13
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.Width  = 1200;
            this.Height = 796;

            //TODO set to configuration file
            this.WindowState = FormWindowState.Maximized;

            tsmiDonate.Click += tsmiDonate_Click;
            tsmiLanguage_DropDownOpening(null, null);

            if (File.Exists("RegexTool.SimpleComparer.exe"))
            {
                var tsmi = new ToolStripMenuItem();
                tsmi.Name   = "tsmiSimpleComparer";
                tsmi.Text   = ResxManager.GetResourceString(FormStringKeys.STR_MENU_SIMPLE_COMPARER);
                tsmi.Click += (s, x) => Process.Start("RegexTool.SimpleComparer.exe");
                tsmiMisc.DropDownItems.Add(tsmi);
            }
#if DEBUG
            //This way, I can know the release app is not built in DEBUG mode.
            this.Text = this.Text + " [DBG]";
#endif
        }
예제 #14
0
        public void SetResult(Regex reg, MatchCollection mc)
        {
            if (tvResult.InvokeRequired)
            {
                Action <Regex, MatchCollection> act = SetResult;

                tvResult.Invoke(act, reg, mc);
            }
            else
            {
                if (mc == null)
                {
                    Debug.WriteLine("mc is null");
                    return;
                }

                tvResult.Nodes.Clear();

                try
                {
                    ToggleSearchFilterButtons(true);

                    int idx = 0;

                    var gNames = reg.GetGroupNames();

                    foreach (Match m in mc)
                    {
                        ++idx;

                        if (idx > 1 && idx % ToolBody.MatchMinCountNeedsDoEvents == 0)
                        {
                            Application.DoEvents();
                        }

                        var nodeMatch = new TreeNode();
                        nodeMatch.Text = string.Format(ResxManager.GetResourceString(FormStringKeys.STR_TREEVIEW_NODE_MATCH), idx, m.Value);
                        tvResult.Nodes.Add(nodeMatch);
                        nodeMatch.Tag = new LocationInfo(m.Value, m.Index, m.Length);
                        nodeMatch.ContextMenuStrip = cmsResult;

                        for (int i = 1; i < m.Groups.Count; i++)
                        {
                            var gName = gNames[i];
                            var g     = m.Groups[gName];

                            var nodeGroup = new TreeNode(string.Format(ResxManager.GetResourceString(FormStringKeys.STR_TREEVIEW_NODE_GROUP), gName, g.Value));
                            nodeMatch.Nodes.Add(nodeGroup);
                            nodeGroup.Tag = new LocationInfo(g.Value, g.Index, g.Length);
                            nodeGroup.ContextMenuStrip = cmsResult;
                            if (false == _showCaptures)
                            {
                                continue;
                            }

                            for (int j = 0; j < g.Captures.Count; j++)
                            {
                                var capture     = g.Captures[j];
                                var nodeCapture =
                                    new TreeNode(string.Format(ResxManager.GetResourceString(FormStringKeys.STR_TREEVIEW_NODE_CAPTURE), j, capture.Value));
                                nodeGroup.Nodes.Add(nodeCapture);
                                nodeCapture.Tag = new LocationInfo(capture.Value, capture.Index, capture.Length);
                                nodeCapture.ContextMenuStrip = cmsResult;
                            }
                        }
                    }

                    lblMatchInfo.Text = string.Format(ResxManager.GetResourceString(FormStringKeys.STR_MATCH_INFO), mc.Count, string.Empty);
                }
                catch (Exception)
                {
#if DEBUG
                    throw;
#endif
                }
                finally
                {
                    ToggleSearchFilterButtons(true);
                }
            }
        }
예제 #15
0
 public void SetUserInterfaceTexts()
 {
     btnLoad.Text = ResxManager.GetResourceString(FormStringKeys.STR_LBL_LOAD);
 }
예제 #16
0
        /// <summary>
        /// populate the group name buttons that user can be easier to input the template by clicking.
        /// Notice: it will take in 15 group names at maximum.
        /// </summary>
        /// <param name="groupNames"></param>
        public void GotGroupNamesChanged(string[] groupNames)
        {
            if (groupNames == null || groupNames.Length == 0)
            {
                //the regular expression is invalid, do nothing
                return;
            }
            string oldValue = txtOrderBy.Text;

            if (tsGroups.Items.Count > 0)
            {
                tsGroups.Items.Clear();
            }

            txtOrderBy.Items.Clear();
            txtOrderBy.Text = "$0";

            for (int i = 0; i < groupNames.Length; i++)
            {
                if (i > 15)
                {
                    break;
                }

                string gName = groupNames[i];
                string item  = string.Empty;

                if (gName.ToCharArray().All(c => char.IsNumber(c)))
                {
                    item = "$" + gName;
                    tsGroups.Items.Add(new ToolStripMenuItem()
                    {
                        Text = item
                    });
                    txtOrderBy.Items.Add(item);
                }
                else
                {
                    item = "${" + gName + "}";
                    tsGroups.Items.Add(new ToolStripMenuItem()
                    {
                        Text = item
                    });
                    txtOrderBy.Items.Add(item);
                }
            }

            var cul = ResxManager.GetCultureInfo() ?? Thread.CurrentThread.CurrentUICulture;

            _tsmiRowNumber.ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_ROWNUMBER);
            tsGroups.Items.Add(_tsmiRowNumber);

            foreach (var item in txtOrderBy.Items)
            {
                if (item.ToString() == oldValue)
                {
                    txtOrderBy.Text = oldValue;
                    oldValue        = "";
                    break;
                }
            }

            if (oldValue != "")
            {
                //if we cannot find the old select item, set it to the first item.
                if (txtOrderBy.Items.Count > 0)
                {
                    txtOrderBy.Text = txtOrderBy.Items[0].ToString();
                }
                else
                {
                    txtOrderBy.Items.Add("$0");
                    txtOrderBy.Text = "$0";
                }
            }

            if (groupNames.Length > 0)
            {
                tsGroups.Items.Add(new ToolStripSeparator());
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = "Tab"
                });
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = "Space"
                });
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = "Return"
                });
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = ","
                });
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = ";"
                });
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = "-"
                });
                tsGroups.Items.Add(new ToolStripMenuItem()
                {
                    Text = "|"
                });
            }

            foreach (ToolStripItem item in tsGroups.Items)
            {
                if (item is ToolStripMenuItem && item != _tsmiRowNumber)
                {
                    item.Click += GroupItem_Click;
                }
            }
        }
예제 #17
0
 private IEnumerable <ToolStripItem> GetRegexToolStripItems()
 {
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegStartOrEnd",
             Text        = "^",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_START),
             //@"The match must start at the beginning of the string or line. Right click for $, The match must occur at the end of the string or before \n at the end of the line or string.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegDigit",
             Text        = "\\d",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_DIGIT),
             //@"Matches any decimal digit. Press Ctrl for \d+, Shift for \d*, Alt for \d?",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegWord",
             Text        = "\\w",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_WORD),
             //@"Matches any word character. Press Ctrl for \w+, Shift for \w*, Alt for \w?",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegSpace",
             Text        = "\\s",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_SPACE),
             //@"Matches any white-space character. Press Ctrl for \s+, Shift for \s*, Alt for \s?",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegTab",
             Text        = "\\t",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_TAB),
             //"Match a tab. You can click it with Shift, Ctrl or Alt key.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegWildcard",
             Text        = ".",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_WILDCARD),
             //@"Wildcard: Matches any single character except \n. To match a literal period character (. or \u002E), you must precede it with the escape character (\.).",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegReturn",
             Text        = "NewLine(\\r\\n)",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_RETURN),
             //"Match a new line. You can click it with Shift, Ctrl or Alt key.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegBorder",
             Text        = "Border(\\b)",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_BORDER),
             //"You can click it with Shift, Ctrl or Alt key.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripSeparator();
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegMany",
             Text        = "+",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_MANY),
             //"Many (1 or more). Press ALT for +?",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegAny",
             Text        = "*",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_ANY),
             //"Any (0 or more). Press ALT for *?",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegOneOrNone",
             Text        = "?",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_NONE_OR_ONE),
             //"0 or 1",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegMTimes",
             Text        = "{m}",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_M_TIMES),
             //"Matches the previous element exactly m times: {m}, or not more than n {m,n}.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegOr",
             Text        = "|",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_OR),
             //"Matches any one element separated by the vertical bar (|) character. For example: th(e|is|at) ",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripSeparator();
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegCharGroup",
             Text        = "[]",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_CHAR_GROUP),
             //"character group, right click to define any single character that is not in character_group. By default, characters in character_group are case-sensitive.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegGroup",
             Text        = "()",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_GROUP),
             //"group the selected text. Right click to define an uncapturing group.",
         };
         yield return(tsb);
     }
     {
         var tsb = new ToolStripSeparator();
         yield return(tsb);
     }
     {
         var tsb = new ToolStripButton()
         {
             Name        = "tblRegDoc",
             Text        = "Online Document",
             ToolTipText = ResxManager.GetResourceString(FormStringKeys.TIP_REGEX_ONELINE_DOC),
             //"Online Document about Regular Expressions",
         };
         yield return(tsb);
     }
 }
예제 #18
0
파일: MainForm.cs 프로젝트: sw0/RegexTool
        private void tsmiRecentFiles_DropDownOpening(object sender, EventArgs e)
        {
            var tsmi = sender as ToolStripMenuItem;

            if (tsmi == null)
            {
                return;
            }

            string tag = tsmi.Tag as string;

            if (string.IsNullOrEmpty(tag))
            {
                return;
            }

            switch (tag)
            {
            case ToolHelper.STR_MENUITEM_RECENT_PROJECTS:
                tsmi.DropDownItems.Clear();
                foreach (string f in UIManager.Current.RecentProjects)
                {
                    var mi = new ToolStripMenuItem(f);
                    mi.Tag    = ToolHelper.STR_MENUITEM_RECENT_PROJECTS;
                    mi.Click += new EventHandler(RecentFileClick);
                    tsmi.DropDownItems.Insert(0, mi);
                }

                if (tsmi.DropDownItems.Count > 0)
                {
                    tsmi.DropDownItems.Add(new ToolStripSeparator());
                    var tsmiClr1 = new ToolStripMenuItem();
                    tsmiClr1.Text   = ResxManager.GetResourceString(FormStringKeys.STR_MENU_ITEM_CLEAR);
                    tsmiClr1.Tag    = ToolHelper.STR_MENUITEM_RECENT_PROJECTS;
                    tsmiClr1.Click += this.tsmiClearRecents_Click;
                    tsmi.DropDownItems.Add(tsmiClr1);
                }
                else
                {
                    var ep = new ToolStripMenuItem("Empty");
                    ep.Enabled = false;
                    tsmi.DropDownItems.Add(ep);
                }
                break;

            case ToolHelper.STR_MENUITEM_RECENT_FILES:
                tsmi.DropDownItems.Clear();
                foreach (string f in UIManager.Current.RecentFiles)
                {
                    var mi = new ToolStripMenuItem(f);
                    mi.Tag    = ToolHelper.STR_MENUITEM_RECENT_FILES;
                    mi.Click += new EventHandler(RecentFileClick);
                    tsmi.DropDownItems.Insert(0, mi);
                }

                if (tsmi.DropDownItems.Count > 0)
                {
                    tsmi.DropDownItems.Add(new ToolStripSeparator());
                    var tsmiClr = new ToolStripMenuItem();
                    tsmiClr.Text   = ResxManager.GetResourceString(FormStringKeys.STR_MENU_ITEM_CLEAR);
                    tsmiClr.Tag    = ToolHelper.STR_MENUITEM_RECENT_FILES;
                    tsmiClr.Click += this.tsmiClearRecents_Click;
                    tsmi.DropDownItems.Add(tsmiClr);
                }
                else
                {
                    var ep = new ToolStripMenuItem("Empty");
                    ep.Enabled = false;
                    tsmi.DropDownItems.Add(ep);
                }
                break;
            }
        }