private RegistryViewerFilter BuildFilter() { RegistryViewerFilter filter = new RegistryViewerFilter(); foreach (ListViewItem item in listViewFilters.Items) { filter.Filters.Add((RegistryViewerFilterEntry)item.Tag); } return(filter); }
private void UpdateFilter(RegistryViewerFilter filter) { listViewFilters.Items.Clear(); foreach (var entry in filter.Filters) { listViewFilters.Items.Add(CreateItem(entry)); } listViewFilters.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listViewFilters.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); listViewFilters.Sort(); }
public bool IsMatch(object entry) { try { Type t = RegistryViewerFilter.GetTypeForFilter(Type); if (t != entry.GetType()) { return(false); } PropertyInfo pi = RegistryViewerFilter.GetFieldForTypeAndName(Type, Field); object value_obj = pi.GetValue(entry); if (value_obj == null) { return(false); } string value = value_obj.ToString().ToLower(); string value_compare = Value.ToLower(); switch (Comparison) { case FilterComparison.Contains: return(value.Contains(value_compare)); case FilterComparison.EndsWith: return(value.EndsWith(value_compare)); case FilterComparison.Equals: return(value.Equals(value_compare)); case FilterComparison.Excludes: return(!value.Contains(value_compare)); case FilterComparison.NotEquals: return(!value.Equals(value_compare)); case FilterComparison.StartsWith: return(value.StartsWith(value_compare)); } } catch (ArgumentException) { return(false); } return(false); }
private void comboBoxFilterType_SelectedIndexChanged(object sender, EventArgs e) { comboBoxField.Items.Clear(); PopulateComboBox(comboBoxField, RegistryViewerFilter.GetFieldsForType((FilterType)comboBoxFilterType.SelectedItem)); }
private void btnOK_Click(object sender, EventArgs e) { Filter = viewFilterControl.Filter; DialogResult = DialogResult.OK; Close(); }
public ViewFilterForm(RegistryViewerFilter filter, IEnumerable <FilterType> types) { InitializeComponent(); viewFilterControl.Filter = filter; viewFilterControl.SetTypes(types); }