// Token: 0x060039B3 RID: 14771 RVA: 0x00105B0C File Offset: 0x00103D0C internal static TextRange InternalFind(ITextPointer startPosition, ITextPointer endPosition, string findPattern, CultureInfo cultureInfo, bool matchCase, bool matchWholeWord, bool matchLast, bool matchDiacritics, bool matchKashida, bool matchAlefHamza) { Invariant.Assert(startPosition.CompareTo(endPosition) <= 0); ITextPointer textPointer; LogicalDirection direction; if (matchLast) { textPointer = endPosition; direction = LogicalDirection.Backward; } else { textPointer = startPosition; direction = LogicalDirection.Forward; } int num = Math.Max(64, findPattern.Length * 2 * 2); textPointer = textPointer.CreatePointer(); while ((matchLast ? startPosition.CompareTo(textPointer) : textPointer.CompareTo(endPosition)) < 0) { ITextPointer textPointer2 = textPointer.CreatePointer(); char[] array = new char[num]; int[] array2 = new int[num + 1]; int num2 = TextFindEngine.SetFindTextAndFindTextPositionMap(startPosition, endPosition, textPointer, direction, matchLast, array, array2); if (!matchDiacritics || num2 >= findPattern.Length) { int num3 = matchLast ? (array.Length - num2) : 0; bool hasPreceedingSeparatorChar = false; bool hasFollowingSeparatorChar = false; if (matchWholeWord) { TextFindEngine.GetContextualInformation(textPointer2, matchLast ? (-array2[array2.Length - num2 - 1]) : array2[num2], out hasPreceedingSeparatorChar, out hasFollowingSeparatorChar); } string textString = new string(array, num3, num2); int num5; int num4 = TextFindEngine.FindMatchIndexFromFindContent(textString, findPattern, cultureInfo, matchCase, matchWholeWord, matchLast, matchDiacritics, matchKashida, matchAlefHamza, hasPreceedingSeparatorChar, hasFollowingSeparatorChar, out num5); if (num4 != -1) { ITextPointer textPointer3 = textPointer2.CreatePointer(); textPointer3.MoveByOffset(matchLast ? (-array2[num3 + num4]) : array2[num4]); ITextPointer textPointer4 = textPointer2.CreatePointer(); textPointer4.MoveByOffset(matchLast ? (-array2[num3 + num4 + num5]) : array2[num4 + num5]); return(new TextRange(textPointer3, textPointer4)); } if (num2 > findPattern.Length) { textPointer = textPointer2.CreatePointer(); textPointer.MoveByOffset(matchLast ? (-array2[array.Length - num2 + findPattern.Length]) : array2[num2 - findPattern.Length]); } } } return(null); }
// Token: 0x060039B5 RID: 14773 RVA: 0x00105CE8 File Offset: 0x00103EE8 private static bool HasNeighboringSeparatorChar(ITextPointer position, LogicalDirection direction) { ITextPointer textPointer = position.GetNextInsertionPosition(direction); if (textPointer == null) { return(true); } if (position.CompareTo(textPointer) > 0) { ITextPointer textPointer2 = position; position = textPointer; textPointer = textPointer2; } int offsetToPosition = position.GetOffsetToPosition(textPointer); char[] array = new char[offsetToPosition]; int[] findTextPositionMap = new int[offsetToPosition + 1]; int num = TextFindEngine.SetFindTextAndFindTextPositionMap(position, textPointer, position.CreatePointer(), LogicalDirection.Forward, false, array, findTextPositionMap); if (num == 0) { return(true); } bool result; if (direction == LogicalDirection.Forward) { result = TextFindEngine.IsSeparatorChar(array[0]); } else { result = TextFindEngine.IsSeparatorChar(array[num - 1]); } return(result); }