GetPrimaryCompositeMapIndex() static private method

static private GetPrimaryCompositeMapIndex ( object o, int cur, int bufferPos ) : int
o object
cur int
bufferPos int
return int
 private unsafe static void Combine(StringBuilder sb, int start, int checkType)
 {
     for (int i = start; i < sb.Length; i++)
     {
         if (Normalization.QuickCheck(sb[i], checkType) != NormalizationCheck.Yes)
         {
             int num = i;
             while (i > 0)
             {
                 if (Normalization.GetCombiningClass((int)sb[i]) == 0)
                 {
                     break;
                 }
                 i--;
             }
             int num2 = 0;
             while (i < num)
             {
                 num2 = Normalization.GetPrimaryCompositeMapIndex(sb, (int)sb[i], i);
                 if (num2 > 0)
                 {
                     break;
                 }
                 i++;
             }
             if (num2 == 0)
             {
                 i = num;
             }
             else
             {
                 int primaryCompositeFromMapIndex = Normalization.GetPrimaryCompositeFromMapIndex(num2);
                 int normalizedStringLength       = Normalization.GetNormalizedStringLength(primaryCompositeFromMapIndex);
                 if (primaryCompositeFromMapIndex == 0 || normalizedStringLength == 0)
                 {
                     throw new SystemException("Internal error: should not happen. Input: " + sb);
                 }
                 int j = 0;
                 sb.Insert(i++, (char)primaryCompositeFromMapIndex);
                 while (j < normalizedStringLength)
                 {
                     if ((int)sb[i] == Normalization.mappedChars[num2 + j])
                     {
                         sb.Remove(i, 1);
                         j++;
                     }
                     else
                     {
                         i++;
                     }
                 }
                 i = num - 1;
             }
         }
     }
 }