/// <summary> /// Rebuilds the filtered items array based on given citerias. /// </summary> public void ApplyFilter(StringHelper.IStringFilter filter) { if (filter == null || filter.IsAlwaysMatch) { filteredItems = storedItems; } else { IList <ListViewItem> tmp = new List <ListViewItem>(); lock (syncItems) { foreach (ListViewItem i in storedItems) { DebugViewData d = i.Tag as DebugViewData; if (d != null && filter.Match(d.Message)) { tmp.Add(i); } } } filteredItems = tmp; } }
/// <summary> /// Converts DebugViewData to ListViewItem. /// </summary> private static ListViewItem ToListViewItem(DebugViewData i) { ListViewItem d = new ListViewItem((number++).ToString()); d.SubItems.Add(i.CreationTime); if ((int)i.PID < 0) { d.SubItems.Add("[ -- ]"); } else { d.SubItems.Add("0x" + i.PID.ToString("X")); } d.SubItems.Add(i.ProcessName); d.SubItems.Add(i.Message); d.Tag = i; return(d); }