Exemplo n.º 1
0
        private void TestRegExpSearch_DisplayResults(Match match)
        {
            Debug.WriteLine("TestRegExpSearch_DisplayResults");
            MyNode item;
            SearchMatch s_match;

            if (match.Success)
            {

                item = new MyNode("Result (" + match.Index + ")", match.Index + "-" + (match.Index + match.Length), match.Value);
                item.Spans = new int[] { match.Index, match.Length };
                s_match = new SearchMatch();
                s_match.Index = match.Index;
                s_match.Length = match.Length;
                s_match.Value = match.Value;
                AddHighlight(this.matchTextSci, s_match);
                this.matchResultModel.Nodes.Add(item);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Display the match into the treelistview
        /// </summary>
        /// <param name="match"></param>
        /// <param name="index"></param>
        private void TestRegExpMatch_DisplayResults(Match match, Int32 index)
        {
            Debug.WriteLine("TestRegExp_DisplayResults(2)");
            MyNode item;
            MyNode node;
            Group group;
            SearchMatch s_match;

            if (match.Success)
            {
                item = new MyNode("Group " + index + " Group(0)", match.Index + "-" + (match.Index + match.Length), match.Value);
                item.Spans = new int[] { match.Index, match.Length };

                if (match.Groups.Count > 1)
                {
                    for (int k = 1; k < match.Groups.Count; k++)
                    {
                        group = match.Groups[k];
                        node = new MyNode("Group " + index + " Group(" + k + ")", group.Index + "-" + (group.Index + group.Length), group.Value);
                        node.Spans = new int[] { group.Index, group.Length };
                        item.Nodes.Add(node);
                    }

                    s_match = new SearchMatch();
                    s_match.Index = match.Index;
                    s_match.Length = match.Length;
                    s_match.Value = match.Value;

                    AddHighlight(this.matchTextSci, s_match);
                }
                this.matchResultModel.Nodes.Add(item);
            }
        }