public SetEvaluator(oval_system_characteristics systemCharacteristics, IEnumerable <StateType> states, VariablesEvaluated variables) { this.systemCharacteristics = systemCharacteristics; this.ovalDefinitionStates = states; this.variables = variables; this.filterEvaluator = new FilterEvaluator(this.systemCharacteristics, this.ovalDefinitionStates, this.variables); }
public void Must_not_apply_filter_for_objectTypes_that_not_match_with_state_specification_of_filter() { string[] idsOfObjectTypes = new string[] { "oval:org.mitre.oval:obj:2000", "oval:org.mitre.oval:obj:3000" }; IEnumerable <sc.ObjectType> objectTypes = this.GetObjectTypesForTest(idsOfObjectTypes, systemCharacteristics); FilterEvaluator filterEvaluator = new FilterEvaluator(systemCharacteristics, states, null); IEnumerable <sc.ObjectType> objectTypesAfterFilter = filterEvaluator.ApplyFilter(objectTypes, "oval:org.mitre.oval:ste:99"); Assert.IsNotNull(objectTypesAfterFilter); Assert.AreEqual(2, objectTypesAfterFilter.Count(), "the quantity of objects is not expected"); }
public void Should_be_possible_to_apply_a_filter_in_ObjectTypeList_based_on_state() { string[] idsOfObjectTypes = new string[] { "oval:org.mitre.oval:obj:2000", "oval:org.mitre.oval:obj:5000" }; IEnumerable <sc.ObjectType> objectTypes = this.GetObjectTypesForTest(idsOfObjectTypes, systemCharacteristics); FilterEvaluator filterEvaluator = new FilterEvaluator(systemCharacteristics, states, null); IEnumerable <sc.ObjectType> objectTypesAfterFilter = filterEvaluator.ApplyFilter(objectTypes, "oval:org.mitre.oval:ste:99"); Assert.IsNotNull(objectTypesAfterFilter); Assert.AreEqual(1, objectTypesAfterFilter.Count(), "the quantity of objects is not expected"); }
private void Main_Load(object sender, EventArgs e) { this.MinimumSize = this.Size; Main_Resize(null, null); filterEvaluator = new FilterEvaluator(this); buttonAdd.Dialog = new Windows.FilterSelector(this); buttonAdd.onDialogCloseEvent = () => filterEvaluator.Evaluate(selectedFilter); olvPreview.CellPadding = new Rectangle( new Point(2, 0), new Size(0, 0) ); //dropDownSort.SelectedIndex = 0; Settings.Load(); profileManager = new ProfileManager(dropDownProfile); profileManager.PopulateProfiles(); naturalSortToolStripMenuItem.Checked = true; //olvPreview.Columns[0]. //Set colors to textBoxFilter SetFocusColor(textBoxFilter); //Load regex filters //RegexFilters.SetData(contextMenuRegex, textBoxFilter, textBoxFilter_TextChanged) RegexHelper.SetData(contextMenuRegex, textBoxFilter); //objectlistview.sourceforge.net/cs/dragdrop.html var dropSink = new BrightIdeasSoftware.SimpleDropSink() { CanDropOnItem = false, CanDropBetween = true, FeedbackColor = Color.LightGray }; //var dropSink = new BrightIdeasSoftware.RearrangingDropSink(false) //{ // FeedbackColor = Color.LightGray //}; olvPreview.DropSink = dropSink; }
private void FilterItems() { FilteredItems = Items; if (FilteredItems != null && Filter != null) { FilteredItems = new List <ItemCraft>(); if (Items.Count >= Properties.Settings.Default.ProgressBarThreshold) { int i = 0; ProgressDialog p = new ProgressDialog() { Title = "Filtering...", Steps = Items.Count, ReportStep = Math.Max(Items.Count / 100, 1) }; p.Increment = () => { FilterResult res = FilterEvaluator.Evaluate(Items[i], Filter); Items[i].TempProps = res.Info; if (res.Match) { FilteredItems.Add(Items[i]); } i++; }; p.ShowDialog(); } else { foreach (ItemCraft item in Items) { FilterResult res = FilterEvaluator.Evaluate(item, Filter); item.TempProps = res.Info; if (res.Match) { FilteredItems.Add(item); } } } } //GraphWindows.Clear(); }
private IQueryable <T> ApplyFilters(IFilter <T> expression) { return(FilterEvaluator <T> .GetQuery(_context.Set <T>().AsQueryable(), expression)); }