Ejemplo n.º 1
0
    // Token: 0x060028BE RID: 10430 RVA: 0x00448DF0 File Offset: 0x00446FF0
    public void CheckAndRePlace(char[] text, bool Accurate = false)
    {
        int num    = text.Length;
        int length = this.Pattern.Length;
        int i      = 0;

        while (i <= num - length)
        {
            int num2 = length - 1;
            while (num2 >= 0 && this.Pattern[num2] == char.ToLower(text[i + num2]))
            {
                num2--;
            }
            if (num2 < 0)
            {
                if (!Accurate || ((i == 0 || BoyerMooreStringMatcher.CheckWord(text[i - 1])) && (i + length == num || BoyerMooreStringMatcher.CheckWord(text[i + length]))))
                {
                    for (int j = 0; j < length; j++)
                    {
                        text[i + j] = '*';
                    }
                }
                i += this.goodSuffixShifts[0];
            }
            else
            {
                i += BoyerMooreStringMatcher.Max(this.goodSuffixShifts[num2], this.GetBadCharactorShift(char.ToLower(text[i + num2])) - (length - 1) + num2);
            }
        }
    }
Ejemplo n.º 2
0
    // Token: 0x060028BF RID: 10431 RVA: 0x00448EDC File Offset: 0x004470DC
    public unsafe void CheckAndRePlace(string text, bool Accurate = false)
    {
        int length  = text.Length;
        int length2 = this.Pattern.Length;
        int i       = 0;

        while (i <= length - length2)
        {
            int num = length2 - 1;
            while (num >= 0 && this.Pattern[num] == char.ToLower(text[i + num]))
            {
                num--;
            }
            if (num < 0)
            {
                if (!Accurate || ((i == 0 || BoyerMooreStringMatcher.CheckWord(text[i - 1])) && (i + length2 == length || BoyerMooreStringMatcher.CheckWord(text[i + length2]))))
                {
                    fixed(string text2 = text, ptr = text2 + RuntimeHelpers.OffsetToStringData / 2)
                    {
                        for (int j = 0; j < length2; j++)
                        {
                            ptr[i + j] = '*';
                        }
                    }
                }
                i += this.goodSuffixShifts[0];
            }
            else
            {
                i += BoyerMooreStringMatcher.Max(this.goodSuffixShifts[num], this.GetBadCharactorShift(char.ToLower(text[i + num])) - (length2 - 1) + num);
            }
        }
    }
Ejemplo n.º 3
0
    // Token: 0x060028BD RID: 10429 RVA: 0x00448D0C File Offset: 0x00446F0C
    public bool TryMatch(string text, bool Accurate = false)
    {
        int length  = text.Length;
        int length2 = this.Pattern.Length;
        int i       = 0;

        while (i <= length - length2)
        {
            int num = length2 - 1;
            while (num >= 0 && this.Pattern[num] == char.ToLower(text[i + num]))
            {
                num--;
            }
            if (num < 0)
            {
                if (!Accurate || ((i == 0 || BoyerMooreStringMatcher.CheckWord(text[i - 1])) && (i + length2 == length || BoyerMooreStringMatcher.CheckWord(text[i + length2]))))
                {
                    return(true);
                }
                i += this.goodSuffixShifts[0];
            }
            else
            {
                i += BoyerMooreStringMatcher.Max(this.goodSuffixShifts[num], this.GetBadCharactorShift(char.ToLower(text[i + num])) - (length2 - 1) + num);
            }
        }
        return(false);
    }
Ejemplo n.º 4
0
 // Token: 0x060028B8 RID: 10424 RVA: 0x00448A94 File Offset: 0x00446C94
 private static bool CheckWord(char mchar)
 {
     return(char.IsWhiteSpace(mchar) || char.IsSymbol(mchar) || char.IsPunctuation(mchar) || BoyerMooreStringMatcher.IsChinese(mchar));
 }