Example #1
0
 /// <summary>
 /// Determines if the specified dictionary entry passes the filter.
 /// </summary>
 /// <param name="entry">The entry to test.</param>
 /// <param name="exclusive">Specifies whether the search is exclusive.</param>
 /// <returns></returns>
 public bool Test(RantDictionaryEntry entry, bool exclusive = false)
 {
     return(exclusive
                         ? _items.Any() == entry.GetClasses().Any() &&
            entry.GetClasses().All(c => _items.Any(item => item.Any(rule => rule.ShouldMatch && rule.Class == c)))
                         : !_items.Any() || _items.All(set => set.Any(rule => entry.ContainsClass(rule.Class) == rule.ShouldMatch)));
 }
Example #2
0
		/// <summary>
		/// Determines if the specified dictionary entry passes the filter.
		/// </summary>
		/// <param name="entry">The entry to test.</param>
		/// <param name="exclusive">Specifies whether the search is exclusive.</param>
		/// <returns></returns>
		public bool Test(RantDictionaryEntry entry, bool exclusive = false)
		{
			return exclusive
				? _items.Any() == entry.GetClasses().Any() 
					&& entry.GetClasses().All(c => _items.Any(item => item.Any(rule => rule.ShouldMatch && rule.Class == c)))
				: !_items.Any() || _items.All(set => set.Any(rule => entry.ContainsClass(rule.Class) == rule.ShouldMatch));
		}
Example #3
0
 private bool DoTest(RantDictionaryEntry entry)
 {
     return _filterParts == null || _filterParts.All(f => entry.ContainsClass(f.Item1) == f.Item2);
 }
Example #4
0
 private bool DoTest(RantDictionaryEntry entry)
 {
     return(_filterParts == null || _filterParts.All(f => entry.ContainsClass(f.Item1) == f.Item2));
 }