Ejemplo n.º 1
0
    public int method_0(Paragraph A_0, Regex A_1, string A_2)
    {
        int num = 0x12;
        ParagraphItemCollection items = A_0.Items;
        string          text          = A_0.Text;
        MatchCollection matchs        = A_1.Matches(text);

        if (matchs.Count > 0)
        {
            int num2   = 0;
            int num3   = 0;
            int length = A_2.Length;
            int num5   = 0;
            int num6   = 0;
            foreach (Match match in matchs)
            {
                ParagraphBase base2;
                num5 = match.Index + num2;
                num6 = match.Length;
                num3 = length - match.Length;
                A_0.method_66(num5, num6, A_2);
                TextRange entity = null;
                int       num9   = Class191.smethod_3(A_0, num5 + 1, out base2);
                if (base2 is TextRange)
                {
                    entity = base2 as TextRange;
                }
                else if (base2 is Break)
                {
                    entity = (base2 as Break).TextRange;
                }
                int num8 = entity.StartPos + entity.TextLength;
                entity.SafeText = false;
                if (num8 > (num5 + num6))
                {
                    entity.TextLength += num3;
                }
                else
                {
                    ParagraphBase base3;
                    this.method_5(A_0, num5 + num6, num9 + 1, out base3);
                    int num10 = num5 + num6;
                    if (base3 is TextRange)
                    {
                        TextRange range2 = base3 as TextRange;
                        range2.TextLength -= num10 - range2.StartPos;
                        range2.StartPos    = num10 + num3;
                        num9++;
                    }
                    entity.TextLength = (num10 + num3) - entity.StartPos;
                }
                this.method_6(A_0, num9 + 1, num3);
                num2 += num3;
                if (base2 is Break)
                {
                    int       index  = A_0.ChildObjects.IndexOf(base2);
                    TextRange range3 = new TextRange(entity.Document)
                    {
                        StartPos   = base2.StartPos,
                        TextLength = A_2.Length
                    };
                    range3.CharacterFormat.ApplyBase(base2.CharacterFormat.method_23());
                    A_0.ChildObjects.InnerList.RemoveAt(index);
                    A_0.ChildObjects.InnerList.Insert(index, range3);
                    range3.method_0(A_0);
                    entity = range3;
                }
                else if (((entity != null) && (entity.DocumentObjectType == DocumentObjectType.TextRange)) && (entity.Text == BookmarkStart.b("㌷", num)))
                {
                    int   num11  = A_0.ChildObjects.IndexOf(entity);
                    Break @break = new Break(entity.Document)
                    {
                        StartPos = entity.StartPos
                    };
                    A_0.ChildObjects.InnerList.RemoveAt(num11);
                    A_0.ChildObjects.InnerList.Insert(num11, @break);
                    @break.method_0(A_0);
                }
                if (entity != null)
                {
                    entity.method_39();
                }
                if (A_0.Document.ReplaceFirst)
                {
                    break;
                }
            }
        }
        int count = matchs.Count;

        if (A_0.Document.ReplaceFirst && (count > 0))
        {
            return(count);
        }
        return(count + smethod_1(A_0, A_1, A_2));
    }