public void AddRule(string ruleName, Tag tag, int bansForTrigger, int timeoutsForTrigger, ChannelRuleAction channelRuleAction) { if (channelRules == null) { channelRules = new List <ChannelRule>(); } // we might need to add a check if there is an equivelant rule? (No need to have two that does the exact same) var newRule = new ChannelRule(ruleName, tag, bansForTrigger, timeoutsForTrigger, channelRuleAction); channelRules.Add(newRule); }
public bool Exceeds(ChannelRule rule) { var bannedTagCount = BanTagCounts.Find(x => x.Tag.TagId == rule.Tag.TagId); if (bannedTagCount != null && bannedTagCount.Count >= rule.BansForTrigger && rule.BansForTrigger != 0) { return(true); } var timedoutTagCount = TimeoutTagCounts.Find(x => x.Tag.TagId == rule.Tag.TagId); return(timedoutTagCount != null && timedoutTagCount.Count >= rule.TimeoutsForTrigger && rule.TimeoutsForTrigger != 0); }