コード例 #1
0
        private RegistryViewerFilter BuildFilter()
        {
            RegistryViewerFilter filter = new RegistryViewerFilter();

            foreach (ListViewItem item in listViewFilters.Items)
            {
                filter.Filters.Add((RegistryViewerFilterEntry)item.Tag);
            }
            return(filter);
        }
コード例 #2
0
 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();
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 private void comboBoxFilterType_SelectedIndexChanged(object sender, EventArgs e)
 {
     comboBoxField.Items.Clear();
     PopulateComboBox(comboBoxField, RegistryViewerFilter.GetFieldsForType((FilterType)comboBoxFilterType.SelectedItem));
 }
コード例 #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     Filter       = viewFilterControl.Filter;
     DialogResult = DialogResult.OK;
     Close();
 }
コード例 #6
0
 public ViewFilterForm(RegistryViewerFilter filter, IEnumerable <FilterType> types)
 {
     InitializeComponent();
     viewFilterControl.Filter = filter;
     viewFilterControl.SetTypes(types);
 }