// Token: 0x060039B7 RID: 14775 RVA: 0x00105DC4 File Offset: 0x00103FC4 private static int StandardMatchIndexCalculation(string textString, string findPattern, bool matchWholeWord, bool matchLast, bool ignoreCase, CompareInfo compareInfo, bool hasPreceedingSeparatorChar, bool hasFollowingSeparatorChar, out int matchLength) { CompareOptions options = ignoreCase ? CompareOptions.IgnoreCase : CompareOptions.None; int num = -1; int num2 = 0; int i = textString.Length; matchLength = 0; while (i > 0) { num = (matchLast ? compareInfo.LastIndexOf(textString, findPattern, num2 + i - 1, i, options) : compareInfo.IndexOf(textString, findPattern, num2, i, options)); matchLength = findPattern.Length; if (num == -1 || !matchWholeWord || TextFindEngine.IsAtWordBoundary(textString, num, matchLength, hasPreceedingSeparatorChar, hasFollowingSeparatorChar)) { break; } if (matchLast) { num2 = 0; i = num + matchLength - 1; } else { num2 = num + 1; i = textString.Length - num2; } num = -1; } return(num); }
// Token: 0x060039B8 RID: 14776 RVA: 0x00105E50 File Offset: 0x00104050 private static int BidiIgnoreDiacriticsMatchIndexCalculation(string textString, string findPattern, bool matchKashida, bool matchAlefHamza, bool matchWholeWord, bool matchLast, bool ignoreCase, CompareInfo compareInfo, bool hasPreceedingSeparatorChar, bool hasFollowingSeparatorChar, out int matchLength) { int num = -1; int num2 = matchLast ? (textString.Length - 1) : 0; int num3 = matchLast ? -1 : textString.Length; int num4 = matchLast ? -1 : 1; if (Environment.OSVersion.Version.Major >= 6) { uint num5 = 2U; if (ignoreCase) { num5 |= 1U; } if (matchLast) { num5 |= 8388608U; } if (matchKashida) { textString = textString.Replace('ـ', '0'); findPattern = findPattern.Replace('ـ', '0'); } if (matchAlefHamza) { textString = textString.Replace('آ', '0'); textString = textString.Replace('أ', '1'); textString = textString.Replace('إ', '2'); findPattern = findPattern.Replace('آ', '0'); findPattern = findPattern.Replace('أ', '1'); findPattern = findPattern.Replace('إ', '2'); } matchLength = 0; if (matchWholeWord) { int num6 = num2; while (num == -1) { if (num6 == num3) { break; } for (int i = num6; i < textString.Length; i++) { string sourceString = textString.Substring(num6, i - num6 + 1); int num7 = TextFindEngine.FindNLSString(compareInfo.LCID, num5, sourceString, findPattern, out matchLength); if (num7 >= 0 && TextFindEngine.IsAtWordBoundary(textString, num6 + num7, matchLength, hasPreceedingSeparatorChar, hasFollowingSeparatorChar)) { num = num6 + num7; break; } } num6 += num4; } } else { num = TextFindEngine.FindNLSString(compareInfo.LCID, num5, textString, findPattern, out matchLength); } } else { CompareOptions options = CompareOptions.IgnoreNonSpace | (ignoreCase ? CompareOptions.IgnoreCase : CompareOptions.None); matchLength = 0; int num8 = num2; while (num == -1 && num8 != num3) { for (int j = num8; j < textString.Length; j++) { if (compareInfo.Compare(textString, num8, j - num8 + 1, findPattern, 0, findPattern.Length, options) == 0 && (!matchWholeWord || TextFindEngine.IsAtWordBoundary(textString, num8, j - num8 + 1, hasPreceedingSeparatorChar, hasFollowingSeparatorChar)) && (!matchKashida || TextFindEngine.IsKashidaMatch(textString.Substring(num8, j - num8 + 1), findPattern, compareInfo)) && (!matchAlefHamza || TextFindEngine.IsAlefHamzaMatch(textString.Substring(num8, j - num8 + 1), findPattern, compareInfo))) { num = num8; matchLength = j - num8 + 1; break; } } num8 += num4; } } return(num); }