示例#1
0
        public virtual void Test_TextFilter_Prefix_CaseSensitive()
        {
            this.olv.SetObjects(PersonDb.All);
            this.olv.UseFiltering = true;
            TextMatchFilter filter = TextMatchFilter.Prefix(this.olv, PersonDb.LastAlphabeticalName.ToLowerInvariant().Substring(0, 4));

            filter.StringComparison = StringComparison.InvariantCulture;
            this.olv.ModelFilter    = filter;
            Assert.AreEqual(1, this.olv.GetItemCount());
        }
示例#2
0
 private void filterToolStripTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         var filter = TextMatchFilter.Contains(this.fastObjectListViewRows, filterToolStripTextBox.Text);
         _highlighter.Filter = filter;
         fastObjectListViewRows.ModelFilter = filter;
         fastObjectListViewRows.Refresh();
     }
 }
示例#3
0
 private void filterToolStripTextBox_TextChanged(object sender, EventArgs e)
 {
     if (filterToolStripTextBox.TextLength == 0)
     {
         var filter = TextMatchFilter.Contains(this.fastObjectListViewRows, string.Empty);
         _highlighter.Filter = filter;
         fastObjectListViewRows.ModelFilter = filter;
         fastObjectListViewRows.Refresh();
     }
 }
示例#4
0
 void filterList(string searchfor)
 {
     if (searchfor.Length >= 2 || searchfor.Length == 0)
     {
         Params.UseFiltering    = false;
         Params.ModelFilter     = TextMatchFilter.Regex(Params, searchfor.ToLower());
         Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter);
         Params.UseFiltering    = true;
     }
 }
示例#5
0
        public void Search(string text)
        {
            current_search_text = text;

            TextMatchFilter filter = TextMatchFilter.Contains(olv, current_search_text);

            olv.ModelFilter = filter;

            olv.SelectedIndex = 0;
        }
示例#6
0
        public virtual void Test_TextFilter_Columns_NoMatch()
        {
            this.olv.SetObjects(PersonDb.All);
            this.olv.UseFiltering = true;
            TextMatchFilter filter = TextMatchFilter.Contains(this.olv, "occup");

            filter.Columns       = new OLVColumn[] { this.olv.GetColumn(0), this.olv.GetColumn(2) };
            this.olv.ModelFilter = filter;
            Assert.AreEqual(0, this.olv.GetItemCount());
        }
示例#7
0
文件: frmMain.cs 项目: fialot/Logger
        // ----- DESCRIPTION FILTER -----

        private void txtFilter_TextChanged(object sender, EventArgs e)
        {
            filterDesc         = TextMatchFilter.Contains(olvLog, txtFilter.Text);
            filterDesc.Columns = new OLVColumn[] { olvLogDesc };

            olvLog.UseFiltering = true;
            olvLog.ModelFilter  = new CompositeAllFilter(new List <IModelFilter> {
                filterDesc, filterLevel, filterDevice, filterHistory
            });
        }
示例#8
0
        public virtual void Test_TextFilter_Regex_CaseSensitive()
        {
            this.olv.SetObjects(PersonDb.All);
            this.olv.UseFiltering = true;
            TextMatchFilter filter = TextMatchFilter.Regex(this.olv, "Z+");

            filter.StringComparison = StringComparison.CurrentCulture;
            this.olv.ModelFilter    = filter;
            Assert.AreEqual(0, this.olv.GetItemCount());
        }
        private void BUT_find_Click(object sender, EventArgs e)
        {
            string searchfor = "";

            InputBox.Show("Search For", "Enter a single word to search for", ref searchfor);

            Params.UseFiltering    = true;
            Params.ModelFilter     = TextMatchFilter.Regex(this.Params, searchfor.ToLower());
            Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter);
        }
示例#10
0
        private void txUserSearch2_TextChanged(object sender, EventArgs e)
        {
            TextMatchFilter filter = null;

            if (!string.IsNullOrEmpty(txUserSearch2.Text))
            {
                filter = TextMatchFilter.Contains(olvUsers2, txUserSearch2.Text);
            }
            olvUsers2.AdditionalFilter = filter;
        }
示例#11
0
        void TimedFilter(ObjectListView olv, string txt, int matchKind)
        {
            TextMatchFilter filter = null;

            if (!String.IsNullOrEmpty(txt))
            {
                switch (matchKind)
                {
                case 0:
                default:
                    filter = TextMatchFilter.Contains(olv, txt);
                    break;

                case 1:
                    filter = TextMatchFilter.Prefix(olv, txt);
                    break;

                case 2:
                    filter = TextMatchFilter.Regex(olv, txt);
                    break;
                }
            }
            // Setup a default renderer to draw the filter matches
            olv.DefaultRenderer = filter == null ? null : new HighlightTextRenderer(filter);
            // Some lists have renderers already installed
            HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer;

            if (highlightingRenderer != null)
            {
                highlightingRenderer.Filter = filter;
            }

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            olv.AdditionalFilter = filter;
            //olv.Invalidate();
            stopWatch.Stop();

            IList objects = olv.Objects as IList;

            if (objects == null)
            {
                toolStripStatusLabel1.Text =
                    String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds);
            }
            else
            {
                toolStripStatusLabel1.Text =
                    String.Format("在 {0} 条数据中过滤出符合条件的 {1} 数据,耗时{2}ms",
                                  objects.Count,
                                  olv.Items.Count,
                                  stopWatch.ElapsedMilliseconds);
            }
        }
示例#12
0
        private void SetupDelegates()
        {
            textBoxFilter.TextChanged += delegate(object o, EventArgs e)
            {
                TextMatchFilter filter = TextMatchFilter.Contains(olvList, textBoxFilter.Text);
                olvList.AdditionalFilter = filter;
                UpdateToolStripLabel();
            };

            olvList.MouseClick += delegate(object s, MouseEventArgs e)
            {
                UpdateToolMenus();
                if (e.Button == MouseButtons.Right)
                {
                    contextMenuStrip.Show(e.X, e.Y);
                }
            };

            gameManagementToolStripMenuItem.Click += delegate(object s, EventArgs e) { UpdateToolMenus(); };

            olvList.MouseDoubleClick += delegate(object s, MouseEventArgs e)
            {
                XciItem xci = (XciItem)olvList.GetItem(olvList.SelectedIndex).RowObject;
                XciHelper.ShowXciExplorer(xci.xciFilePath);
            };

            exitToolStripMenuItem.Click += delegate(object s, EventArgs e) { Application.Exit(); };

            locationToolStripComboBox.SelectedIndexChanged += delegate(object s, EventArgs e) {
                Helpers.Settings.config.defaultView = (XciLocation)locationToolStripComboBox.SelectedIndex;
                XciHelper.RefreshList();
                UpdateToolStripLabel();
            };

            aboutToolStripMenuItem.Click += delegate(object o, EventArgs e)
            {
                formAbout formAbout = new formAbout();
                formAbout.Show();
            };

            this.FormClosing += delegate(object s, FormClosingEventArgs e) { SaveSettings(); };

            this.ResizeEnd += delegate(object s, EventArgs e)
            {
                if (this.WindowState != FormWindowState.Maximized)
                {
                    Helpers.Settings.config.formHeight = this.Height;
                    Helpers.Settings.config.formWidth  = this.Width;
                }
            };

            cancelTransfersToolStripMenuItem.Click  += delegate(object s, EventArgs e) { FileHelper.StopTransfers(); };
            rebuildCachetoolStripMenuItem.Click     += delegate(object s, EventArgs e) { XciHelper.RebuildCache(); };
            refreshGamesListToolStripMenuItem.Click += delegate(object s, EventArgs e) { XciHelper.LoadXcisInBackground(); };
        }
示例#13
0
        /// <summary>
        /// Use Standard Filter
        /// </summary>
        private void UseStandardFilterItems()
        {
            StandardFilter = TextMatchFilter.Contains(olvItem, txtFilter.Text);

            if (cbFilterCol.SelectedIndex == 0)
            {
                StandardFilter.Columns = new OLVColumn[] { itName, itCategory, itSubcategory, itInvNum, itLocation, itKeywords, itCounts, itAvailable, itExcluded }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 1)
            {
                StandardFilter.Columns = new OLVColumn[] { itName }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 2)
            {
                StandardFilter.Columns = new OLVColumn[] { itCategory }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 3)
            {
                StandardFilter.Columns = new OLVColumn[] { itSubcategory }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 4)
            {
                StandardFilter.Columns = new OLVColumn[] { itInvNum }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 5)
            {
                StandardFilter.Columns = new OLVColumn[] { itLocation }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 6)
            {
                StandardFilter.Columns = new OLVColumn[] { itKeywords }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 7)
            {
                StandardFilter.Columns = new OLVColumn[] { itCounts }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 8)
            {
                StandardFilter.Columns = new OLVColumn[] { itAvailable }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 9)
            {
                StandardFilter.Columns = new OLVColumn[] { itExcluded }
            }
            ;
        }
示例#14
0
        /// <summary>
        /// Use Standard Filter
        /// </summary>
        private void UseStandardFilterGames()
        {
            StandardFilter = TextMatchFilter.Contains(olvGames, txtFilter.Text);

            if (cbFilterCol.SelectedIndex == 0)
            {
                StandardFilter.Columns = new OLVColumn[] { gmName, gmCategory, gmKeywords, gmEnviroment, gmMinPlayers, gmMaxPlayers, gmPlayerAge, gmDuration, gmExcluded }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 1)
            {
                StandardFilter.Columns = new OLVColumn[] { gmName }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 2)
            {
                StandardFilter.Columns = new OLVColumn[] { gmCategory }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 3)
            {
                StandardFilter.Columns = new OLVColumn[] { gmKeywords }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 4)
            {
                StandardFilter.Columns = new OLVColumn[] { gmEnviroment }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 5)
            {
                StandardFilter.Columns = new OLVColumn[] { gmMinPlayers }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 6)
            {
                StandardFilter.Columns = new OLVColumn[] { gmMaxPlayers }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 7)
            {
                StandardFilter.Columns = new OLVColumn[] { gmPlayerAge }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 8)
            {
                StandardFilter.Columns = new OLVColumn[] { gmDuration }
            }
            ;
            else if (cbFilterCol.SelectedIndex == 9)
            {
                StandardFilter.Columns = new OLVColumn[] { gmExcluded }
            }
            ;
        }
示例#15
0
        public virtual void Test_TextFilter_FindAll_Regex_Multiple()
        {
            TextMatchFilter       filter = TextMatchFilter.Regex(this.olv, "x.*z", "a.*c");
            List <CharacterRange> ranges = new List <CharacterRange>(filter.FindAllMatchedRanges("rst-ABC-rst-xyz"));

            Assert.AreEqual(2, ranges.Count);
            Assert.AreEqual(12, ranges[0].First);
            Assert.AreEqual(3, ranges[0].Length);
            Assert.AreEqual(4, ranges[1].First);
            Assert.AreEqual(3, ranges[1].Length);
        }
示例#16
0
        public virtual void Test_TextFilter_FindAll_Text()
        {
            TextMatchFilter       filter = new TextMatchFilter(this.olv, "abc");
            List <CharacterRange> ranges = new List <CharacterRange>(filter.FindAllMatchedRanges("x-abcd-ABCD"));

            Assert.AreEqual(2, ranges.Count);
            Assert.AreEqual(2, ranges[0].First);
            Assert.AreEqual(3, ranges[0].Length);
            Assert.AreEqual(7, ranges[1].First);
            Assert.AreEqual(3, ranges[1].Length);
        }
示例#17
0
        /// <summary>
        /// Called when the user changes the text value in the free text search area
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void HandleFreeTextFilterChange(TextBox sender, EventArgs e)
        {
            DAL         dal           = new DAL(this);
            List <Room> filteredRooms = dal.FindRoomsWithOptionalFiltersOnDate(this.OnDateFilter, freeText: sender.Text);

            this.ClearFilterSelections();
            this.GUIMain.SetRooms(filteredRooms);
            ObjectListView roomHolder = this.GUIMain.GetRoomHolder();

            roomHolder.ModelFilter = TextMatchFilter.Contains(roomHolder, sender.Text);
        }
示例#18
0
 private void TxtSearch_TextChanged(object sender, System.EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtSearch.Text))
     {
         romsListMain.ModelFilter = TextMatchFilter.Contains(romsListMain, txtSearch.Text);
     }
     else
     {
         romsListMain.ModelFilter = null;
     }
 }
示例#19
0
        private void FilterRows()
        {
            var filter = TextMatchFilter.Contains(objlist_artwork_editor, txt_search.Text);

            if (objlist_artwork_editor.DefaultRenderer == null)
            {
                objlist_artwork_editor.DefaultRenderer = new HighlightTextRenderer(filter);
            }

            objlist_artwork_editor.AdditionalFilter = filter;
        }
示例#20
0
        void btn_OK_Click(object sender, EventArgs e)
        {
            TextMatchFilter filter = null;

            if (!string.IsNullOrEmpty(txt_filter.Text))
            {
                filter = TextMatchFilter.Contains(_List, txt_filter.Text);
            }

            _List.AdditionalFilter = filter;
        }
示例#21
0
 private void searchTB_KeyUp(object sender, KeyEventArgs e)
 {
     if (!string.IsNullOrEmpty(toolStripSearchBox.Text))
     {
         this.treeListView.ModelFilter = TextMatchFilter.Contains(treeListView, toolStripSearchBox.Text.ToUpper());
     }
     else
     {
         treeListView.ModelFilter = null;
     }
 }
示例#22
0
        private void SearchTextbox_TextChanged(object sender, EventArgs e)
        {
            TextMatchFilter filter = TextMatchFilter.Contains(this.fastObjectListView1, searchTextbox.Text);

            //olv.ModelFilter = filter;
            fastObjectListView1.AdditionalFilter = filter;

            //HighlightTextRenderer r = new HighlightTextRenderer();
            //olv.DefaultRenderer = r;

            updateTotalSizeText();
        }
示例#23
0
 /// <summary>
 /// Use Fast Filter
 /// </summary>
 private void UseFastFilterBooks()
 {
     if (FastFilterList.Count == 0)
     {
         FastFilter = TextMatchFilter.Contains(olvBooks, "");
     }
     else
     {
         string[] filterArray = FastFilterList.ToArray();
         FastFilter = TextMatchFilter.Prefix(olvBooks, filterArray);
     }
     if (cbFastFilterCol.SelectedIndex == 0)
     {
         FastFilter.Columns = new OLVColumn[] { bkAuthor, bkGenre, bkInvNum, bkKeywords, bkLocation, bkName, bkSeries, bkSubgenre, bkType, bkYear }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 1)
     {
         FastFilter.Columns = new OLVColumn[] { bkName }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 2)
     {
         FastFilter.Columns = new OLVColumn[] { bkAuthor }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 3)
     {
         FastFilter.Columns = new OLVColumn[] { bkType }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 4)
     {
         FastFilter.Columns = new OLVColumn[] { bkGenre }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 5)
     {
         FastFilter.Columns = new OLVColumn[] { bkSubgenre }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 6)
     {
         FastFilter.Columns = new OLVColumn[] { bkLocation }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 7)
     {
         FastFilter.Columns = new OLVColumn[] { bkSeries }
     }
     ;
 }
示例#24
0
 /// <summary>
 /// Use Fast Filter
 /// </summary>
 private void UseFastFilterContacts()
 {
     if (FastFilterList.Count == 0)
     {
         FastFilter = TextMatchFilter.Contains(olvContacts, "");
     }
     else
     {
         string[] filterArray = FastFilterList.ToArray();
         FastFilter = TextMatchFilter.Prefix(olvContacts, filterArray);
     }
     if (cbFastFilterCol.SelectedIndex == 0)
     {
         FastFilter.Columns = new OLVColumn[] { conName, conSurname, conNick, conPhone, conEmail, conAddress, conCompany }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 1)
     {
         FastFilter.Columns = new OLVColumn[] { conName }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 2)
     {
         FastFilter.Columns = new OLVColumn[] { conSurname }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 3)
     {
         FastFilter.Columns = new OLVColumn[] { conNick }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 4)
     {
         FastFilter.Columns = new OLVColumn[] { conPhone }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 5)
     {
         FastFilter.Columns = new OLVColumn[] { conEmail }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 6)
     {
         FastFilter.Columns = new OLVColumn[] { conAddress }
     }
     ;
     else if (cbFastFilterCol.SelectedIndex == 7)
     {
         FastFilter.Columns = new OLVColumn[] { conCompany }
     }
     ;
 }
示例#25
0
        public static void SetUpSearchBox(ObjectListView listView, ToolStripTextBox searchBox)
        {
            const string searchText = "Search...";

            void PutSearchText()
            {
                searchBox.Text      = searchText;
                searchBox.ForeColor = Color.Gray;
            }

            PutSearchText();

            bool SearchStringIsEmpty()
            {
                return(string.IsNullOrWhiteSpace(searchBox.Text) || searchBox.Text == searchText);
            }

            searchBox.GotFocus += (sender, args) =>
            {
                if (SearchStringIsEmpty())
                {
                    searchBox.Text = string.Empty;
                }
                searchBox.ForeColor = Control.DefaultForeColor;
            };
            searchBox.LostFocus += (sender, args) =>
            {
                if (SearchStringIsEmpty())
                {
                    PutSearchText();
                }
            };

            var textMatchFilter = new TextMatchFilter(listView);

            textMatchFilter.StringComparison = StringComparison.OrdinalIgnoreCase;
            listView.AdditionalFilter        = textMatchFilter;
            listView.UseFiltering            = true;
            searchBox.TextChanged           += (sender, args) =>
            {
                if (SearchStringIsEmpty())
                {
                    textMatchFilter.ContainsStrings = null;
                }
                else
                {
                    textMatchFilter.ContainsStrings = new[] { searchBox.Text.Trim() }
                };
                listView.UpdateColumnFiltering();
            };
        }
    }
示例#26
0
        public void TimedFilter(ObjectListView olv, string txt, int matchKind)
        {
            TextMatchFilter filter = null;

            if (!String.IsNullOrEmpty(txt))
            {
                switch (matchKind)
                {
                case 0:
                default:
                    filter = TextMatchFilter.Contains(olv, txt);
                    break;

                case 1:
                    filter = TextMatchFilter.Prefix(olv, txt);
                    break;

                case 2:
                    filter = TextMatchFilter.Regex(olv, txt);
                    break;
                }
            }

            // Text highlighting requires at least a default renderer
            if (olv.DefaultRenderer == null)
            {
                olv.DefaultRenderer = new HighlightTextRenderer(filter);
            }

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            olv.AdditionalFilter = filter;
            //olv.Invalidate();
            stopWatch.Stop();

            IList objects = olv.Objects as IList;

            if (objects == null)
            {
                this.ToolStripStatus1 = prefixForNextSelectionMessage =
                    String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds);
            }
            else
            {
                this.ToolStripStatus1 = prefixForNextSelectionMessage =
                    String.Format("Filtered {0} items down to {1} items in {2}ms",
                                  objects.Count,
                                  olv.Items.Count,
                                  stopWatch.ElapsedMilliseconds);
            }
        }
示例#27
0
 /// <summary>
 /// Use Fast Tag Filter
 /// </summary>
 private void UseFastTagFilterBoard()
 {
     if (FastTagFilterList.Count == 0)
     {
         FastFilterTags = TextMatchFilter.Contains(olvBoard, "");
     }
     else
     {
         string[] filterArray = FastTagFilterList.ToArray();
         FastFilterTags         = TextMatchFilter.Contains(olvBoard, filterArray);
         FastFilterTags.Columns = new OLVColumn[] { bgTagsNum };
     }
 }
示例#28
0
        /// <summary>
        /// This will remove the list filter.
        /// </summary>
        public void RemoveStringFilter()
        {
            TextMatchFilter tmfFilter = TextMatchFilter.Contains(this, String.Empty);

            tmfFilter.Columns = new OLVColumn[] { (OLVColumn)this.Columns[0] };
            HighlightTextRenderer highlightingRenderer = this.GetColumn(0).Renderer as HighlightTextRenderer;

            if (highlightingRenderer != null)
            {
                highlightingRenderer.Filter = tmfFilter;
            }
            m_strLastSearchFilter = String.Empty;
        }
示例#29
0
        void txt_filter_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter | FilterOnTheFly)
            {
                TextMatchFilter filter = null;
                if (!string.IsNullOrEmpty(txt_filter.Text))
                {
                    filter = TextMatchFilter.Contains(_List, txt_filter.Text);
                }

                _List.AdditionalFilter = filter;
            }
        }
示例#30
0
        public virtual void Test_TextFilter_FindAll_Text_Multiple()
        {
            TextMatchFilter       filter = TextMatchFilter.Contains(this.olv, "abc", "DE");
            List <CharacterRange> ranges = new List <CharacterRange>(filter.FindAllMatchedRanges("x-abcd-ABCDE"));

            Assert.AreEqual(3, ranges.Count);
            Assert.AreEqual(2, ranges[0].First);
            Assert.AreEqual(3, ranges[0].Length);
            Assert.AreEqual(7, ranges[1].First);
            Assert.AreEqual(3, ranges[1].Length);
            Assert.AreEqual(10, ranges[2].First);
            Assert.AreEqual(2, ranges[2].Length);
        }
示例#31
0
		/// <summary>
		/// Create a HighlightTextRenderer
		/// </summary>
		/// <param name="filter"></param>
		public HighlightTextRenderer(TextMatchFilter filter)
			: this() {
			this.Filter = filter;
		}
 public virtual void Test_TextFilter_FindAll_Text_NoMatch() {
     TextMatchFilter filter = new TextMatchFilter(this.olv, "xyz");
     List<CharacterRange> ranges = new List<CharacterRange>(filter.FindAllMatchedRanges("x-abcd-ABCD"));
     Assert.AreEqual(0, ranges.Count);
 }
 public virtual void Test_TextFilter_FindAll_Text() {
     TextMatchFilter filter = new TextMatchFilter(this.olv, "abc");
     List<CharacterRange> ranges = new List<CharacterRange>(filter.FindAllMatchedRanges("x-abcd-ABCD"));
     Assert.AreEqual(2, ranges.Count);
     Assert.AreEqual(2, ranges[0].First);
     Assert.AreEqual(3, ranges[0].Length);
     Assert.AreEqual(7, ranges[1].First);
     Assert.AreEqual(3, ranges[1].Length);
 }