/// <summary> /// Initializes a new instance of the <see cref="ConditionContext"/> class. /// </summary> /// <param name="copy">The copy.</param> internal ConditionContext(ConditionContext copy) : base(copy) { if (copy == null) { throw new ArgumentNullException("copy"); } ConditionIndex = copy.ConditionIndex; LogCategory = copy.LogCategory; CurrentCondition = copy.CurrentCondition; }
public string GetValue(string input, RuleContext context) { var startIndex = 1; for (var i = 0; i < context.Conditions.Count; i++) { var cond = context.Conditions[i]; var groupCount = cond.Pattern.GetGroupCount(input); var condContext = new ConditionContext(i, context, cond); if ((startIndex + groupCount) >= Index) { var varIndex = Math.Abs(startIndex - _index); return cond.Pattern.GetValue(cond.Test.GetValue(condContext), varIndex, condContext); } startIndex += groupCount; } return null; }
/// <summary> /// Gets the value of a condition. /// </summary> /// <param name="input"></param> /// <param name="index"></param> /// <param name="context"></param> /// <returns></returns> public string GetValue(string input, int index, ConditionContext context) { return GetValue(input, index); }