internal bool TryGetNext(out TemplateLine line, TemplateLineEvaluationResult lastResult)
 {
     bool result = false;
     line = null;
     if(lastLine != null && lastLine.HasRepeatFlag && lastResult != null)
     {
         if(lastResult.EscapeRepeat == true)
         {
             index++;
             line = GetLineForIndex();
         }
         else
         {
             line = lastLine;
         }
     }
     else
     {
         index++;
         line = GetLineForIndex();
     }
     if (line != null)
         result = true;
     return result;
 }
 internal TemplateLineEvaluationResult EvaluateLinePair(LinePair linePair)
 {
     TemplateLineEvaluationResult result = new TemplateLineEvaluationResult();
     if(linePair.TemplateLine.IsRegexPattern)
     {
         if (Regex.IsMatch(linePair.TargetLine.LineValue, linePair.TemplateLine.LineValue))
             result.Match = true;
     }
     else
     {
         if (linePair.TargetLine.LineValue == linePair.TemplateLine.LineValue)
             result.Match = true;
     }
     if (linePair.TemplateLine.HasRepeatFlag && linePair.TemplateLine.NextLine != null && linePair.TargetLine.NextLineValue != null)
     {
         if(linePair.TemplateLine.NextLine.IsRegexPattern)
         {
             if(Regex.IsMatch(linePair.TargetLine.NextLineValue, linePair.TemplateLine.NextLine.LineValue))
                 result.EscapeRepeat = true;
         }
         else
         {
             if (linePair.TargetLine.NextLineValue == linePair.TemplateLine.NextLine.LineValue)
                 result.EscapeRepeat = true;
         }
     }
     return result;
 }
Beispiel #3
0
        internal bool TryGetNext(out TemplateLine line, TemplateLineEvaluationResult lastResult)
        {
            bool result = false;

            line = null;
            if (lastLine != null && lastLine.HasRepeatFlag && lastResult != null)
            {
                if (lastResult.EscapeRepeat == true)
                {
                    index++;
                    line = GetLineForIndex();
                }
                else
                {
                    line = lastLine;
                }
            }
            else
            {
                index++;
                line = GetLineForIndex();
            }
            if (line != null)
            {
                result = true;
            }
            return(result);
        }
        internal TemplateLineEvaluationResult EvaluateLinePair(LinePair linePair)
        {
            TemplateLineEvaluationResult result = new TemplateLineEvaluationResult();

            if (linePair.TemplateLine.IsRegexPattern)
            {
                if (Regex.IsMatch(linePair.TargetLine.LineValue, linePair.TemplateLine.LineValue))
                {
                    result.Match = true;
                }
            }
            else
            {
                if (linePair.TargetLine.LineValue == linePair.TemplateLine.LineValue)
                {
                    result.Match = true;
                }
            }
            if (linePair.TemplateLine.HasRepeatFlag && linePair.TemplateLine.NextLine != null && linePair.TargetLine.NextLineValue != null)
            {
                if (linePair.TemplateLine.NextLine.IsRegexPattern)
                {
                    if (Regex.IsMatch(linePair.TargetLine.NextLineValue, linePair.TemplateLine.NextLine.LineValue))
                    {
                        result.EscapeRepeat = true;
                    }
                }
                else
                {
                    if (linePair.TargetLine.NextLineValue == linePair.TemplateLine.NextLine.LineValue)
                    {
                        result.EscapeRepeat = true;
                    }
                }
            }
            return(result);
        }