示例#1
0
        private bool MatchWordWithHref(int iChildWordIndex, int iParentWordIndex)
        {
            TextRun textRun = this.ChildScanner.Words[iChildWordIndex];
            TextRun right   = this.ParentScanner.Words[iParentWordIndex];
            int     num;
            int     num2;

            return(BodyDiffer.GetHrefTagIndex(textRun, out num, out num2) && BodyDiffer.IsSameWord(textRun, right, 0, num, 0, num) && BodyDiffer.IsSameWord(textRun, right, num2 + 1, textRun.WordLength, num, right.WordLength));
        }
示例#2
0
        private bool MatchWord(ref int childWordIndex, ref int parentWordIndex, bool forwardMatch, int recursionLevel)
        {
            int num = forwardMatch ? 1 : -1;

            if (recursionLevel > 5)
            {
                return(false);
            }
            if (childWordIndex >= this.childBodyFragment.EndWordIndex || parentWordIndex >= this.parentBodyFragment.EndWordIndex || childWordIndex < 0 || parentWordIndex < 0)
            {
                return(false);
            }
            if (BodyDiffer.IsSameWord(this.ParentScanner.Words[parentWordIndex], this.ChildScanner.Words[childWordIndex]))
            {
                return(true);
            }
            int num5;
            int num6;

            if (this.IsHrefBeginText(childWordIndex, forwardMatch))
            {
                int num2 = this.HrefTextEndIndex(childWordIndex, forwardMatch);
                if (this.MatchWord(ref num2, ref parentWordIndex, forwardMatch, recursionLevel + 1))
                {
                    childWordIndex = num2;
                    return(true);
                }
            }
            else if (this.IsHorizontalLine(this.ChildScanner.Words[childWordIndex]))
            {
                int num3 = childWordIndex + num;
                if (this.MatchWord(ref num3, ref parentWordIndex, forwardMatch, recursionLevel + 1))
                {
                    childWordIndex = num3;
                    return(true);
                }
            }
            else if (this.IsHorizontalLine(this.ParentScanner.Words[parentWordIndex]))
            {
                int num4 = parentWordIndex + num;
                if (this.MatchWord(ref childWordIndex, ref num4, forwardMatch, recursionLevel + 1))
                {
                    parentWordIndex = num4;
                    return(true);
                }
            }
            else if (BodyDiffer.GetHrefTagIndex(this.ChildScanner.Words[childWordIndex], out num5, out num6))
            {
                if (num5 == 0)
                {
                    int num7 = childWordIndex + num;
                    if (this.MatchWord(ref num7, ref parentWordIndex, forwardMatch, recursionLevel + 1))
                    {
                        childWordIndex = num7;
                        return(true);
                    }
                }
                else if (this.MatchWordWithHref(childWordIndex, parentWordIndex))
                {
                    return(true);
                }
            }
            else if (this.ChildScanner.Words[childWordIndex].WordLength == 1 && this.ChildScanner.Words[childWordIndex].GetWordChar(0) == '>')
            {
                int num8 = childWordIndex + num;
                if (this.MatchWord(ref num8, ref parentWordIndex, forwardMatch, recursionLevel + 1))
                {
                    childWordIndex = num8;
                    return(true);
                }
            }
            else if (BodyDiffer.IsListNumberOrBullet(this.ChildScanner.Words[childWordIndex]))
            {
                int num9 = childWordIndex + num;
                if (this.MatchWord(ref num9, ref parentWordIndex, forwardMatch, recursionLevel + 1))
                {
                    childWordIndex = num9;
                    return(true);
                }
            }
            else if (BodyDiffer.IsListNumberOrBullet(this.ParentScanner.Words[parentWordIndex]))
            {
                int num10 = parentWordIndex + num;
                if (this.MatchWord(ref childWordIndex, ref num10, forwardMatch, recursionLevel + 1))
                {
                    parentWordIndex = num10;
                    return(true);
                }
            }
            return(false);
        }