// Sees if two conditions are equal. Case insensitivity only for groupbname,eventname,action. Others the case is significant (variables, condition) public bool Equals(Condition c, StringComparison ci = StringComparison.InvariantCultureIgnoreCase) { return(GroupName.HasChars() && GroupName.Equals(c.GroupName, ci) && // groupname can be null EventName.Equals(c.EventName, ci) && Action.Equals(c.Action, ci) && ActionVars.ToString() == c.ActionVars.ToString() && ToString(false) == c.ToString(false)); }
// if field is empty/null, not considered. wildcard match of any of the fields public bool WildCardMatch(string groupname, string eventname, string actionstr, string actionvarstr, string condition, bool caseinsensitive = true) { if ((groupname.HasChars() && GroupName.HasChars() && GroupName.WildCardMatch(groupname, caseinsensitive)) || // groupname can be null (eventname.HasChars() && EventName.WildCardMatch(eventname, caseinsensitive)) || (actionstr.HasChars() && Action.WildCardMatch(actionstr, caseinsensitive)) || (actionvarstr.HasChars() && ActionVars.ToString().WildCardMatch(actionvarstr, caseinsensitive))) { return(true); } if (condition.HasChars()) { string cond = ToString(false); if (cond.WildCardMatch(condition, caseinsensitive)) { return(true); } } return(false); }