/// <summary> /// Gets the rules that match the current state of the session. /// </summary> /// <returns></returns> public async Task <IEnumerable <ISkraprRule> > GetMatchingRules() { var frameState = await DevTools.GetCurrentFrameState(); var matchingRules = new List <ISkraprRule>(); var availableRules = Definition.Rules .Where(r => r.Max.HasValue == false || r.Max.Value > 0); foreach (var rule in availableRules) { var ruleResult = await rule.IsMatch(frameState); if (ruleResult == true) { matchingRules.Add(rule); } } return(matchingRules); }