scripts
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x0200007E RID: 126
|
||||
internal class CodePointIndexer
|
||||
{
|
||||
// Token: 0x06000789 RID: 1929 RVA: 0x00017D80 File Offset: 0x00015F80
|
||||
public CodePointIndexer(int[] starts, int[] ends, int defaultIndex, int defaultCP)
|
||||
{
|
||||
this.defaultIndex = defaultIndex;
|
||||
this.defaultCP = defaultCP;
|
||||
this.ranges = new CodePointIndexer.TableRange[starts.Length];
|
||||
for (int i = 0; i < this.ranges.Length; i++)
|
||||
{
|
||||
this.ranges[i] = new CodePointIndexer.TableRange(starts[i], ends[i], (i != 0) ? (this.ranges[i - 1].IndexStart + this.ranges[i - 1].Count) : 0);
|
||||
}
|
||||
for (int j = 0; j < this.ranges.Length; j++)
|
||||
{
|
||||
this.TotalCount += this.ranges[j].Count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600078A RID: 1930 RVA: 0x00017E50 File Offset: 0x00016050
|
||||
public static Array CompressArray(Array source, Type type, CodePointIndexer indexer)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 0; i < indexer.ranges.Length; i++)
|
||||
{
|
||||
num += indexer.ranges[i].Count;
|
||||
}
|
||||
Array array = Array.CreateInstance(type, num);
|
||||
for (int j = 0; j < indexer.ranges.Length; j++)
|
||||
{
|
||||
Array.Copy(source, indexer.ranges[j].Start, array, indexer.ranges[j].IndexStart, indexer.ranges[j].Count);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600078B RID: 1931 RVA: 0x00017EE8 File Offset: 0x000160E8
|
||||
public int ToIndex(int cp)
|
||||
{
|
||||
for (int i = 0; i < this.ranges.Length; i++)
|
||||
{
|
||||
if (cp < this.ranges[i].Start)
|
||||
{
|
||||
return this.defaultIndex;
|
||||
}
|
||||
if (cp < this.ranges[i].End)
|
||||
{
|
||||
return cp - this.ranges[i].Start + this.ranges[i].IndexStart;
|
||||
}
|
||||
}
|
||||
return this.defaultIndex;
|
||||
}
|
||||
|
||||
// Token: 0x0600078C RID: 1932 RVA: 0x00017F70 File Offset: 0x00016170
|
||||
public int ToCodePoint(int i)
|
||||
{
|
||||
for (int j = 0; j < this.ranges.Length; j++)
|
||||
{
|
||||
if (i < this.ranges[j].IndexStart)
|
||||
{
|
||||
return this.defaultCP;
|
||||
}
|
||||
if (i < this.ranges[j].IndexEnd)
|
||||
{
|
||||
return i - this.ranges[j].IndexStart + this.ranges[j].Start;
|
||||
}
|
||||
}
|
||||
return this.defaultCP;
|
||||
}
|
||||
|
||||
// Token: 0x04000116 RID: 278
|
||||
private readonly CodePointIndexer.TableRange[] ranges;
|
||||
|
||||
// Token: 0x04000117 RID: 279
|
||||
public readonly int TotalCount;
|
||||
|
||||
// Token: 0x04000118 RID: 280
|
||||
private int defaultIndex;
|
||||
|
||||
// Token: 0x04000119 RID: 281
|
||||
private int defaultCP;
|
||||
|
||||
// Token: 0x0200007F RID: 127
|
||||
[Serializable]
|
||||
internal struct TableRange
|
||||
{
|
||||
// Token: 0x0600078D RID: 1933 RVA: 0x00017FF8 File Offset: 0x000161F8
|
||||
public TableRange(int start, int end, int indexStart)
|
||||
{
|
||||
this.Start = start;
|
||||
this.End = end;
|
||||
this.Count = this.End - this.Start;
|
||||
this.IndexStart = indexStart;
|
||||
this.IndexEnd = this.IndexStart + this.Count;
|
||||
}
|
||||
|
||||
// Token: 0x0400011A RID: 282
|
||||
public readonly int Start;
|
||||
|
||||
// Token: 0x0400011B RID: 283
|
||||
public readonly int End;
|
||||
|
||||
// Token: 0x0400011C RID: 284
|
||||
public readonly int Count;
|
||||
|
||||
// Token: 0x0400011D RID: 285
|
||||
public readonly int IndexStart;
|
||||
|
||||
// Token: 0x0400011E RID: 286
|
||||
public readonly int IndexEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000081 RID: 129
|
||||
internal class Contraction
|
||||
{
|
||||
// Token: 0x0600078F RID: 1935 RVA: 0x00018060 File Offset: 0x00016260
|
||||
public Contraction(char[] source, string replacement, byte[] sortkey)
|
||||
{
|
||||
this.Source = source;
|
||||
this.Replacement = replacement;
|
||||
this.SortKey = sortkey;
|
||||
}
|
||||
|
||||
// Token: 0x04000123 RID: 291
|
||||
public readonly char[] Source;
|
||||
|
||||
// Token: 0x04000124 RID: 292
|
||||
public readonly string Replacement;
|
||||
|
||||
// Token: 0x04000125 RID: 293
|
||||
public readonly byte[] SortKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000082 RID: 130
|
||||
internal class ContractionComparer : IComparer
|
||||
{
|
||||
// Token: 0x06000792 RID: 1938 RVA: 0x00018094 File Offset: 0x00016294
|
||||
public int Compare(object o1, object o2)
|
||||
{
|
||||
Contraction contraction = (Contraction)o1;
|
||||
Contraction contraction2 = (Contraction)o2;
|
||||
char[] source = contraction.Source;
|
||||
char[] source2 = contraction2.Source;
|
||||
int num = ((source.Length <= source2.Length) ? source.Length : source2.Length);
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
if (source[i] != source2[i])
|
||||
{
|
||||
return (int)(source[i] - source2[i]);
|
||||
}
|
||||
}
|
||||
return source.Length - source2.Length;
|
||||
}
|
||||
|
||||
// Token: 0x04000126 RID: 294
|
||||
public static readonly ContractionComparer Instance = new ContractionComparer();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000083 RID: 131
|
||||
internal class Level2Map
|
||||
{
|
||||
// Token: 0x06000793 RID: 1939 RVA: 0x0001810C File Offset: 0x0001630C
|
||||
public Level2Map(byte source, byte replace)
|
||||
{
|
||||
this.Source = source;
|
||||
this.Replace = replace;
|
||||
}
|
||||
|
||||
// Token: 0x04000127 RID: 295
|
||||
public byte Source;
|
||||
|
||||
// Token: 0x04000128 RID: 296
|
||||
public byte Replace;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000084 RID: 132
|
||||
internal class Level2MapComparer : IComparer
|
||||
{
|
||||
// Token: 0x06000796 RID: 1942 RVA: 0x00018138 File Offset: 0x00016338
|
||||
public int Compare(object o1, object o2)
|
||||
{
|
||||
Level2Map level2Map = (Level2Map)o1;
|
||||
Level2Map level2Map2 = (Level2Map)o2;
|
||||
return (int)(level2Map.Source - level2Map2.Source);
|
||||
}
|
||||
|
||||
// Token: 0x04000129 RID: 297
|
||||
public static readonly Level2MapComparer Instance = new Level2MapComparer();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,686 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000085 RID: 133
|
||||
internal class MSCompatUnicodeTable
|
||||
{
|
||||
// Token: 0x06000798 RID: 1944 RVA: 0x00018168 File Offset: 0x00016368
|
||||
unsafe static MSCompatUnicodeTable()
|
||||
{
|
||||
IntPtr intPtr = MSCompatUnicodeTable.GetResource("collation.core.bin");
|
||||
if (intPtr == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
byte* ptr = (byte*)(void*)intPtr;
|
||||
intPtr = MSCompatUnicodeTable.GetResource("collation.tailoring.bin");
|
||||
if (intPtr == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
byte* ptr2 = (byte*)(void*)intPtr;
|
||||
if (ptr == null || ptr2 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (*ptr != 3 || *ptr2 != 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint num = 1U;
|
||||
uint num2 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.ignorableFlags = ptr + num;
|
||||
num += num2;
|
||||
num2 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.categories = ptr + num;
|
||||
num += num2;
|
||||
num2 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.level1 = ptr + num;
|
||||
num += num2;
|
||||
num2 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.level2 = ptr + num;
|
||||
num += num2;
|
||||
num2 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.level3 = ptr + num;
|
||||
num += num2;
|
||||
num = 1U;
|
||||
uint num3 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr2, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.tailoringInfos = new TailoringInfo[num3];
|
||||
int num4 = 0;
|
||||
while ((long)num4 < (long)((ulong)num3))
|
||||
{
|
||||
int num5 = (int)MSCompatUnicodeTable.UInt32FromBytePtr(ptr2, num);
|
||||
num += 4U;
|
||||
int num6 = (int)MSCompatUnicodeTable.UInt32FromBytePtr(ptr2, num);
|
||||
num += 4U;
|
||||
int num7 = (int)MSCompatUnicodeTable.UInt32FromBytePtr(ptr2, num);
|
||||
num += 4U;
|
||||
TailoringInfo tailoringInfo = new TailoringInfo(num5, num6, num7, ptr2[(UIntPtr)(num++)] != 0);
|
||||
MSCompatUnicodeTable.tailoringInfos[num4] = tailoringInfo;
|
||||
num4++;
|
||||
}
|
||||
num += 2U;
|
||||
num3 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr2, num);
|
||||
num += 4U;
|
||||
MSCompatUnicodeTable.tailoringArr = new char[num3];
|
||||
int num8 = 0;
|
||||
while ((long)num8 < (long)((ulong)num3))
|
||||
{
|
||||
MSCompatUnicodeTable.tailoringArr[num8] = (char)((int)ptr2[num] + ((int)ptr2[num + 1U] << 8));
|
||||
num8++;
|
||||
num += 2U;
|
||||
}
|
||||
MSCompatUnicodeTable.isReady = true;
|
||||
}
|
||||
|
||||
// Token: 0x06000799 RID: 1945 RVA: 0x0001834C File Offset: 0x0001654C
|
||||
public static TailoringInfo GetTailoringInfo(int lcid)
|
||||
{
|
||||
for (int i = 0; i < MSCompatUnicodeTable.tailoringInfos.Length; i++)
|
||||
{
|
||||
if (MSCompatUnicodeTable.tailoringInfos[i].LCID == lcid)
|
||||
{
|
||||
return MSCompatUnicodeTable.tailoringInfos[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x0600079A RID: 1946 RVA: 0x0001838C File Offset: 0x0001658C
|
||||
public unsafe static void BuildTailoringTables(CultureInfo culture, TailoringInfo t, ref Contraction[] contractions, ref Level2Map[] diacriticals)
|
||||
{
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
fixed (char* ptr = (ref MSCompatUnicodeTable.tailoringArr != null && MSCompatUnicodeTable.tailoringArr.Length != 0 ? ref MSCompatUnicodeTable.tailoringArr[0] : ref *null))
|
||||
{
|
||||
int i = t.TailoringIndex;
|
||||
int num = i + t.TailoringCount;
|
||||
while (i < num)
|
||||
{
|
||||
int num2 = i + 1;
|
||||
switch (ptr[i])
|
||||
{
|
||||
case '\u0001':
|
||||
{
|
||||
i++;
|
||||
while (ptr[num2] != '\0')
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
char[] array = new char[num2 - i];
|
||||
Marshal.Copy((IntPtr)((void*)(ptr + i)), array, 0, num2 - i);
|
||||
byte[] array2 = new byte[4];
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
array2[j] = (byte)ptr[num2 + 1 + j];
|
||||
}
|
||||
arrayList.Add(new Contraction(array, null, array2));
|
||||
i = num2 + 6;
|
||||
break;
|
||||
}
|
||||
case '\u0002':
|
||||
arrayList2.Add(new Level2Map((byte)ptr[i + 1], (byte)ptr[i + 2]));
|
||||
i += 3;
|
||||
break;
|
||||
case '\u0003':
|
||||
{
|
||||
i++;
|
||||
while (ptr[num2] != '\0')
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
char[] array = new char[num2 - i];
|
||||
Marshal.Copy((IntPtr)((void*)(ptr + i)), array, 0, num2 - i);
|
||||
num2++;
|
||||
int num3 = num2;
|
||||
while (ptr[num3] != '\0')
|
||||
{
|
||||
num3++;
|
||||
}
|
||||
string text = new string(ptr, num2, num3 - num2);
|
||||
arrayList.Add(new Contraction(array, text, null));
|
||||
i = num3 + 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new NotImplementedException(string.Format("Mono INTERNAL ERROR (Should not happen): Collation tailoring table is broken for culture {0} ({1}) at 0x{2:X}", culture.LCID, culture.Name, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
arrayList.Sort(ContractionComparer.Instance);
|
||||
arrayList2.Sort(Level2MapComparer.Instance);
|
||||
contractions = arrayList.ToArray(typeof(Contraction)) as Contraction[];
|
||||
diacriticals = arrayList2.ToArray(typeof(Level2Map)) as Level2Map[];
|
||||
}
|
||||
|
||||
// Token: 0x0600079B RID: 1947 RVA: 0x000185BC File Offset: 0x000167BC
|
||||
private unsafe static void SetCJKReferences(string name, ref CodePointIndexer cjkIndexer, ref byte* catTable, ref byte* lv1Table, ref CodePointIndexer lv2Indexer, ref byte* lv2Table)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "zh-CHS":
|
||||
catTable = MSCompatUnicodeTable.cjkCHScategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkCHSlv1;
|
||||
cjkIndexer = MSCompatUnicodeTableUtil.CjkCHS;
|
||||
break;
|
||||
case "zh-CHT":
|
||||
catTable = MSCompatUnicodeTable.cjkCHTcategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkCHTlv1;
|
||||
cjkIndexer = MSCompatUnicodeTableUtil.Cjk;
|
||||
break;
|
||||
case "ja":
|
||||
catTable = MSCompatUnicodeTable.cjkJAcategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkJAlv1;
|
||||
cjkIndexer = MSCompatUnicodeTableUtil.Cjk;
|
||||
break;
|
||||
case "ko":
|
||||
catTable = MSCompatUnicodeTable.cjkKOcategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkKOlv1;
|
||||
lv2Table = MSCompatUnicodeTable.cjkKOlv2;
|
||||
cjkIndexer = MSCompatUnicodeTableUtil.Cjk;
|
||||
lv2Indexer = MSCompatUnicodeTableUtil.Cjk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600079C RID: 1948 RVA: 0x000186C0 File Offset: 0x000168C0
|
||||
public unsafe static byte Category(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.categories[MSCompatUnicodeTableUtil.Category.ToIndex(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x0600079D RID: 1949 RVA: 0x000186D4 File Offset: 0x000168D4
|
||||
public unsafe static byte Level1(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.level1[MSCompatUnicodeTableUtil.Level1.ToIndex(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x0600079E RID: 1950 RVA: 0x000186E8 File Offset: 0x000168E8
|
||||
public unsafe static byte Level2(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.level2[MSCompatUnicodeTableUtil.Level2.ToIndex(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x0600079F RID: 1951 RVA: 0x000186FC File Offset: 0x000168FC
|
||||
public unsafe static byte Level3(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.level3[MSCompatUnicodeTableUtil.Level3.ToIndex(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x060007A0 RID: 1952 RVA: 0x00018710 File Offset: 0x00016910
|
||||
public static bool IsSortable(string s)
|
||||
{
|
||||
foreach (char c in s)
|
||||
{
|
||||
if (!MSCompatUnicodeTable.IsSortable((int)c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060007A1 RID: 1953 RVA: 0x0001874C File Offset: 0x0001694C
|
||||
public static bool IsSortable(int cp)
|
||||
{
|
||||
return !MSCompatUnicodeTable.IsIgnorable(cp) || cp == 0 || cp == 1600 || cp == 65279 || (6155 <= cp && cp <= 6158) || (8204 <= cp && cp <= 8207) || (8234 <= cp && cp <= 8238) || (8298 <= cp && cp <= 8303) || (8204 <= cp && cp <= 8207) || (65529 <= cp && cp <= 65533);
|
||||
}
|
||||
|
||||
// Token: 0x060007A2 RID: 1954 RVA: 0x00018818 File Offset: 0x00016A18
|
||||
public static bool IsIgnorable(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.IsIgnorable(cp, 1);
|
||||
}
|
||||
|
||||
// Token: 0x060007A3 RID: 1955 RVA: 0x00018824 File Offset: 0x00016A24
|
||||
public unsafe static bool IsIgnorable(int cp, byte flag)
|
||||
{
|
||||
if (cp == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((flag & 1) != 0)
|
||||
{
|
||||
UnicodeCategory unicodeCategory = char.GetUnicodeCategory((char)cp);
|
||||
if (unicodeCategory == UnicodeCategory.OtherNotAssigned)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (55424 <= cp && cp < 56192)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
int num = MSCompatUnicodeTableUtil.Ignorable.ToIndex(cp);
|
||||
return num >= 0 && (MSCompatUnicodeTable.ignorableFlags[num] & flag) != 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007A4 RID: 1956 RVA: 0x00018894 File Offset: 0x00016A94
|
||||
public static bool IsIgnorableSymbol(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.IsIgnorable(cp, 2);
|
||||
}
|
||||
|
||||
// Token: 0x060007A5 RID: 1957 RVA: 0x000188A0 File Offset: 0x00016AA0
|
||||
public static bool IsIgnorableNonSpacing(int cp)
|
||||
{
|
||||
return MSCompatUnicodeTable.IsIgnorable(cp, 4);
|
||||
}
|
||||
|
||||
// Token: 0x060007A6 RID: 1958 RVA: 0x000188AC File Offset: 0x00016AAC
|
||||
public static int ToKanaTypeInsensitive(int i)
|
||||
{
|
||||
return (12353 > i || i > 12436) ? i : (i + 96);
|
||||
}
|
||||
|
||||
// Token: 0x060007A7 RID: 1959 RVA: 0x000188DC File Offset: 0x00016ADC
|
||||
public static int ToWidthCompat(int i)
|
||||
{
|
||||
if (i < 8592)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
if (i > 65280)
|
||||
{
|
||||
if (i <= 65374)
|
||||
{
|
||||
return i - 65280 + 32;
|
||||
}
|
||||
switch (i)
|
||||
{
|
||||
case 65504:
|
||||
return 162;
|
||||
case 65505:
|
||||
return 163;
|
||||
case 65506:
|
||||
return 172;
|
||||
case 65507:
|
||||
return 175;
|
||||
case 65508:
|
||||
return 166;
|
||||
case 65509:
|
||||
return 165;
|
||||
case 65510:
|
||||
return 8361;
|
||||
}
|
||||
}
|
||||
if (i > 13054)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
if (i <= 8595)
|
||||
{
|
||||
return 56921 + i;
|
||||
}
|
||||
if (i < 9474)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
if (i <= 9675)
|
||||
{
|
||||
if (i == 9474)
|
||||
{
|
||||
return 65512;
|
||||
}
|
||||
if (i == 9632)
|
||||
{
|
||||
return 65517;
|
||||
}
|
||||
if (i != 9675)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
return 65518;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i < 12288)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
if (i < 12593)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 12288:
|
||||
return 32;
|
||||
case 12289:
|
||||
return 65380;
|
||||
case 12290:
|
||||
return 65377;
|
||||
default:
|
||||
if (i == 12300)
|
||||
{
|
||||
return 65378;
|
||||
}
|
||||
if (i == 12301)
|
||||
{
|
||||
return 65379;
|
||||
}
|
||||
if (i != 12539)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
return 65381;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i < 12644)
|
||||
{
|
||||
return i - 12592 + 65440;
|
||||
}
|
||||
if (i == 12644)
|
||||
{
|
||||
return 65440;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007A8 RID: 1960 RVA: 0x00018A8C File Offset: 0x00016C8C
|
||||
public static bool HasSpecialWeight(char c)
|
||||
{
|
||||
if (c < 'ぁ')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ('ヲ' <= c && c < '゙')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ('㌀' <= c)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c < 'ゝ')
|
||||
{
|
||||
return c < '\u3099';
|
||||
}
|
||||
if (c < '\u3100')
|
||||
{
|
||||
return c != '・';
|
||||
}
|
||||
return c >= '㋐' && c < '㋿';
|
||||
}
|
||||
|
||||
// Token: 0x060007A9 RID: 1961 RVA: 0x00018B14 File Offset: 0x00016D14
|
||||
public static byte GetJapaneseDashType(char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'ー':
|
||||
return 5;
|
||||
case 'ヽ':
|
||||
case 'ヾ':
|
||||
break;
|
||||
default:
|
||||
if (c != 'ゝ' && c != 'ゞ' && c != 'ー')
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
// Token: 0x060007AA RID: 1962 RVA: 0x00018B68 File Offset: 0x00016D68
|
||||
public static bool IsHalfWidthKana(char c)
|
||||
{
|
||||
return 'ヲ' <= c && c <= 'ン';
|
||||
}
|
||||
|
||||
// Token: 0x060007AB RID: 1963 RVA: 0x00018B84 File Offset: 0x00016D84
|
||||
public static bool IsHiragana(char c)
|
||||
{
|
||||
return 'ぁ' <= c && c <= 'ゔ';
|
||||
}
|
||||
|
||||
// Token: 0x060007AC RID: 1964 RVA: 0x00018BA0 File Offset: 0x00016DA0
|
||||
public static bool IsJapaneseSmallLetter(char c)
|
||||
{
|
||||
if ('ァ' <= c && c <= 'ッ')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ('\u3040' < c && c < 'ヺ')
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'ぁ':
|
||||
case 'ぃ':
|
||||
case 'ぅ':
|
||||
case 'ぇ':
|
||||
case 'ぉ':
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'ァ':
|
||||
case 'ィ':
|
||||
case 'ゥ':
|
||||
case 'ェ':
|
||||
case 'ォ':
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'ゃ':
|
||||
case 'ゅ':
|
||||
case 'ょ':
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'ャ':
|
||||
case 'ュ':
|
||||
case 'ョ':
|
||||
break;
|
||||
default:
|
||||
if (c != 'ヵ' && c != 'ヶ' && c != 'っ' && c != 'ゎ' && c != 'ッ' && c != 'ヮ')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x170000DC RID: 220
|
||||
// (get) Token: 0x060007AD RID: 1965 RVA: 0x00018CC8 File Offset: 0x00016EC8
|
||||
public static bool IsReady
|
||||
{
|
||||
get
|
||||
{
|
||||
return MSCompatUnicodeTable.isReady;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007AE RID: 1966 RVA: 0x00018CD0 File Offset: 0x00016ED0
|
||||
private static IntPtr GetResource(string name)
|
||||
{
|
||||
int num;
|
||||
Module module;
|
||||
return Assembly.GetExecutingAssembly().GetManifestResourceInternal(name, out num, out module);
|
||||
}
|
||||
|
||||
// Token: 0x060007AF RID: 1967 RVA: 0x00018CEC File Offset: 0x00016EEC
|
||||
private unsafe static uint UInt32FromBytePtr(byte* raw, uint idx)
|
||||
{
|
||||
return (uint)((int)raw[idx] + ((int)raw[idx + 1U] << 8) + ((int)raw[idx + 2U] << 16) + ((int)raw[idx + 3U] << 24));
|
||||
}
|
||||
|
||||
// Token: 0x060007B0 RID: 1968 RVA: 0x00018D14 File Offset: 0x00016F14
|
||||
public unsafe static void FillCJK(string culture, ref CodePointIndexer cjkIndexer, ref byte* catTable, ref byte* lv1Table, ref CodePointIndexer lv2Indexer, ref byte* lv2Table)
|
||||
{
|
||||
object obj = MSCompatUnicodeTable.forLock;
|
||||
lock (obj)
|
||||
{
|
||||
MSCompatUnicodeTable.FillCJKCore(culture, ref cjkIndexer, ref catTable, ref lv1Table, ref lv2Indexer, ref lv2Table);
|
||||
MSCompatUnicodeTable.SetCJKReferences(culture, ref cjkIndexer, ref catTable, ref lv1Table, ref lv2Indexer, ref lv2Table);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007B1 RID: 1969 RVA: 0x00018D70 File Offset: 0x00016F70
|
||||
private unsafe static void FillCJKCore(string culture, ref CodePointIndexer cjkIndexer, ref byte* catTable, ref byte* lv1Table, ref CodePointIndexer cjkLv2Indexer, ref byte* lv2Table)
|
||||
{
|
||||
if (!MSCompatUnicodeTable.IsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string text = null;
|
||||
switch (culture)
|
||||
{
|
||||
case "zh-CHS":
|
||||
text = "cjkCHS";
|
||||
catTable = MSCompatUnicodeTable.cjkCHScategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkCHSlv1;
|
||||
break;
|
||||
case "zh-CHT":
|
||||
text = "cjkCHT";
|
||||
catTable = MSCompatUnicodeTable.cjkCHTcategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkCHTlv1;
|
||||
break;
|
||||
case "ja":
|
||||
text = "cjkJA";
|
||||
catTable = MSCompatUnicodeTable.cjkJAcategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkJAlv1;
|
||||
break;
|
||||
case "ko":
|
||||
text = "cjkKO";
|
||||
catTable = MSCompatUnicodeTable.cjkKOcategory;
|
||||
lv1Table = MSCompatUnicodeTable.cjkKOlv1;
|
||||
break;
|
||||
}
|
||||
if (text == null || lv1Table != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint num2 = 0U;
|
||||
string text2 = string.Format("collation.{0}.bin", text);
|
||||
IntPtr intPtr = MSCompatUnicodeTable.GetResource(text2);
|
||||
if (intPtr == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
byte* ptr = (byte*)(void*)intPtr;
|
||||
num2 += 1U;
|
||||
uint num3 = MSCompatUnicodeTable.UInt32FromBytePtr(ptr, num2);
|
||||
num2 += 4U;
|
||||
catTable = ptr + num2;
|
||||
lv1Table = ptr + num2 + num3;
|
||||
switch (culture)
|
||||
{
|
||||
case "zh-CHS":
|
||||
MSCompatUnicodeTable.cjkCHScategory = catTable;
|
||||
MSCompatUnicodeTable.cjkCHSlv1 = lv1Table;
|
||||
break;
|
||||
case "zh-CHT":
|
||||
MSCompatUnicodeTable.cjkCHTcategory = catTable;
|
||||
MSCompatUnicodeTable.cjkCHTlv1 = lv1Table;
|
||||
break;
|
||||
case "ja":
|
||||
MSCompatUnicodeTable.cjkJAcategory = catTable;
|
||||
MSCompatUnicodeTable.cjkJAlv1 = lv1Table;
|
||||
break;
|
||||
case "ko":
|
||||
MSCompatUnicodeTable.cjkKOcategory = catTable;
|
||||
MSCompatUnicodeTable.cjkKOlv1 = lv1Table;
|
||||
break;
|
||||
}
|
||||
if (text != "cjkKO")
|
||||
{
|
||||
return;
|
||||
}
|
||||
intPtr = MSCompatUnicodeTable.GetResource("collation.cjkKOlv2.bin");
|
||||
if (intPtr == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ptr = (byte*)(void*)intPtr;
|
||||
num2 = 5U;
|
||||
MSCompatUnicodeTable.cjkKOlv2 = ptr + num2;
|
||||
lv2Table = MSCompatUnicodeTable.cjkKOlv2;
|
||||
}
|
||||
|
||||
// Token: 0x0400012A RID: 298
|
||||
private const int ResourceVersionSize = 1;
|
||||
|
||||
// Token: 0x0400012B RID: 299
|
||||
public static int MaxExpansionLength = 3;
|
||||
|
||||
// Token: 0x0400012C RID: 300
|
||||
private unsafe static readonly byte* ignorableFlags;
|
||||
|
||||
// Token: 0x0400012D RID: 301
|
||||
private unsafe static readonly byte* categories;
|
||||
|
||||
// Token: 0x0400012E RID: 302
|
||||
private unsafe static readonly byte* level1;
|
||||
|
||||
// Token: 0x0400012F RID: 303
|
||||
private unsafe static readonly byte* level2;
|
||||
|
||||
// Token: 0x04000130 RID: 304
|
||||
private unsafe static readonly byte* level3;
|
||||
|
||||
// Token: 0x04000131 RID: 305
|
||||
private unsafe static byte* cjkCHScategory;
|
||||
|
||||
// Token: 0x04000132 RID: 306
|
||||
private unsafe static byte* cjkCHTcategory;
|
||||
|
||||
// Token: 0x04000133 RID: 307
|
||||
private unsafe static byte* cjkJAcategory;
|
||||
|
||||
// Token: 0x04000134 RID: 308
|
||||
private unsafe static byte* cjkKOcategory;
|
||||
|
||||
// Token: 0x04000135 RID: 309
|
||||
private unsafe static byte* cjkCHSlv1;
|
||||
|
||||
// Token: 0x04000136 RID: 310
|
||||
private unsafe static byte* cjkCHTlv1;
|
||||
|
||||
// Token: 0x04000137 RID: 311
|
||||
private unsafe static byte* cjkJAlv1;
|
||||
|
||||
// Token: 0x04000138 RID: 312
|
||||
private unsafe static byte* cjkKOlv1;
|
||||
|
||||
// Token: 0x04000139 RID: 313
|
||||
private unsafe static byte* cjkKOlv2;
|
||||
|
||||
// Token: 0x0400013A RID: 314
|
||||
private static readonly char[] tailoringArr;
|
||||
|
||||
// Token: 0x0400013B RID: 315
|
||||
private static readonly TailoringInfo[] tailoringInfos;
|
||||
|
||||
// Token: 0x0400013C RID: 316
|
||||
private static object forLock = new object();
|
||||
|
||||
// Token: 0x0400013D RID: 317
|
||||
public static readonly bool isReady;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000086 RID: 134
|
||||
internal class MSCompatUnicodeTableUtil
|
||||
{
|
||||
// Token: 0x060007B3 RID: 1971 RVA: 0x00018FF8 File Offset: 0x000171F8
|
||||
static MSCompatUnicodeTableUtil()
|
||||
{
|
||||
int[] array = new int[] { 0, 40960, 63744 };
|
||||
int[] array2 = new int[] { 13312, 42240, 65536 };
|
||||
int[] array3 = new int[] { 0, 7680, 12288, 19968, 44032, 63744 };
|
||||
int[] array4 = new int[] { 4608, 10240, 13312, 40960, 55216, 65536 };
|
||||
int[] array5 = new int[] { 0, 7680, 12288, 19968, 44032, 63744 };
|
||||
int[] array6 = new int[] { 4608, 10240, 13312, 40960, 55216, 65536 };
|
||||
int[] array7 = new int[] { 0, 7680, 12288, 64256 };
|
||||
int[] array8 = new int[] { 3840, 10240, 13312, 65536 };
|
||||
int[] array9 = new int[] { 0, 7680, 12288, 64256 };
|
||||
int[] array10 = new int[] { 4608, 10240, 13312, 65536 };
|
||||
int[] array11 = new int[] { 12544, 19968, 59392 };
|
||||
int[] array12 = new int[] { 13312, 40960, 65536 };
|
||||
int[] array13 = new int[] { 12544, 19968, 63744 };
|
||||
int[] array14 = new int[] { 13312, 40960, 64256 };
|
||||
MSCompatUnicodeTableUtil.Ignorable = new CodePointIndexer(array, array2, -1, -1);
|
||||
MSCompatUnicodeTableUtil.Category = new CodePointIndexer(array3, array4, 0, 0);
|
||||
MSCompatUnicodeTableUtil.Level1 = new CodePointIndexer(array5, array6, 0, 0);
|
||||
MSCompatUnicodeTableUtil.Level2 = new CodePointIndexer(array7, array8, 0, 0);
|
||||
MSCompatUnicodeTableUtil.Level3 = new CodePointIndexer(array9, array10, 0, 0);
|
||||
MSCompatUnicodeTableUtil.CjkCHS = new CodePointIndexer(array11, array12, -1, -1);
|
||||
MSCompatUnicodeTableUtil.Cjk = new CodePointIndexer(array13, array14, -1, -1);
|
||||
}
|
||||
|
||||
// Token: 0x04000141 RID: 321
|
||||
public const byte ResourceVersion = 3;
|
||||
|
||||
// Token: 0x04000142 RID: 322
|
||||
public static readonly CodePointIndexer Ignorable;
|
||||
|
||||
// Token: 0x04000143 RID: 323
|
||||
public static readonly CodePointIndexer Category;
|
||||
|
||||
// Token: 0x04000144 RID: 324
|
||||
public static readonly CodePointIndexer Level1;
|
||||
|
||||
// Token: 0x04000145 RID: 325
|
||||
public static readonly CodePointIndexer Level2;
|
||||
|
||||
// Token: 0x04000146 RID: 326
|
||||
public static readonly CodePointIndexer Level3;
|
||||
|
||||
// Token: 0x04000147 RID: 327
|
||||
public static readonly CodePointIndexer CjkCHS;
|
||||
|
||||
// Token: 0x04000148 RID: 328
|
||||
public static readonly CodePointIndexer Cjk;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,572 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000088 RID: 136
|
||||
internal class Normalization
|
||||
{
|
||||
// Token: 0x060007B5 RID: 1973 RVA: 0x000191E0 File Offset: 0x000173E0
|
||||
unsafe static Normalization()
|
||||
{
|
||||
object obj = Normalization.forLock;
|
||||
lock (obj)
|
||||
{
|
||||
IntPtr intPtr;
|
||||
IntPtr intPtr2;
|
||||
IntPtr intPtr3;
|
||||
IntPtr intPtr4;
|
||||
IntPtr intPtr5;
|
||||
IntPtr intPtr6;
|
||||
Normalization.load_normalization_resource(out intPtr, out intPtr2, out intPtr3, out intPtr4, out intPtr5, out intPtr6);
|
||||
Normalization.props = (byte*)(void*)intPtr;
|
||||
Normalization.mappedChars = (int*)(void*)intPtr2;
|
||||
Normalization.charMapIndex = (short*)(void*)intPtr3;
|
||||
Normalization.helperIndex = (short*)(void*)intPtr4;
|
||||
Normalization.mapIdxToComposite = (ushort*)(void*)intPtr5;
|
||||
Normalization.combiningClass = (byte*)(void*)intPtr6;
|
||||
}
|
||||
Normalization.isReady = true;
|
||||
}
|
||||
|
||||
// Token: 0x060007B6 RID: 1974 RVA: 0x0001928C File Offset: 0x0001748C
|
||||
private unsafe static uint PropValue(int cp)
|
||||
{
|
||||
return (uint)Normalization.props[NormalizationTableUtil.PropIdx(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x060007B7 RID: 1975 RVA: 0x0001929C File Offset: 0x0001749C
|
||||
private unsafe static int CharMapIdx(int cp)
|
||||
{
|
||||
return (int)Normalization.charMapIndex[NormalizationTableUtil.MapIdx(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x060007B8 RID: 1976 RVA: 0x000192B0 File Offset: 0x000174B0
|
||||
private unsafe static int GetNormalizedStringLength(int ch)
|
||||
{
|
||||
int num = (int)Normalization.charMapIndex[NormalizationTableUtil.MapIdx(ch)];
|
||||
int num2 = num;
|
||||
while (Normalization.mappedChars[num2] != 0)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
return num2 - num;
|
||||
}
|
||||
|
||||
// Token: 0x060007B9 RID: 1977 RVA: 0x000192EC File Offset: 0x000174EC
|
||||
private unsafe static byte GetCombiningClass(int c)
|
||||
{
|
||||
return Normalization.combiningClass[NormalizationTableUtil.Combining.ToIndex(c)];
|
||||
}
|
||||
|
||||
// Token: 0x060007BA RID: 1978 RVA: 0x00019300 File Offset: 0x00017500
|
||||
private unsafe static int GetPrimaryCompositeFromMapIndex(int src)
|
||||
{
|
||||
return (int)Normalization.mapIdxToComposite[NormalizationTableUtil.Composite.ToIndex(src)];
|
||||
}
|
||||
|
||||
// Token: 0x060007BB RID: 1979 RVA: 0x00019318 File Offset: 0x00017518
|
||||
private unsafe static int GetPrimaryCompositeHelperIndex(int cp)
|
||||
{
|
||||
return (int)Normalization.helperIndex[NormalizationTableUtil.Helper.ToIndex(cp)];
|
||||
}
|
||||
|
||||
// Token: 0x060007BC RID: 1980 RVA: 0x00019330 File Offset: 0x00017530
|
||||
private unsafe static int GetPrimaryCompositeCharIndex(object chars, int start)
|
||||
{
|
||||
string text = chars as string;
|
||||
StringBuilder stringBuilder = chars as StringBuilder;
|
||||
char c = ((text == null) ? stringBuilder[start] : text[start]);
|
||||
int num = ((stringBuilder == null) ? text.Length : stringBuilder.Length);
|
||||
int num2 = Normalization.GetPrimaryCompositeHelperIndex((int)c);
|
||||
if (num2 == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while (Normalization.mappedChars[num2] == (int)c)
|
||||
{
|
||||
int num3 = 0;
|
||||
int num4 = 1;
|
||||
int num5 = 1;
|
||||
for (;;)
|
||||
{
|
||||
int num6 = num3;
|
||||
if (Normalization.mappedChars[num2 + num4] == 0)
|
||||
{
|
||||
return num2;
|
||||
}
|
||||
if (start + num4 >= num)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
bool flag = false;
|
||||
char c2;
|
||||
do
|
||||
{
|
||||
c2 = ((text == null) ? stringBuilder[start + num5] : text[start + num5]);
|
||||
num3 = (int)Normalization.GetCombiningClass((int)c2);
|
||||
if (Normalization.mappedChars[num2 + num4] == (int)c2)
|
||||
{
|
||||
goto Block_7;
|
||||
}
|
||||
if (num3 < num6)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (++num5 + start < num && num3 != 0);
|
||||
IL_105:
|
||||
if (!flag)
|
||||
{
|
||||
if (num6 >= num3)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num5--;
|
||||
if (Normalization.mappedChars[num2 + num4] != (int)c2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
num4++;
|
||||
num5++;
|
||||
continue;
|
||||
Block_7:
|
||||
flag = true;
|
||||
goto IL_105;
|
||||
}
|
||||
while (Normalization.mappedChars[num4] != 0)
|
||||
{
|
||||
num4++;
|
||||
}
|
||||
num2 += num4 + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007BD RID: 1981 RVA: 0x000194C4 File Offset: 0x000176C4
|
||||
private static string Compose(string source, int checkType)
|
||||
{
|
||||
StringBuilder stringBuilder = null;
|
||||
Normalization.Decompose(source, ref stringBuilder, checkType);
|
||||
if (stringBuilder == null)
|
||||
{
|
||||
stringBuilder = Normalization.Combine(source, 0, checkType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Normalization.Combine(stringBuilder, 0, checkType);
|
||||
}
|
||||
return (stringBuilder == null) ? source : stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060007BE RID: 1982 RVA: 0x0001950C File Offset: 0x0001770C
|
||||
private static StringBuilder Combine(string source, int start, int checkType)
|
||||
{
|
||||
for (int i = 0; i < source.Length; i++)
|
||||
{
|
||||
if (Normalization.QuickCheck(source[i], checkType) != NormalizationCheck.Yes)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(source.Length + source.Length / 10);
|
||||
stringBuilder.Append(source);
|
||||
Normalization.Combine(stringBuilder, i, checkType);
|
||||
return stringBuilder;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060007BF RID: 1983 RVA: 0x00019570 File Offset: 0x00017770
|
||||
private static bool CanBePrimaryComposite(int i)
|
||||
{
|
||||
if (i >= 13312 && i <= 40891)
|
||||
{
|
||||
return Normalization.GetPrimaryCompositeHelperIndex(i) != 0;
|
||||
}
|
||||
return (Normalization.PropValue(i) & 128U) != 0U;
|
||||
}
|
||||
|
||||
// Token: 0x060007C0 RID: 1984 RVA: 0x000195A8 File Offset: 0x000177A8
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007C1 RID: 1985 RVA: 0x000196C8 File Offset: 0x000178C8
|
||||
private static int GetPrimaryCompositeMapIndex(object o, int cur, int bufferPos)
|
||||
{
|
||||
if ((Normalization.PropValue(cur) & 64U) != 0U)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (Normalization.GetCombiningClass(cur) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return Normalization.GetPrimaryCompositeCharIndex(o, bufferPos);
|
||||
}
|
||||
|
||||
// Token: 0x060007C2 RID: 1986 RVA: 0x000196FC File Offset: 0x000178FC
|
||||
private static string Decompose(string source, int checkType)
|
||||
{
|
||||
StringBuilder stringBuilder = null;
|
||||
Normalization.Decompose(source, ref stringBuilder, checkType);
|
||||
return (stringBuilder == null) ? source : stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060007C3 RID: 1987 RVA: 0x00019728 File Offset: 0x00017928
|
||||
private static void Decompose(string source, ref StringBuilder sb, int checkType)
|
||||
{
|
||||
int[] array = null;
|
||||
int num = 0;
|
||||
for (int i = 0; i < source.Length; i++)
|
||||
{
|
||||
if (Normalization.QuickCheck(source[i], checkType) == NormalizationCheck.No)
|
||||
{
|
||||
Normalization.DecomposeChar(ref sb, ref array, source, i, ref num);
|
||||
}
|
||||
}
|
||||
if (sb != null)
|
||||
{
|
||||
sb.Append(source, num, source.Length - num);
|
||||
}
|
||||
Normalization.ReorderCanonical(source, ref sb, 1);
|
||||
}
|
||||
|
||||
// Token: 0x060007C4 RID: 1988 RVA: 0x00019790 File Offset: 0x00017990
|
||||
private static void ReorderCanonical(string src, ref StringBuilder sb, int start)
|
||||
{
|
||||
if (sb == null)
|
||||
{
|
||||
for (int i = 1; i < src.Length; i++)
|
||||
{
|
||||
int num = (int)Normalization.GetCombiningClass((int)src[i]);
|
||||
if (num != 0)
|
||||
{
|
||||
if ((int)Normalization.GetCombiningClass((int)src[i - 1]) > num)
|
||||
{
|
||||
sb = new StringBuilder(src.Length);
|
||||
sb.Append(src, 0, src.Length);
|
||||
Normalization.ReorderCanonical(src, ref sb, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (int j = start; j < sb.Length; j++)
|
||||
{
|
||||
int num2 = (int)Normalization.GetCombiningClass((int)sb[j]);
|
||||
if (num2 != 0)
|
||||
{
|
||||
if ((int)Normalization.GetCombiningClass((int)sb[j - 1]) > num2)
|
||||
{
|
||||
char c = sb[j - 1];
|
||||
sb[j - 1] = sb[j];
|
||||
sb[j] = c;
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007C5 RID: 1989 RVA: 0x00019880 File Offset: 0x00017A80
|
||||
private static void DecomposeChar(ref StringBuilder sb, ref int[] buf, string s, int i, ref int start)
|
||||
{
|
||||
if (sb == null)
|
||||
{
|
||||
sb = new StringBuilder(s.Length + 100);
|
||||
}
|
||||
sb.Append(s, start, i - start);
|
||||
if (buf == null)
|
||||
{
|
||||
buf = new int[19];
|
||||
}
|
||||
Normalization.GetCanonical((int)s[i], buf, 0);
|
||||
int num = 0;
|
||||
while (buf[num] != 0)
|
||||
{
|
||||
if (buf[num] < 65535)
|
||||
{
|
||||
sb.Append((char)buf[num]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append((char)(buf[num] >> 10));
|
||||
sb.Append((char)((buf[num] & 4095) + 56320));
|
||||
}
|
||||
num++;
|
||||
}
|
||||
start = i + 1;
|
||||
}
|
||||
|
||||
// Token: 0x060007C6 RID: 1990 RVA: 0x00019944 File Offset: 0x00017B44
|
||||
public static NormalizationCheck QuickCheck(char c, int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
if ('가' <= c && c <= '힣')
|
||||
{
|
||||
return NormalizationCheck.No;
|
||||
}
|
||||
return ((Normalization.PropValue((int)c) & 1U) == 0U) ? NormalizationCheck.Yes : NormalizationCheck.No;
|
||||
case 2:
|
||||
{
|
||||
uint num = Normalization.PropValue((int)c);
|
||||
return ((num & 16U) == 0U) ? (((num & 32U) == 0U) ? NormalizationCheck.Yes : NormalizationCheck.Maybe) : NormalizationCheck.No;
|
||||
}
|
||||
case 3:
|
||||
if ('가' <= c && c <= '힣')
|
||||
{
|
||||
return NormalizationCheck.No;
|
||||
}
|
||||
return ((Normalization.PropValue((int)c) & 2U) == 0U) ? NormalizationCheck.Yes : NormalizationCheck.No;
|
||||
default:
|
||||
{
|
||||
uint num = Normalization.PropValue((int)c);
|
||||
return ((num & 4U) != 0U) ? NormalizationCheck.No : (((num & 8U) != 0U) ? NormalizationCheck.Maybe : NormalizationCheck.Yes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007C7 RID: 1991 RVA: 0x00019A14 File Offset: 0x00017C14
|
||||
private static bool GetCanonicalHangul(int s, int[] buf, int bufIdx)
|
||||
{
|
||||
int num = s - 44032;
|
||||
if (num < 0 || num >= 11172)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int num2 = 4352 + num / 588;
|
||||
int num3 = 4449 + num % 588 / 28;
|
||||
int num4 = 4519 + num % 28;
|
||||
buf[bufIdx++] = num2;
|
||||
buf[bufIdx++] = num3;
|
||||
if (num4 != 4519)
|
||||
{
|
||||
buf[bufIdx++] = num4;
|
||||
}
|
||||
buf[bufIdx] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060007C8 RID: 1992 RVA: 0x00019A94 File Offset: 0x00017C94
|
||||
public unsafe static void GetCanonical(int c, int[] buf, int bufIdx)
|
||||
{
|
||||
if (!Normalization.GetCanonicalHangul(c, buf, bufIdx))
|
||||
{
|
||||
int num = Normalization.CharMapIdx(c);
|
||||
while (Normalization.mappedChars[num] != 0)
|
||||
{
|
||||
buf[bufIdx++] = Normalization.mappedChars[num];
|
||||
num++;
|
||||
}
|
||||
buf[bufIdx] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007C9 RID: 1993 RVA: 0x00019AE4 File Offset: 0x00017CE4
|
||||
public static bool IsNormalized(string source, int type)
|
||||
{
|
||||
int num = -1;
|
||||
for (int i = 0; i < source.Length; i++)
|
||||
{
|
||||
int num2 = (int)Normalization.GetCombiningClass((int)source[i]);
|
||||
if (num2 != 0 && num2 < num)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
num = num2;
|
||||
switch (Normalization.QuickCheck(source[i], type))
|
||||
{
|
||||
case NormalizationCheck.No:
|
||||
return false;
|
||||
case NormalizationCheck.Maybe:
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
return source == Normalization.Normalize(source, type);
|
||||
}
|
||||
int num3 = i;
|
||||
while (i > 0)
|
||||
{
|
||||
if (Normalization.GetCombiningClass((int)source[i]) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
while (i < num3)
|
||||
{
|
||||
if (Normalization.GetPrimaryCompositeCharIndex(source, i) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x060007CA RID: 1994 RVA: 0x00019BCC File Offset: 0x00017DCC
|
||||
public static string Normalize(string source, int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
case 3:
|
||||
return Normalization.Decompose(source, type);
|
||||
default:
|
||||
return Normalization.Compose(source, type);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170000DD RID: 221
|
||||
// (get) Token: 0x060007CB RID: 1995 RVA: 0x00019C04 File Offset: 0x00017E04
|
||||
public static bool IsReady
|
||||
{
|
||||
get
|
||||
{
|
||||
return Normalization.isReady;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007CC RID: 1996
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern void load_normalization_resource(out IntPtr props, out IntPtr mappedChars, out IntPtr charMapIndex, out IntPtr helperIndex, out IntPtr mapIdxToComposite, out IntPtr combiningClass);
|
||||
|
||||
// Token: 0x0400014D RID: 333
|
||||
public const int NoNfd = 1;
|
||||
|
||||
// Token: 0x0400014E RID: 334
|
||||
public const int NoNfkd = 2;
|
||||
|
||||
// Token: 0x0400014F RID: 335
|
||||
public const int NoNfc = 4;
|
||||
|
||||
// Token: 0x04000150 RID: 336
|
||||
public const int MaybeNfc = 8;
|
||||
|
||||
// Token: 0x04000151 RID: 337
|
||||
public const int NoNfkc = 16;
|
||||
|
||||
// Token: 0x04000152 RID: 338
|
||||
public const int MaybeNfkc = 32;
|
||||
|
||||
// Token: 0x04000153 RID: 339
|
||||
public const int FullCompositionExclusion = 64;
|
||||
|
||||
// Token: 0x04000154 RID: 340
|
||||
public const int IsUnsafe = 128;
|
||||
|
||||
// Token: 0x04000155 RID: 341
|
||||
private const int HangulSBase = 44032;
|
||||
|
||||
// Token: 0x04000156 RID: 342
|
||||
private const int HangulLBase = 4352;
|
||||
|
||||
// Token: 0x04000157 RID: 343
|
||||
private const int HangulVBase = 4449;
|
||||
|
||||
// Token: 0x04000158 RID: 344
|
||||
private const int HangulTBase = 4519;
|
||||
|
||||
// Token: 0x04000159 RID: 345
|
||||
private const int HangulLCount = 19;
|
||||
|
||||
// Token: 0x0400015A RID: 346
|
||||
private const int HangulVCount = 21;
|
||||
|
||||
// Token: 0x0400015B RID: 347
|
||||
private const int HangulTCount = 28;
|
||||
|
||||
// Token: 0x0400015C RID: 348
|
||||
private const int HangulNCount = 588;
|
||||
|
||||
// Token: 0x0400015D RID: 349
|
||||
private const int HangulSCount = 11172;
|
||||
|
||||
// Token: 0x0400015E RID: 350
|
||||
private unsafe static byte* props;
|
||||
|
||||
// Token: 0x0400015F RID: 351
|
||||
private unsafe static int* mappedChars;
|
||||
|
||||
// Token: 0x04000160 RID: 352
|
||||
private unsafe static short* charMapIndex;
|
||||
|
||||
// Token: 0x04000161 RID: 353
|
||||
private unsafe static short* helperIndex;
|
||||
|
||||
// Token: 0x04000162 RID: 354
|
||||
private unsafe static ushort* mapIdxToComposite;
|
||||
|
||||
// Token: 0x04000163 RID: 355
|
||||
private unsafe static byte* combiningClass;
|
||||
|
||||
// Token: 0x04000164 RID: 356
|
||||
private static object forLock = new object();
|
||||
|
||||
// Token: 0x04000165 RID: 357
|
||||
public static readonly bool isReady;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000087 RID: 135
|
||||
internal enum NormalizationCheck
|
||||
{
|
||||
// Token: 0x0400014A RID: 330
|
||||
Yes,
|
||||
// Token: 0x0400014B RID: 331
|
||||
No,
|
||||
// Token: 0x0400014C RID: 332
|
||||
Maybe
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000089 RID: 137
|
||||
internal class NormalizationTableUtil
|
||||
{
|
||||
// Token: 0x060007CE RID: 1998 RVA: 0x00019C14 File Offset: 0x00017E14
|
||||
static NormalizationTableUtil()
|
||||
{
|
||||
int[] array = new int[] { 0, 2320, 6912, 9312, 10624, 11376, 11616, 11920, 42864, 63744 };
|
||||
int[] array2 = new int[] { 1760, 4608, 9008, 9728, 10976, 11392, 11632, 13312, 42880, 65536 };
|
||||
int[] array3 = new int[] { 144, 2336, 7456, 9312, 9376, 10752, 11616, 11920, 63744 };
|
||||
int[] array4 = new int[] { 1760, 4352, 9008, 9376, 9456, 10976, 11632, 13312, 65536 };
|
||||
int[] array5 = new int[]
|
||||
{
|
||||
752, 1152, 1424, 2352, 2480, 2608, 2736, 2864, 3008, 3136,
|
||||
3248, 3392, 3520, 3632, 3760, 3840, 4144, 4944, 5904, 6096,
|
||||
6304, 6448, 6672, 7616, 8400, 12320, 12432, 43008, 64272, 65056
|
||||
};
|
||||
int[] array6 = new int[]
|
||||
{
|
||||
864, 1168, 1872, 2400, 2512, 2640, 2768, 2896, 3024, 3168,
|
||||
3280, 3408, 3536, 3664, 3792, 4048, 4160, 4960, 5952, 6112,
|
||||
6320, 6464, 6688, 7632, 8432, 12336, 12448, 43024, 64288, 65072
|
||||
};
|
||||
int[] array7 = new int[] { 1152, 5136, 5744 };
|
||||
int[] array8 = new int[] { 4224, 5504, 8624 };
|
||||
int[] array9 = new int[] { 0, 2304, 7424, 9472, 12288, 15248, 16400, 19968, 64320 };
|
||||
int[] array10 = new int[] { 1792, 4608, 8960, 9728, 12640, 15264, 16432, 40960, 64336 };
|
||||
NormalizationTableUtil.Prop = new CodePointIndexer(array, array2, 0, 0);
|
||||
NormalizationTableUtil.Map = new CodePointIndexer(array3, array4, 0, 0);
|
||||
NormalizationTableUtil.Combining = new CodePointIndexer(array5, array6, 0, 0);
|
||||
NormalizationTableUtil.Composite = new CodePointIndexer(array7, array8, 0, 0);
|
||||
NormalizationTableUtil.Helper = new CodePointIndexer(array9, array10, 0, 0);
|
||||
}
|
||||
|
||||
// Token: 0x060007CF RID: 1999 RVA: 0x00019D4C File Offset: 0x00017F4C
|
||||
public static int PropIdx(int cp)
|
||||
{
|
||||
return NormalizationTableUtil.Prop.ToIndex(cp);
|
||||
}
|
||||
|
||||
// Token: 0x060007D0 RID: 2000 RVA: 0x00019D5C File Offset: 0x00017F5C
|
||||
public static int PropCP(int index)
|
||||
{
|
||||
return NormalizationTableUtil.Prop.ToCodePoint(index);
|
||||
}
|
||||
|
||||
// Token: 0x170000DE RID: 222
|
||||
// (get) Token: 0x060007D1 RID: 2001 RVA: 0x00019D6C File Offset: 0x00017F6C
|
||||
public static int PropCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return NormalizationTableUtil.Prop.TotalCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007D2 RID: 2002 RVA: 0x00019D78 File Offset: 0x00017F78
|
||||
public static int MapIdx(int cp)
|
||||
{
|
||||
return NormalizationTableUtil.Map.ToIndex(cp);
|
||||
}
|
||||
|
||||
// Token: 0x060007D3 RID: 2003 RVA: 0x00019D88 File Offset: 0x00017F88
|
||||
public static int MapCP(int index)
|
||||
{
|
||||
return NormalizationTableUtil.Map.ToCodePoint(index);
|
||||
}
|
||||
|
||||
// Token: 0x060007D4 RID: 2004 RVA: 0x00019D98 File Offset: 0x00017F98
|
||||
public static int CbIdx(int cp)
|
||||
{
|
||||
return NormalizationTableUtil.Combining.ToIndex(cp);
|
||||
}
|
||||
|
||||
// Token: 0x060007D5 RID: 2005 RVA: 0x00019DA8 File Offset: 0x00017FA8
|
||||
public static int CbCP(int index)
|
||||
{
|
||||
return NormalizationTableUtil.Combining.ToCodePoint(index);
|
||||
}
|
||||
|
||||
// Token: 0x170000DF RID: 223
|
||||
// (get) Token: 0x060007D6 RID: 2006 RVA: 0x00019DB8 File Offset: 0x00017FB8
|
||||
public static int MapCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return NormalizationTableUtil.Map.TotalCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000166 RID: 358
|
||||
public static readonly CodePointIndexer Prop;
|
||||
|
||||
// Token: 0x04000167 RID: 359
|
||||
public static readonly CodePointIndexer Map;
|
||||
|
||||
// Token: 0x04000168 RID: 360
|
||||
public static readonly CodePointIndexer Combining;
|
||||
|
||||
// Token: 0x04000169 RID: 361
|
||||
public static readonly CodePointIndexer Composite;
|
||||
|
||||
// Token: 0x0400016A RID: 362
|
||||
public static readonly CodePointIndexer Helper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2416 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x0200008A RID: 138
|
||||
internal class SimpleCollator
|
||||
{
|
||||
// Token: 0x060007D7 RID: 2007 RVA: 0x00019DC4 File Offset: 0x00017FC4
|
||||
public SimpleCollator(CultureInfo culture)
|
||||
{
|
||||
this.lcid = culture.LCID;
|
||||
this.textInfo = culture.TextInfo;
|
||||
this.SetCJKTable(culture, ref this.cjkIndexer, ref this.cjkCatTable, ref this.cjkLv1Table, ref this.cjkLv2Indexer, ref this.cjkLv2Table);
|
||||
TailoringInfo tailoringInfo = null;
|
||||
CultureInfo cultureInfo = culture;
|
||||
while (cultureInfo.LCID != 127)
|
||||
{
|
||||
tailoringInfo = MSCompatUnicodeTable.GetTailoringInfo(cultureInfo.LCID);
|
||||
if (tailoringInfo != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
cultureInfo = cultureInfo.Parent;
|
||||
}
|
||||
if (tailoringInfo == null)
|
||||
{
|
||||
tailoringInfo = MSCompatUnicodeTable.GetTailoringInfo(127);
|
||||
}
|
||||
this.frenchSort = tailoringInfo.FrenchSort;
|
||||
MSCompatUnicodeTable.BuildTailoringTables(culture, tailoringInfo, ref this.contractions, ref this.level2Maps);
|
||||
this.unsafeFlags = new byte[96];
|
||||
foreach (Contraction contraction in this.contractions)
|
||||
{
|
||||
if (contraction.Source.Length > 1)
|
||||
{
|
||||
foreach (char c in contraction.Source)
|
||||
{
|
||||
byte[] array2 = this.unsafeFlags;
|
||||
char c2 = c / '\b';
|
||||
array2[(int)c2] = array2[(int)c2] | (byte)(1 << (int)(c & '\a'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.lcid != 127)
|
||||
{
|
||||
foreach (Contraction contraction2 in SimpleCollator.invariant.contractions)
|
||||
{
|
||||
if (contraction2.Source.Length > 1)
|
||||
{
|
||||
foreach (char c3 in contraction2.Source)
|
||||
{
|
||||
byte[] array4 = this.unsafeFlags;
|
||||
char c4 = c3 / '\b';
|
||||
array4[(int)c4] = array4[(int)c4] | (byte)(1 << (int)(c3 & '\a'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007D9 RID: 2009 RVA: 0x00019FC4 File Offset: 0x000181C4
|
||||
private unsafe void SetCJKTable(CultureInfo culture, ref CodePointIndexer cjkIndexer, ref byte* catTable, ref byte* lv1Table, ref CodePointIndexer lv2Indexer, ref byte* lv2Table)
|
||||
{
|
||||
string name = SimpleCollator.GetNeutralCulture(culture).Name;
|
||||
MSCompatUnicodeTable.FillCJK(name, ref cjkIndexer, ref catTable, ref lv1Table, ref lv2Indexer, ref lv2Table);
|
||||
}
|
||||
|
||||
// Token: 0x060007DA RID: 2010 RVA: 0x00019FEC File Offset: 0x000181EC
|
||||
private static CultureInfo GetNeutralCulture(CultureInfo info)
|
||||
{
|
||||
CultureInfo cultureInfo = info;
|
||||
while (cultureInfo.Parent != null && cultureInfo.Parent.LCID != 127)
|
||||
{
|
||||
cultureInfo = cultureInfo.Parent;
|
||||
}
|
||||
return cultureInfo;
|
||||
}
|
||||
|
||||
// Token: 0x060007DB RID: 2011 RVA: 0x0001A028 File Offset: 0x00018228
|
||||
private unsafe byte Category(int cp)
|
||||
{
|
||||
if (cp < 12288 || this.cjkCatTable == null)
|
||||
{
|
||||
return MSCompatUnicodeTable.Category(cp);
|
||||
}
|
||||
int num = this.cjkIndexer.ToIndex(cp);
|
||||
return (num >= 0) ? this.cjkCatTable[num] : MSCompatUnicodeTable.Category(cp);
|
||||
}
|
||||
|
||||
// Token: 0x060007DC RID: 2012 RVA: 0x0001A07C File Offset: 0x0001827C
|
||||
private unsafe byte Level1(int cp)
|
||||
{
|
||||
if (cp < 12288 || this.cjkLv1Table == null)
|
||||
{
|
||||
return MSCompatUnicodeTable.Level1(cp);
|
||||
}
|
||||
int num = this.cjkIndexer.ToIndex(cp);
|
||||
return (num >= 0) ? this.cjkLv1Table[num] : MSCompatUnicodeTable.Level1(cp);
|
||||
}
|
||||
|
||||
// Token: 0x060007DD RID: 2013 RVA: 0x0001A0D0 File Offset: 0x000182D0
|
||||
private unsafe byte Level2(int cp, SimpleCollator.ExtenderType ext)
|
||||
{
|
||||
if (ext == SimpleCollator.ExtenderType.Buggy)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
if (ext == SimpleCollator.ExtenderType.Conditional)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (cp < 12288 || this.cjkLv2Table == null)
|
||||
{
|
||||
return MSCompatUnicodeTable.Level2(cp);
|
||||
}
|
||||
int num = this.cjkLv2Indexer.ToIndex(cp);
|
||||
byte b = ((num >= 0) ? this.cjkLv2Table[num] : 0);
|
||||
if (b != 0)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
b = MSCompatUnicodeTable.Level2(cp);
|
||||
if (this.level2Maps.Length == 0)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
for (int i = 0; i < this.level2Maps.Length; i++)
|
||||
{
|
||||
if (this.level2Maps[i].Source == b)
|
||||
{
|
||||
return this.level2Maps[i].Replace;
|
||||
}
|
||||
if (this.level2Maps[i].Source > b)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
// Token: 0x060007DE RID: 2014 RVA: 0x0001A1A4 File Offset: 0x000183A4
|
||||
private static bool IsHalfKana(int cp, CompareOptions opt)
|
||||
{
|
||||
return (opt & CompareOptions.IgnoreWidth) != CompareOptions.None || MSCompatUnicodeTable.IsHalfWidthKana((char)cp);
|
||||
}
|
||||
|
||||
// Token: 0x060007DF RID: 2015 RVA: 0x0001A1BC File Offset: 0x000183BC
|
||||
private Contraction GetContraction(string s, int start, int end)
|
||||
{
|
||||
Contraction contraction = this.GetContraction(s, start, end, this.contractions);
|
||||
if (contraction != null || this.lcid == 127)
|
||||
{
|
||||
return contraction;
|
||||
}
|
||||
return this.GetContraction(s, start, end, SimpleCollator.invariant.contractions);
|
||||
}
|
||||
|
||||
// Token: 0x060007E0 RID: 2016 RVA: 0x0001A204 File Offset: 0x00018404
|
||||
private Contraction GetContraction(string s, int start, int end, Contraction[] clist)
|
||||
{
|
||||
foreach (Contraction contraction in clist)
|
||||
{
|
||||
int num = (int)(contraction.Source[0] - s[start]);
|
||||
if (num > 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (num >= 0)
|
||||
{
|
||||
char[] source = contraction.Source;
|
||||
if (end - start >= source.Length)
|
||||
{
|
||||
bool flag = true;
|
||||
for (int j = 0; j < source.Length; j++)
|
||||
{
|
||||
if (s[start + j] != source[j])
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return contraction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060007E1 RID: 2017 RVA: 0x0001A2A8 File Offset: 0x000184A8
|
||||
private Contraction GetTailContraction(string s, int start, int end)
|
||||
{
|
||||
Contraction tailContraction = this.GetTailContraction(s, start, end, this.contractions);
|
||||
if (tailContraction != null || this.lcid == 127)
|
||||
{
|
||||
return tailContraction;
|
||||
}
|
||||
return this.GetTailContraction(s, start, end, SimpleCollator.invariant.contractions);
|
||||
}
|
||||
|
||||
// Token: 0x060007E2 RID: 2018 RVA: 0x0001A2F0 File Offset: 0x000184F0
|
||||
private Contraction GetTailContraction(string s, int start, int end, Contraction[] clist)
|
||||
{
|
||||
if (start == end || end < -1 || start >= s.Length || s.Length <= end + 1)
|
||||
{
|
||||
throw new SystemException(string.Format("MONO internal error. Failed to get TailContraction. start = {0} end = {1} string = '{2}'", start, end, s));
|
||||
}
|
||||
foreach (Contraction contraction in clist)
|
||||
{
|
||||
char[] source = contraction.Source;
|
||||
if (source.Length <= start - end)
|
||||
{
|
||||
if (source[source.Length - 1] == s[start])
|
||||
{
|
||||
bool flag = true;
|
||||
int j = 0;
|
||||
int num = start - source.Length + 1;
|
||||
while (j < source.Length)
|
||||
{
|
||||
if (s[num] != source[j])
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
num++;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return contraction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060007E3 RID: 2019 RVA: 0x0001A3D8 File Offset: 0x000185D8
|
||||
private Contraction GetContraction(char c)
|
||||
{
|
||||
Contraction contraction = this.GetContraction(c, this.contractions);
|
||||
if (contraction != null || this.lcid == 127)
|
||||
{
|
||||
return contraction;
|
||||
}
|
||||
return this.GetContraction(c, SimpleCollator.invariant.contractions);
|
||||
}
|
||||
|
||||
// Token: 0x060007E4 RID: 2020 RVA: 0x0001A41C File Offset: 0x0001861C
|
||||
private Contraction GetContraction(char c, Contraction[] clist)
|
||||
{
|
||||
foreach (Contraction contraction in clist)
|
||||
{
|
||||
if (contraction.Source[0] > c)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (contraction.Source[0] == c && contraction.Source.Length == 1)
|
||||
{
|
||||
return contraction;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060007E5 RID: 2021 RVA: 0x0001A470 File Offset: 0x00018670
|
||||
private int FilterOptions(int i, CompareOptions opt)
|
||||
{
|
||||
if ((opt & CompareOptions.IgnoreWidth) != CompareOptions.None)
|
||||
{
|
||||
int num = MSCompatUnicodeTable.ToWidthCompat(i);
|
||||
if (num != 0)
|
||||
{
|
||||
i = num;
|
||||
}
|
||||
}
|
||||
if ((opt & CompareOptions.OrdinalIgnoreCase) != CompareOptions.None)
|
||||
{
|
||||
i = (int)this.textInfo.ToLower((char)i);
|
||||
}
|
||||
if ((opt & CompareOptions.IgnoreCase) != CompareOptions.None)
|
||||
{
|
||||
i = (int)this.textInfo.ToLower((char)i);
|
||||
}
|
||||
if ((opt & CompareOptions.IgnoreKanaType) != CompareOptions.None)
|
||||
{
|
||||
i = MSCompatUnicodeTable.ToKanaTypeInsensitive(i);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// Token: 0x060007E6 RID: 2022 RVA: 0x0001A4DC File Offset: 0x000186DC
|
||||
private SimpleCollator.ExtenderType GetExtenderType(int i)
|
||||
{
|
||||
if (i == 8213)
|
||||
{
|
||||
return (this.lcid != 16) ? SimpleCollator.ExtenderType.None : SimpleCollator.ExtenderType.Conditional;
|
||||
}
|
||||
if (i < 12293 || i > 65392)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.None;
|
||||
}
|
||||
if (i >= 65148)
|
||||
{
|
||||
if (i == 65148 || i == 65149)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.Simple;
|
||||
}
|
||||
if (i == 65438 || i == 65439)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.Voiced;
|
||||
}
|
||||
if (i == 65392)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.Conditional;
|
||||
}
|
||||
}
|
||||
if (i > 12542)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.None;
|
||||
}
|
||||
switch (i)
|
||||
{
|
||||
case 12540:
|
||||
return SimpleCollator.ExtenderType.Conditional;
|
||||
case 12541:
|
||||
break;
|
||||
case 12542:
|
||||
return SimpleCollator.ExtenderType.Voiced;
|
||||
default:
|
||||
if (i != 12337 && i != 12338 && i != 12445)
|
||||
{
|
||||
if (i == 12446)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.Voiced;
|
||||
}
|
||||
if (i != 12293)
|
||||
{
|
||||
return SimpleCollator.ExtenderType.None;
|
||||
}
|
||||
return SimpleCollator.ExtenderType.Buggy;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return SimpleCollator.ExtenderType.Simple;
|
||||
}
|
||||
|
||||
// Token: 0x060007E7 RID: 2023 RVA: 0x0001A5DC File Offset: 0x000187DC
|
||||
private static byte ToDashTypeValue(SimpleCollator.ExtenderType ext, CompareOptions opt)
|
||||
{
|
||||
if ((opt & CompareOptions.IgnoreNonSpace) != CompareOptions.None)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
switch (ext)
|
||||
{
|
||||
case SimpleCollator.ExtenderType.None:
|
||||
return 3;
|
||||
case SimpleCollator.ExtenderType.Conditional:
|
||||
return 5;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
// Token: 0x060007E8 RID: 2024 RVA: 0x0001A618 File Offset: 0x00018818
|
||||
private int FilterExtender(int i, SimpleCollator.ExtenderType ext, CompareOptions opt)
|
||||
{
|
||||
if (ext == SimpleCollator.ExtenderType.Conditional && MSCompatUnicodeTable.HasSpecialWeight((char)i))
|
||||
{
|
||||
bool flag = SimpleCollator.IsHalfKana((int)((ushort)i), opt);
|
||||
bool flag2 = !MSCompatUnicodeTable.IsHiragana((char)i);
|
||||
switch (this.Level1(i) & 7)
|
||||
{
|
||||
case 2:
|
||||
return (!flag) ? ((!flag2) ? 12354 : 12450) : 65393;
|
||||
case 3:
|
||||
return (!flag) ? ((!flag2) ? 12356 : 12452) : 65394;
|
||||
case 4:
|
||||
return (!flag) ? ((!flag2) ? 12358 : 12454) : 65395;
|
||||
case 5:
|
||||
return (!flag) ? ((!flag2) ? 12360 : 12456) : 65396;
|
||||
case 6:
|
||||
return (!flag) ? ((!flag2) ? 12362 : 12458) : 65397;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// Token: 0x060007E9 RID: 2025 RVA: 0x0001A738 File Offset: 0x00018938
|
||||
private static bool IsIgnorable(int i, CompareOptions opt)
|
||||
{
|
||||
return MSCompatUnicodeTable.IsIgnorable(i, (byte)(1 + (((opt & CompareOptions.IgnoreSymbols) == CompareOptions.None) ? 0 : 2) + (((opt & CompareOptions.IgnoreNonSpace) == CompareOptions.None) ? 0 : 4)));
|
||||
}
|
||||
|
||||
// Token: 0x060007EA RID: 2026 RVA: 0x0001A770 File Offset: 0x00018970
|
||||
private bool IsSafe(int i)
|
||||
{
|
||||
return i / 8 >= this.unsafeFlags.Length || ((int)this.unsafeFlags[i / 8] & (1 << i % 8)) == 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007EB RID: 2027 RVA: 0x0001A7AC File Offset: 0x000189AC
|
||||
public SortKey GetSortKey(string s)
|
||||
{
|
||||
return this.GetSortKey(s, CompareOptions.None);
|
||||
}
|
||||
|
||||
// Token: 0x060007EC RID: 2028 RVA: 0x0001A7B8 File Offset: 0x000189B8
|
||||
public SortKey GetSortKey(string s, CompareOptions options)
|
||||
{
|
||||
return this.GetSortKey(s, 0, s.Length, options);
|
||||
}
|
||||
|
||||
// Token: 0x060007ED RID: 2029 RVA: 0x0001A7CC File Offset: 0x000189CC
|
||||
public SortKey GetSortKey(string s, int start, int length, CompareOptions options)
|
||||
{
|
||||
SortKeyBuffer sortKeyBuffer = new SortKeyBuffer(this.lcid);
|
||||
sortKeyBuffer.Initialize(options, this.lcid, s, this.frenchSort);
|
||||
int num = start + length;
|
||||
this.GetSortKey(s, start, num, sortKeyBuffer, options);
|
||||
return sortKeyBuffer.GetResultAndReset();
|
||||
}
|
||||
|
||||
// Token: 0x060007EE RID: 2030 RVA: 0x0001A810 File Offset: 0x00018A10
|
||||
private unsafe void GetSortKey(string s, int start, int end, SortKeyBuffer buf, CompareOptions opt)
|
||||
{
|
||||
byte* ptr = stackalloc byte[checked(4 * 1)];
|
||||
this.ClearBuffer(ptr, 4);
|
||||
SimpleCollator.Context context = new SimpleCollator.Context(opt, null, null, null, null, ptr, false);
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
int num = (int)s[i];
|
||||
SimpleCollator.ExtenderType extenderType = this.GetExtenderType(num);
|
||||
if (extenderType != SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
num = this.FilterExtender(context.PrevCode, extenderType, opt);
|
||||
if (num >= 0)
|
||||
{
|
||||
this.FillSortKeyRaw(num, extenderType, buf, opt);
|
||||
}
|
||||
else if (context.PrevSortKey != null)
|
||||
{
|
||||
byte* prevSortKey = context.PrevSortKey;
|
||||
buf.AppendNormal(*prevSortKey, prevSortKey[1], (prevSortKey[2] == 1) ? this.Level2(num, extenderType) : prevSortKey[2], (prevSortKey[3] == 1) ? MSCompatUnicodeTable.Level3(num) : prevSortKey[3]);
|
||||
}
|
||||
}
|
||||
else if (!SimpleCollator.IsIgnorable(num, opt))
|
||||
{
|
||||
num = this.FilterOptions(num, opt);
|
||||
Contraction contraction = this.GetContraction(s, i, end);
|
||||
if (contraction != null)
|
||||
{
|
||||
if (contraction.Replacement != null)
|
||||
{
|
||||
this.GetSortKey(contraction.Replacement, 0, contraction.Replacement.Length, buf, opt);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte* prevSortKey2 = context.PrevSortKey;
|
||||
for (int j = 0; j < contraction.SortKey.Length; j++)
|
||||
{
|
||||
prevSortKey2[j] = contraction.SortKey[j];
|
||||
}
|
||||
buf.AppendNormal(*prevSortKey2, prevSortKey2[1], (prevSortKey2[2] == 1) ? this.Level2(num, extenderType) : prevSortKey2[2], (prevSortKey2[3] == 1) ? MSCompatUnicodeTable.Level3(num) : prevSortKey2[3]);
|
||||
context.PrevCode = -1;
|
||||
}
|
||||
i += contraction.Source.Length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!MSCompatUnicodeTable.IsIgnorableNonSpacing(num))
|
||||
{
|
||||
context.PrevCode = num;
|
||||
}
|
||||
this.FillSortKeyRaw(num, SimpleCollator.ExtenderType.None, buf, opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007EF RID: 2031 RVA: 0x0001AA0C File Offset: 0x00018C0C
|
||||
private void FillSortKeyRaw(int i, SimpleCollator.ExtenderType ext, SortKeyBuffer buf, CompareOptions opt)
|
||||
{
|
||||
if (13312 <= i && i <= 19893)
|
||||
{
|
||||
int num = i - 13312;
|
||||
buf.AppendCJKExtension((byte)(16 + num / 254), (byte)(num % 254 + 2));
|
||||
return;
|
||||
}
|
||||
UnicodeCategory unicodeCategory = char.GetUnicodeCategory((char)i);
|
||||
UnicodeCategory unicodeCategory2 = unicodeCategory;
|
||||
if (unicodeCategory2 == UnicodeCategory.Surrogate)
|
||||
{
|
||||
this.FillSurrogateSortKeyRaw(i, buf);
|
||||
return;
|
||||
}
|
||||
if (unicodeCategory2 != UnicodeCategory.PrivateUse)
|
||||
{
|
||||
byte b = this.Level2(i, ext);
|
||||
if (MSCompatUnicodeTable.HasSpecialWeight((char)i))
|
||||
{
|
||||
byte b2 = this.Level1(i);
|
||||
buf.AppendKana(this.Category(i), b2, b, MSCompatUnicodeTable.Level3(i), MSCompatUnicodeTable.IsJapaneseSmallLetter((char)i), SimpleCollator.ToDashTypeValue(ext, opt), !MSCompatUnicodeTable.IsHiragana((char)i), SimpleCollator.IsHalfKana((int)((ushort)i), opt));
|
||||
if ((opt & CompareOptions.IgnoreNonSpace) == CompareOptions.None && ext == SimpleCollator.ExtenderType.Voiced)
|
||||
{
|
||||
buf.AppendNormal(1, 1, 1, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buf.AppendNormal(this.Category(i), this.Level1(i), b, MSCompatUnicodeTable.Level3(i));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int num2 = i - 57344;
|
||||
buf.AppendNormal((byte)(229 + num2 / 254), (byte)(num2 % 254 + 2), 0, 0);
|
||||
}
|
||||
|
||||
// Token: 0x060007F0 RID: 2032 RVA: 0x0001AB38 File Offset: 0x00018D38
|
||||
private void FillSurrogateSortKeyRaw(int i, SortKeyBuffer buf)
|
||||
{
|
||||
int num;
|
||||
int num2;
|
||||
byte b;
|
||||
if (i < 55360)
|
||||
{
|
||||
num = 55296;
|
||||
num2 = 65;
|
||||
b = ((i != 55296) ? 63 : 62);
|
||||
}
|
||||
else if (55360 <= i && i < 55424)
|
||||
{
|
||||
num = 55360;
|
||||
num2 = 242;
|
||||
b = 62;
|
||||
}
|
||||
else if (56192 <= i && i < 56320)
|
||||
{
|
||||
num = 56128;
|
||||
num2 = 254;
|
||||
b = 62;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 56074;
|
||||
num2 = 65;
|
||||
b = 63;
|
||||
}
|
||||
int num3 = i - num;
|
||||
buf.AppendNormal((byte)(num2 + num3 / 254), (byte)(num3 % 254 + 2), b, b);
|
||||
}
|
||||
|
||||
// Token: 0x060007F1 RID: 2033 RVA: 0x0001ABFC File Offset: 0x00018DFC
|
||||
public int Compare(string s1, string s2)
|
||||
{
|
||||
return this.Compare(s1, s2, CompareOptions.None);
|
||||
}
|
||||
|
||||
// Token: 0x060007F2 RID: 2034 RVA: 0x0001AC08 File Offset: 0x00018E08
|
||||
public int Compare(string s1, string s2, CompareOptions options)
|
||||
{
|
||||
return this.Compare(s1, 0, s1.Length, s2, 0, s2.Length, options);
|
||||
}
|
||||
|
||||
// Token: 0x060007F3 RID: 2035 RVA: 0x0001AC2C File Offset: 0x00018E2C
|
||||
private int CompareOrdinal(string s1, int idx1, int len1, string s2, int idx2, int len2)
|
||||
{
|
||||
int num = ((len1 >= len2) ? len2 : len1);
|
||||
int num2 = idx1 + num;
|
||||
int num3 = idx2 + num;
|
||||
if (idx1 < 0 || idx2 < 0 || num2 > s1.Length || num3 > s2.Length)
|
||||
{
|
||||
throw new SystemException(string.Format("CompareInfo Internal Error: Should not happen. {0} {1} {2} {3} {4} {5}", new object[] { idx1, idx2, len1, len2, s1.Length, s2.Length }));
|
||||
}
|
||||
int num4 = idx1;
|
||||
int num5 = idx2;
|
||||
while (num4 < num2 && num5 < num3)
|
||||
{
|
||||
if (s1[num4] != s2[num5])
|
||||
{
|
||||
return (int)(s1[num4] - s2[num5]);
|
||||
}
|
||||
num4++;
|
||||
num5++;
|
||||
}
|
||||
return (len1 != len2) ? ((len1 != num) ? 1 : (-1)) : 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007F4 RID: 2036 RVA: 0x0001AD3C File Offset: 0x00018F3C
|
||||
private int CompareQuick(string s1, int idx1, int len1, string s2, int idx2, int len2, out bool sourceConsumed, out bool targetConsumed, bool immediateBreakup)
|
||||
{
|
||||
sourceConsumed = false;
|
||||
targetConsumed = false;
|
||||
int num = ((len1 >= len2) ? len2 : len1);
|
||||
int num2 = idx1 + num;
|
||||
int num3 = idx2 + num;
|
||||
if (idx1 < 0 || idx2 < 0 || num2 > s1.Length || num3 > s2.Length)
|
||||
{
|
||||
throw new SystemException(string.Format("CompareInfo Internal Error: Should not happen. {0} {1} {2} {3} {4} {5}", new object[] { idx1, idx2, len1, len2, s1.Length, s2.Length }));
|
||||
}
|
||||
int num4 = idx1;
|
||||
int num5 = idx2;
|
||||
while (num4 < num2 && num5 < num3)
|
||||
{
|
||||
if (s1[num4] != s2[num5])
|
||||
{
|
||||
if (immediateBreakup)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num6 = (int)(this.Category((int)s1[num4]) - this.Category((int)s2[num5]));
|
||||
if (num6 == 0)
|
||||
{
|
||||
num6 = (int)(this.Level1((int)s1[num4]) - this.Level1((int)s2[num5]));
|
||||
}
|
||||
if (num6 == 0)
|
||||
{
|
||||
num6 = (int)(MSCompatUnicodeTable.Level3((int)s1[num4]) - MSCompatUnicodeTable.Level3((int)s2[num5]));
|
||||
}
|
||||
if (num6 == 0)
|
||||
{
|
||||
throw new SystemException(string.Format("CompareInfo Internal Error: Should not happen. '{0}' {2} {3} '{1}' {4} {5}", new object[] { s1, s2, idx1, num2, idx2, num3 }));
|
||||
}
|
||||
return num6;
|
||||
}
|
||||
else
|
||||
{
|
||||
num4++;
|
||||
num5++;
|
||||
}
|
||||
}
|
||||
sourceConsumed = len1 <= len2;
|
||||
targetConsumed = len1 >= len2;
|
||||
return (len1 != len2) ? ((len1 != num) ? 1 : (-1)) : 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007F5 RID: 2037 RVA: 0x0001AF18 File Offset: 0x00019118
|
||||
private int CompareOrdinalIgnoreCase(string s1, int idx1, int len1, string s2, int idx2, int len2)
|
||||
{
|
||||
int num = ((len1 >= len2) ? len2 : len1);
|
||||
int num2 = idx1 + num;
|
||||
int num3 = idx2 + num;
|
||||
if (idx1 < 0 || idx2 < 0 || num2 > s1.Length || num3 > s2.Length)
|
||||
{
|
||||
throw new SystemException(string.Format("CompareInfo Internal Error: Should not happen. {0} {1} {2} {3} {4} {5}", new object[] { idx1, idx2, len1, len2, s1.Length, s2.Length }));
|
||||
}
|
||||
TextInfo textInfo = SimpleCollator.invariant.textInfo;
|
||||
int num4 = idx1;
|
||||
int num5 = idx2;
|
||||
while (num4 < num2 && num5 < num3)
|
||||
{
|
||||
if (textInfo.ToLower(s1[num4]) != textInfo.ToLower(s2[num5]))
|
||||
{
|
||||
return (int)(textInfo.ToLower(s1[num4]) - textInfo.ToLower(s2[num5]));
|
||||
}
|
||||
num4++;
|
||||
num5++;
|
||||
}
|
||||
return (len1 != len2) ? ((len1 != num) ? 1 : (-1)) : 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007F6 RID: 2038 RVA: 0x0001B050 File Offset: 0x00019250
|
||||
public unsafe int Compare(string s1, int idx1, int len1, string s2, int idx2, int len2, CompareOptions options)
|
||||
{
|
||||
if (idx1 == idx2 && len1 == len2 && object.ReferenceEquals(s1, s2))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (options == CompareOptions.Ordinal)
|
||||
{
|
||||
return this.CompareOrdinal(s1, idx1, len1, s2, idx2, len2);
|
||||
}
|
||||
if (options == CompareOptions.OrdinalIgnoreCase)
|
||||
{
|
||||
return this.CompareOrdinalIgnoreCase(s1, idx1, len1, s2, idx2, len2);
|
||||
}
|
||||
byte* ptr;
|
||||
byte* ptr2;
|
||||
checked
|
||||
{
|
||||
ptr = stackalloc byte[4 * 1];
|
||||
ptr2 = stackalloc byte[4 * 1];
|
||||
this.ClearBuffer(ptr, 4);
|
||||
this.ClearBuffer(ptr2, 4);
|
||||
}
|
||||
SimpleCollator.Context context = new SimpleCollator.Context(options, null, null, ptr, ptr2, null, this.QuickCheckPossible(s1, idx1, idx1 + len1, s2, idx2, idx2 + len2));
|
||||
bool flag;
|
||||
bool flag2;
|
||||
int num = this.CompareInternal(s1, idx1, len1, s2, idx2, len2, out flag, out flag2, true, false, ref context);
|
||||
return (num != 0) ? ((num >= 0) ? 1 : (-1)) : 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007F7 RID: 2039 RVA: 0x0001B12C File Offset: 0x0001932C
|
||||
private unsafe void ClearBuffer(byte* buffer, int size)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
buffer[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060007F8 RID: 2040 RVA: 0x0001B150 File Offset: 0x00019350
|
||||
private bool QuickCheckPossible(string s1, int idx1, int end1, string s2, int idx2, int end2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x060007F9 RID: 2041 RVA: 0x0001B154 File Offset: 0x00019354
|
||||
private unsafe int CompareInternal(string s1, int idx1, int len1, string s2, int idx2, int len2, out bool targetConsumed, out bool sourceConsumed, bool skipHeadingExtenders, bool immediateBreakup, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
CompareOptions option = ctx.Option;
|
||||
int num = idx1;
|
||||
int num2 = idx2;
|
||||
int num3 = idx1 + len1;
|
||||
int num4 = idx2 + len2;
|
||||
targetConsumed = false;
|
||||
sourceConsumed = false;
|
||||
SimpleCollator.PreviousInfo previousInfo = new SimpleCollator.PreviousInfo(false);
|
||||
if (option == CompareOptions.None && ctx.QuickCheckPossible)
|
||||
{
|
||||
return this.CompareQuick(s1, idx1, len1, s2, idx2, len2, out sourceConsumed, out targetConsumed, immediateBreakup);
|
||||
}
|
||||
int num5 = 0;
|
||||
int num6 = 5;
|
||||
int num7 = -1;
|
||||
int num8 = -1;
|
||||
int num9 = 0;
|
||||
int num10 = 0;
|
||||
if (skipHeadingExtenders)
|
||||
{
|
||||
while (idx1 < num3)
|
||||
{
|
||||
if (this.GetExtenderType((int)s1[idx1]) == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx1++;
|
||||
}
|
||||
while (idx2 < num4)
|
||||
{
|
||||
if (this.GetExtenderType((int)s2[idx2]) == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx2++;
|
||||
}
|
||||
}
|
||||
SimpleCollator.ExtenderType extenderType = SimpleCollator.ExtenderType.None;
|
||||
SimpleCollator.ExtenderType extenderType2 = SimpleCollator.ExtenderType.None;
|
||||
int num11 = idx1;
|
||||
int num12 = idx2;
|
||||
bool flag = (option & CompareOptions.StringSort) != CompareOptions.None;
|
||||
bool flag2 = (option & CompareOptions.IgnoreNonSpace) != CompareOptions.None;
|
||||
SimpleCollator.Escape escape = default(SimpleCollator.Escape);
|
||||
SimpleCollator.Escape escape2 = default(SimpleCollator.Escape);
|
||||
for (;;)
|
||||
{
|
||||
while (idx1 < num3)
|
||||
{
|
||||
if (!SimpleCollator.IsIgnorable((int)s1[idx1], option))
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx1++;
|
||||
}
|
||||
while (idx2 < num4)
|
||||
{
|
||||
if (!SimpleCollator.IsIgnorable((int)s2[idx2], option))
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx2++;
|
||||
}
|
||||
if (idx1 >= num3)
|
||||
{
|
||||
if (escape.Source == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
s1 = escape.Source;
|
||||
num = escape.Start;
|
||||
idx1 = escape.Index;
|
||||
num3 = escape.End;
|
||||
num11 = escape.Optional;
|
||||
escape.Source = null;
|
||||
}
|
||||
else if (idx2 >= num4)
|
||||
{
|
||||
if (escape2.Source == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
s2 = escape2.Source;
|
||||
num2 = escape2.Start;
|
||||
idx2 = escape2.Index;
|
||||
num4 = escape2.End;
|
||||
num12 = escape2.Optional;
|
||||
escape2.Source = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num11 < idx1 && num12 < idx2)
|
||||
{
|
||||
while (idx1 < num3 && idx2 < num4 && s1[idx1] == s2[idx2])
|
||||
{
|
||||
idx1++;
|
||||
idx2++;
|
||||
}
|
||||
if (idx1 == num3 || idx2 == num4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int num13 = num11;
|
||||
int num14 = num12;
|
||||
num11 = idx1;
|
||||
num12 = idx2;
|
||||
idx1--;
|
||||
idx2--;
|
||||
while (idx1 > num13)
|
||||
{
|
||||
if (this.Category((int)s1[idx1]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx1--;
|
||||
}
|
||||
while (idx2 > num14)
|
||||
{
|
||||
if (this.Category((int)s2[idx2]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx2--;
|
||||
}
|
||||
while (idx1 > num13)
|
||||
{
|
||||
if (this.IsSafe((int)s1[idx1]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx1--;
|
||||
}
|
||||
while (idx2 > num14)
|
||||
{
|
||||
if (this.IsSafe((int)s2[idx2]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx2--;
|
||||
}
|
||||
}
|
||||
int num15 = idx1;
|
||||
int num16 = idx2;
|
||||
byte* ptr = null;
|
||||
byte* ptr2 = null;
|
||||
int num17 = this.FilterOptions((int)s1[idx1], option);
|
||||
int num18 = this.FilterOptions((int)s2[idx2], option);
|
||||
bool flag3 = false;
|
||||
bool flag4 = false;
|
||||
extenderType = this.GetExtenderType(num17);
|
||||
if (extenderType != SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
if (ctx.PrevCode < 0)
|
||||
{
|
||||
if (ctx.PrevSortKey == null)
|
||||
{
|
||||
idx1++;
|
||||
continue;
|
||||
}
|
||||
ptr = ctx.PrevSortKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
num17 = this.FilterExtender(ctx.PrevCode, extenderType, option);
|
||||
}
|
||||
}
|
||||
extenderType2 = this.GetExtenderType(num18);
|
||||
if (extenderType2 != SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
if (previousInfo.Code < 0)
|
||||
{
|
||||
if (previousInfo.SortKey == null)
|
||||
{
|
||||
idx2++;
|
||||
continue;
|
||||
}
|
||||
ptr2 = previousInfo.SortKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
num18 = this.FilterExtender(previousInfo.Code, extenderType2, option);
|
||||
}
|
||||
}
|
||||
byte b = this.Category(num17);
|
||||
byte b2 = this.Category(num18);
|
||||
if (b == 6)
|
||||
{
|
||||
if (!flag && num6 == 5)
|
||||
{
|
||||
num7 = ((escape.Source == null) ? (num15 - num) : (escape.Index - escape.Start));
|
||||
num9 = (int)this.Level1(num17) << (int)(8 + MSCompatUnicodeTable.Level3(num17));
|
||||
}
|
||||
ctx.PrevCode = num17;
|
||||
idx1++;
|
||||
}
|
||||
if (b2 == 6)
|
||||
{
|
||||
if (!flag && num6 == 5)
|
||||
{
|
||||
num8 = ((escape2.Source == null) ? (num16 - num2) : (escape2.Index - escape2.Start));
|
||||
num10 = (int)this.Level1(num18) << (int)(8 + MSCompatUnicodeTable.Level3(num18));
|
||||
}
|
||||
previousInfo.Code = num18;
|
||||
idx2++;
|
||||
}
|
||||
if (b == 6 || b2 == 6)
|
||||
{
|
||||
if (num6 == 5)
|
||||
{
|
||||
if (num9 == num10)
|
||||
{
|
||||
num8 = (num7 = -1);
|
||||
num10 = (num9 = 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Contraction contraction = null;
|
||||
if (extenderType == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
contraction = this.GetContraction(s1, idx1, num3);
|
||||
}
|
||||
int num19 = 1;
|
||||
if (ptr != null)
|
||||
{
|
||||
num19 = 1;
|
||||
}
|
||||
else if (contraction != null)
|
||||
{
|
||||
num19 = contraction.Source.Length;
|
||||
if (contraction.SortKey != null)
|
||||
{
|
||||
ptr = ctx.Buffer1;
|
||||
for (int i = 0; i < contraction.SortKey.Length; i++)
|
||||
{
|
||||
ptr[i] = contraction.SortKey[i];
|
||||
}
|
||||
ctx.PrevCode = -1;
|
||||
ctx.PrevSortKey = ptr;
|
||||
}
|
||||
else if (escape.Source == null)
|
||||
{
|
||||
escape.Source = s1;
|
||||
escape.Start = num;
|
||||
escape.Index = num15 + contraction.Source.Length;
|
||||
escape.End = num3;
|
||||
escape.Optional = num11;
|
||||
s1 = contraction.Replacement;
|
||||
idx1 = 0;
|
||||
num = 0;
|
||||
num3 = s1.Length;
|
||||
num11 = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = ctx.Buffer1;
|
||||
*ptr = b;
|
||||
ptr[1] = this.Level1(num17);
|
||||
if (!flag2 && num6 > 1)
|
||||
{
|
||||
ptr[2] = this.Level2(num17, extenderType);
|
||||
}
|
||||
if (num6 > 2)
|
||||
{
|
||||
ptr[3] = MSCompatUnicodeTable.Level3(num17);
|
||||
}
|
||||
if (num6 > 3)
|
||||
{
|
||||
flag3 = MSCompatUnicodeTable.HasSpecialWeight((char)num17);
|
||||
}
|
||||
if (b > 1)
|
||||
{
|
||||
ctx.PrevCode = num17;
|
||||
}
|
||||
}
|
||||
Contraction contraction2 = null;
|
||||
if (extenderType2 == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
contraction2 = this.GetContraction(s2, idx2, num4);
|
||||
}
|
||||
if (ptr2 != null)
|
||||
{
|
||||
idx2++;
|
||||
}
|
||||
else if (contraction2 != null)
|
||||
{
|
||||
idx2 += contraction2.Source.Length;
|
||||
if (contraction2.SortKey != null)
|
||||
{
|
||||
ptr2 = ctx.Buffer2;
|
||||
for (int j = 0; j < contraction2.SortKey.Length; j++)
|
||||
{
|
||||
ptr2[j] = contraction2.SortKey[j];
|
||||
}
|
||||
previousInfo.Code = -1;
|
||||
previousInfo.SortKey = ptr2;
|
||||
}
|
||||
else if (escape2.Source == null)
|
||||
{
|
||||
escape2.Source = s2;
|
||||
escape2.Start = num2;
|
||||
escape2.Index = num16 + contraction2.Source.Length;
|
||||
escape2.End = num4;
|
||||
escape2.Optional = num12;
|
||||
s2 = contraction2.Replacement;
|
||||
idx2 = 0;
|
||||
num2 = 0;
|
||||
num4 = s2.Length;
|
||||
num12 = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr2 = ctx.Buffer2;
|
||||
*ptr2 = b2;
|
||||
ptr2[1] = this.Level1(num18);
|
||||
if (!flag2 && num6 > 1)
|
||||
{
|
||||
ptr2[2] = this.Level2(num18, extenderType2);
|
||||
}
|
||||
if (num6 > 2)
|
||||
{
|
||||
ptr2[3] = MSCompatUnicodeTable.Level3(num18);
|
||||
}
|
||||
if (num6 > 3)
|
||||
{
|
||||
flag4 = MSCompatUnicodeTable.HasSpecialWeight((char)num18);
|
||||
}
|
||||
if (b2 > 1)
|
||||
{
|
||||
previousInfo.Code = num18;
|
||||
}
|
||||
idx2++;
|
||||
}
|
||||
idx1 += num19;
|
||||
if (!flag2)
|
||||
{
|
||||
while (idx1 < num3)
|
||||
{
|
||||
if (this.Category((int)s1[idx1]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (ptr[2] == 0)
|
||||
{
|
||||
ptr[2] = 2;
|
||||
}
|
||||
ptr[2] = ptr[2] + this.Level2((int)s1[idx1], SimpleCollator.ExtenderType.None);
|
||||
idx1++;
|
||||
}
|
||||
while (idx2 < num4)
|
||||
{
|
||||
if (this.Category((int)s2[idx2]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (ptr2[2] == 0)
|
||||
{
|
||||
ptr2[2] = 2;
|
||||
}
|
||||
ptr2[2] = ptr2[2] + this.Level2((int)s2[idx2], SimpleCollator.ExtenderType.None);
|
||||
idx2++;
|
||||
}
|
||||
}
|
||||
int num20 = (int)(*ptr - *ptr2);
|
||||
num20 = ((num20 == 0) ? ((int)(ptr[1] - ptr2[1])) : num20);
|
||||
if (num20 != 0)
|
||||
{
|
||||
return num20;
|
||||
}
|
||||
if (num6 != 1)
|
||||
{
|
||||
if (!flag2)
|
||||
{
|
||||
num20 = (int)(ptr[2] - ptr2[2]);
|
||||
if (num20 != 0)
|
||||
{
|
||||
num5 = num20;
|
||||
if (immediateBreakup)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
num6 = ((!this.frenchSort) ? 1 : 2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (num6 != 2)
|
||||
{
|
||||
num20 = (int)(ptr[3] - ptr2[3]);
|
||||
if (num20 != 0)
|
||||
{
|
||||
num5 = num20;
|
||||
if (immediateBreakup)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
num6 = 2;
|
||||
}
|
||||
else if (num6 != 3)
|
||||
{
|
||||
if (flag3 != flag4)
|
||||
{
|
||||
if (immediateBreakup)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
num5 = ((!flag3) ? (-1) : 1);
|
||||
num6 = 3;
|
||||
}
|
||||
else if (flag3)
|
||||
{
|
||||
num20 = this.CompareFlagPair(!MSCompatUnicodeTable.IsJapaneseSmallLetter((char)num17), !MSCompatUnicodeTable.IsJapaneseSmallLetter((char)num18));
|
||||
num20 = ((num20 == 0) ? ((int)(SimpleCollator.ToDashTypeValue(extenderType, option) - SimpleCollator.ToDashTypeValue(extenderType2, option))) : num20);
|
||||
num20 = ((num20 == 0) ? this.CompareFlagPair(MSCompatUnicodeTable.IsHiragana((char)num17), MSCompatUnicodeTable.IsHiragana((char)num18)) : num20);
|
||||
num20 = ((num20 == 0) ? this.CompareFlagPair(!SimpleCollator.IsHalfKana((int)((ushort)num17), option), !SimpleCollator.IsHalfKana((int)((ushort)num18), option)) : num20);
|
||||
if (num20 != 0)
|
||||
{
|
||||
if (immediateBreakup)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
num5 = num20;
|
||||
num6 = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag2 && num5 != 0 && num6 > 2)
|
||||
{
|
||||
while (idx1 < num3 && idx2 < num4)
|
||||
{
|
||||
if (!MSCompatUnicodeTable.IsIgnorableNonSpacing((int)s1[idx1]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!MSCompatUnicodeTable.IsIgnorableNonSpacing((int)s2[idx2]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
num5 = (int)(this.Level2(this.FilterOptions((int)s1[idx1], option), extenderType) - this.Level2(this.FilterOptions((int)s2[idx2], option), extenderType2));
|
||||
if (num5 != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx1++;
|
||||
idx2++;
|
||||
extenderType = SimpleCollator.ExtenderType.None;
|
||||
extenderType2 = SimpleCollator.ExtenderType.None;
|
||||
}
|
||||
}
|
||||
if (num6 == 1 && num5 != 0)
|
||||
{
|
||||
while (idx1 < num3)
|
||||
{
|
||||
if (!MSCompatUnicodeTable.IsIgnorableNonSpacing((int)s1[idx1]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx1++;
|
||||
}
|
||||
while (idx2 < num4)
|
||||
{
|
||||
if (!MSCompatUnicodeTable.IsIgnorableNonSpacing((int)s2[idx2]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx2++;
|
||||
}
|
||||
}
|
||||
if (num5 == 0)
|
||||
{
|
||||
if (num7 < 0 && num8 >= 0)
|
||||
{
|
||||
num5 = -1;
|
||||
}
|
||||
else if (num8 < 0 && num7 >= 0)
|
||||
{
|
||||
num5 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num5 = num7 - num8;
|
||||
if (num5 == 0)
|
||||
{
|
||||
num5 = num9 - num10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num5 == 0)
|
||||
{
|
||||
if (idx2 == num4)
|
||||
{
|
||||
targetConsumed = true;
|
||||
}
|
||||
if (idx1 == num3)
|
||||
{
|
||||
sourceConsumed = true;
|
||||
}
|
||||
}
|
||||
return (idx1 == num3) ? ((idx2 != num4) ? (-1) : num5) : 1;
|
||||
}
|
||||
|
||||
// Token: 0x060007FA RID: 2042 RVA: 0x0001BD38 File Offset: 0x00019F38
|
||||
private int CompareFlagPair(bool b1, bool b2)
|
||||
{
|
||||
return (b1 != b2) ? ((!b1) ? (-1) : 1) : 0;
|
||||
}
|
||||
|
||||
// Token: 0x060007FB RID: 2043 RVA: 0x0001BD54 File Offset: 0x00019F54
|
||||
public bool IsPrefix(string src, string target, CompareOptions opt)
|
||||
{
|
||||
return this.IsPrefix(src, target, 0, src.Length, opt);
|
||||
}
|
||||
|
||||
// Token: 0x060007FC RID: 2044 RVA: 0x0001BD74 File Offset: 0x00019F74
|
||||
public unsafe bool IsPrefix(string s, string target, int start, int length, CompareOptions opt)
|
||||
{
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
byte* ptr;
|
||||
byte* ptr2;
|
||||
checked
|
||||
{
|
||||
ptr = stackalloc byte[4 * 1];
|
||||
ptr2 = stackalloc byte[4 * 1];
|
||||
this.ClearBuffer(ptr, 4);
|
||||
this.ClearBuffer(ptr2, 4);
|
||||
}
|
||||
SimpleCollator.Context context = new SimpleCollator.Context(opt, null, null, ptr, ptr2, null, this.QuickCheckPossible(s, start, start + length, target, 0, target.Length));
|
||||
return this.IsPrefix(s, target, start, length, true, ref context);
|
||||
}
|
||||
|
||||
// Token: 0x060007FD RID: 2045 RVA: 0x0001BDE0 File Offset: 0x00019FE0
|
||||
private bool IsPrefix(string s, string target, int start, int length, bool skipHeadingExtenders, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
bool flag;
|
||||
bool flag2;
|
||||
this.CompareInternal(s, start, length, target, 0, target.Length, out flag, out flag2, skipHeadingExtenders, true, ref ctx);
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x060007FE RID: 2046 RVA: 0x0001BE0C File Offset: 0x0001A00C
|
||||
public bool IsSuffix(string src, string target, CompareOptions opt)
|
||||
{
|
||||
return this.IsSuffix(src, target, src.Length - 1, src.Length, opt);
|
||||
}
|
||||
|
||||
// Token: 0x060007FF RID: 2047 RVA: 0x0001BE30 File Offset: 0x0001A030
|
||||
public bool IsSuffix(string s, string target, int start, int length, CompareOptions opt)
|
||||
{
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int num = this.LastIndexOf(s, target, start, length, opt);
|
||||
return num >= 0 && this.Compare(s, num, s.Length - num, target, 0, target.Length, opt) == 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000800 RID: 2048 RVA: 0x0001BE80 File Offset: 0x0001A080
|
||||
public int IndexOf(string s, string target, CompareOptions opt)
|
||||
{
|
||||
return this.IndexOf(s, target, 0, s.Length, opt);
|
||||
}
|
||||
|
||||
// Token: 0x06000801 RID: 2049 RVA: 0x0001BEA0 File Offset: 0x0001A0A0
|
||||
private int QuickIndexOf(string s, string target, int start, int length, out bool testWasUnable)
|
||||
{
|
||||
int num = -1;
|
||||
int num2 = -1;
|
||||
testWasUnable = true;
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (target.Length > length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
testWasUnable = false;
|
||||
int num3 = start + length - target.Length + 1;
|
||||
for (int i = start; i < num3; i++)
|
||||
{
|
||||
bool flag = false;
|
||||
for (int j = 0; j < target.Length; j++)
|
||||
{
|
||||
if (num2 < j)
|
||||
{
|
||||
if (target[j] >= '\u0080')
|
||||
{
|
||||
testWasUnable = true;
|
||||
return -1;
|
||||
}
|
||||
num2 = j;
|
||||
}
|
||||
if (num < i + j)
|
||||
{
|
||||
if (s[i + j] >= '\u0080')
|
||||
{
|
||||
testWasUnable = true;
|
||||
return -1;
|
||||
}
|
||||
num = i + j;
|
||||
}
|
||||
if (s[i + j] != target[j])
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000802 RID: 2050 RVA: 0x0001BF90 File Offset: 0x0001A190
|
||||
public unsafe int IndexOf(string s, string target, int start, int length, CompareOptions opt)
|
||||
{
|
||||
if (opt == CompareOptions.Ordinal)
|
||||
{
|
||||
return this.IndexOfOrdinal(s, target, start, length);
|
||||
}
|
||||
if (opt == CompareOptions.OrdinalIgnoreCase)
|
||||
{
|
||||
return this.IndexOfOrdinalIgnoreCase(s, target, start, length);
|
||||
}
|
||||
if (opt == CompareOptions.None)
|
||||
{
|
||||
bool flag;
|
||||
int num = this.QuickIndexOf(s, target, start, length, out flag);
|
||||
if (!flag)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
}
|
||||
checked
|
||||
{
|
||||
byte* ptr = stackalloc byte[16 * 1];
|
||||
byte* ptr2 = stackalloc byte[16 * 1];
|
||||
byte* ptr3 = stackalloc byte[4 * 1];
|
||||
byte* ptr4 = stackalloc byte[4 * 1];
|
||||
byte* ptr5 = stackalloc byte[4 * 1];
|
||||
this.ClearBuffer(ptr, 16);
|
||||
this.ClearBuffer(ptr2, 16);
|
||||
this.ClearBuffer(ptr3, 4);
|
||||
this.ClearBuffer(ptr4, 4);
|
||||
this.ClearBuffer(ptr5, 4);
|
||||
SimpleCollator.Context context = new SimpleCollator.Context(opt, ptr, ptr2, ptr4, ptr5, null, false);
|
||||
return this.IndexOf(s, target, start, length, ptr3, ref context);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000803 RID: 2051 RVA: 0x0001C05C File Offset: 0x0001A25C
|
||||
private int IndexOfOrdinal(string s, string target, int start, int length)
|
||||
{
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (target.Length > length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = start + length - target.Length + 1;
|
||||
for (int i = start; i < num; i++)
|
||||
{
|
||||
bool flag = false;
|
||||
for (int j = 0; j < target.Length; j++)
|
||||
{
|
||||
if (s[i + j] != target[j])
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000804 RID: 2052 RVA: 0x0001C0E8 File Offset: 0x0001A2E8
|
||||
private int IndexOfOrdinalIgnoreCase(string s, string target, int start, int length)
|
||||
{
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (target.Length > length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = start + length - target.Length + 1;
|
||||
for (int i = start; i < num; i++)
|
||||
{
|
||||
bool flag = false;
|
||||
for (int j = 0; j < target.Length; j++)
|
||||
{
|
||||
if (this.textInfo.ToLower(s[i + j]) != this.textInfo.ToLower(target[j]))
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000805 RID: 2053 RVA: 0x0001C18C File Offset: 0x0001A38C
|
||||
public int IndexOf(string s, char target, CompareOptions opt)
|
||||
{
|
||||
return this.IndexOf(s, target, 0, s.Length, opt);
|
||||
}
|
||||
|
||||
// Token: 0x06000806 RID: 2054 RVA: 0x0001C1AC File Offset: 0x0001A3AC
|
||||
public unsafe int IndexOf(string s, char target, int start, int length, CompareOptions opt)
|
||||
{
|
||||
if (opt == CompareOptions.Ordinal)
|
||||
{
|
||||
return this.IndexOfOrdinal(s, target, start, length);
|
||||
}
|
||||
if (opt == CompareOptions.OrdinalIgnoreCase)
|
||||
{
|
||||
return this.IndexOfOrdinalIgnoreCase(s, target, start, length);
|
||||
}
|
||||
byte* ptr3;
|
||||
byte* ptr5;
|
||||
SimpleCollator.Context context;
|
||||
Contraction contraction;
|
||||
checked
|
||||
{
|
||||
byte* ptr = stackalloc byte[16 * 1];
|
||||
byte* ptr2 = stackalloc byte[16 * 1];
|
||||
ptr3 = stackalloc byte[4 * 1];
|
||||
byte* ptr4 = stackalloc byte[4 * 1];
|
||||
ptr5 = stackalloc byte[4 * 1];
|
||||
this.ClearBuffer(ptr, 16);
|
||||
this.ClearBuffer(ptr2, 16);
|
||||
this.ClearBuffer(ptr3, 4);
|
||||
this.ClearBuffer(ptr4, 4);
|
||||
this.ClearBuffer(ptr5, 4);
|
||||
context = new SimpleCollator.Context(opt, ptr, ptr2, ptr4, ptr5, null, false);
|
||||
contraction = this.GetContraction(target);
|
||||
}
|
||||
if (contraction == null)
|
||||
{
|
||||
int num = this.FilterOptions((int)target, opt);
|
||||
*ptr3 = this.Category(num);
|
||||
ptr3[1] = this.Level1(num);
|
||||
if ((opt & CompareOptions.IgnoreNonSpace) == CompareOptions.None)
|
||||
{
|
||||
ptr3[2] = this.Level2(num, SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
ptr3[3] = MSCompatUnicodeTable.Level3(num);
|
||||
return this.IndexOfSortKey(s, start, length, ptr3, target, num, !MSCompatUnicodeTable.HasSpecialWeight((char)num), ref context);
|
||||
}
|
||||
if (contraction.Replacement != null)
|
||||
{
|
||||
return this.IndexOf(s, contraction.Replacement, start, length, ptr3, ref context);
|
||||
}
|
||||
for (int i = 0; i < contraction.SortKey.Length; i++)
|
||||
{
|
||||
ptr5[i] = contraction.SortKey[i];
|
||||
}
|
||||
return this.IndexOfSortKey(s, start, length, ptr5, '\0', -1, true, ref context);
|
||||
}
|
||||
|
||||
// Token: 0x06000807 RID: 2055 RVA: 0x0001C314 File Offset: 0x0001A514
|
||||
private int IndexOfOrdinal(string s, char target, int start, int length)
|
||||
{
|
||||
int num = start + length;
|
||||
for (int i = start; i < num; i++)
|
||||
{
|
||||
if (s[i] == target)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000808 RID: 2056 RVA: 0x0001C348 File Offset: 0x0001A548
|
||||
private int IndexOfOrdinalIgnoreCase(string s, char target, int start, int length)
|
||||
{
|
||||
int num = start + length;
|
||||
target = this.textInfo.ToLower(target);
|
||||
for (int i = start; i < num; i++)
|
||||
{
|
||||
if (this.textInfo.ToLower(s[i]) == target)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000809 RID: 2057 RVA: 0x0001C398 File Offset: 0x0001A598
|
||||
private unsafe int IndexOfSortKey(string s, int start, int length, byte* sortkey, char target, int ti, bool noLv4, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
int num = start + length;
|
||||
int i = start;
|
||||
while (i < num)
|
||||
{
|
||||
int num2 = i;
|
||||
if (this.MatchesForward(s, ref i, num, ti, sortkey, noLv4, ref ctx))
|
||||
{
|
||||
return num2;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600080A RID: 2058 RVA: 0x0001C3D4 File Offset: 0x0001A5D4
|
||||
private unsafe int IndexOf(string s, string target, int start, int length, byte* targetSortKey, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
CompareOptions option = ctx.Option;
|
||||
int i;
|
||||
for (i = 0; i < target.Length; i++)
|
||||
{
|
||||
if (!SimpleCollator.IsIgnorable((int)target[i], option))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == target.Length)
|
||||
{
|
||||
return start;
|
||||
}
|
||||
Contraction contraction = this.GetContraction(target, i, target.Length - i);
|
||||
string text = ((contraction == null) ? null : contraction.Replacement);
|
||||
byte* ptr = ((text != null) ? null : targetSortKey);
|
||||
bool flag = true;
|
||||
char c = '\0';
|
||||
int num = -1;
|
||||
if (contraction != null && ptr != null)
|
||||
{
|
||||
for (int j = 0; j < contraction.SortKey.Length; j++)
|
||||
{
|
||||
ptr[j] = contraction.SortKey[j];
|
||||
}
|
||||
}
|
||||
else if (ptr != null)
|
||||
{
|
||||
c = target[i];
|
||||
num = this.FilterOptions((int)target[i], option);
|
||||
*ptr = this.Category(num);
|
||||
ptr[1] = this.Level1(num);
|
||||
if ((option & CompareOptions.IgnoreNonSpace) == CompareOptions.None)
|
||||
{
|
||||
ptr[2] = this.Level2(num, SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
ptr[3] = MSCompatUnicodeTable.Level3(num);
|
||||
flag = !MSCompatUnicodeTable.HasSpecialWeight((char)num);
|
||||
}
|
||||
if (ptr != null)
|
||||
{
|
||||
for (i++; i < target.Length; i++)
|
||||
{
|
||||
if (this.Category((int)target[i]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (ptr[2] == 0)
|
||||
{
|
||||
ptr[2] = 2;
|
||||
}
|
||||
ptr[2] = ptr[2] + this.Level2((int)target[i], SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
int num2;
|
||||
if (text != null)
|
||||
{
|
||||
num2 = this.IndexOf(s, text, start, length, targetSortKey, ref ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = this.IndexOfSortKey(s, start, length, ptr, c, num, flag, ref ctx);
|
||||
}
|
||||
if (num2 < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
length -= num2 - start;
|
||||
start = num2;
|
||||
if (this.IsPrefix(s, target, start, length, false, ref ctx))
|
||||
{
|
||||
return num2;
|
||||
}
|
||||
Contraction contraction2 = this.GetContraction(s, start, length);
|
||||
if (contraction2 != null)
|
||||
{
|
||||
start += contraction2.Source.Length;
|
||||
length -= contraction2.Source.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
start++;
|
||||
length--;
|
||||
}
|
||||
if (length <= 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600080B RID: 2059 RVA: 0x0001C614 File Offset: 0x0001A814
|
||||
public int LastIndexOf(string s, string target, CompareOptions opt)
|
||||
{
|
||||
return this.LastIndexOf(s, target, s.Length - 1, s.Length, opt);
|
||||
}
|
||||
|
||||
// Token: 0x0600080C RID: 2060 RVA: 0x0001C638 File Offset: 0x0001A838
|
||||
public unsafe int LastIndexOf(string s, string target, int start, int length, CompareOptions opt)
|
||||
{
|
||||
if (opt == CompareOptions.Ordinal)
|
||||
{
|
||||
return this.LastIndexOfOrdinal(s, target, start, length);
|
||||
}
|
||||
if (opt == CompareOptions.OrdinalIgnoreCase)
|
||||
{
|
||||
return this.LastIndexOfOrdinalIgnoreCase(s, target, start, length);
|
||||
}
|
||||
checked
|
||||
{
|
||||
byte* ptr = stackalloc byte[16 * 1];
|
||||
byte* ptr2 = stackalloc byte[16 * 1];
|
||||
byte* ptr3 = stackalloc byte[4 * 1];
|
||||
byte* ptr4 = stackalloc byte[4 * 1];
|
||||
byte* ptr5 = stackalloc byte[4 * 1];
|
||||
this.ClearBuffer(ptr, 16);
|
||||
this.ClearBuffer(ptr2, 16);
|
||||
this.ClearBuffer(ptr3, 4);
|
||||
this.ClearBuffer(ptr4, 4);
|
||||
this.ClearBuffer(ptr5, 4);
|
||||
SimpleCollator.Context context = new SimpleCollator.Context(opt, ptr, ptr2, ptr4, ptr5, null, false);
|
||||
return this.LastIndexOf(s, target, start, length, ptr3, ref context);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600080D RID: 2061 RVA: 0x0001C6E0 File Offset: 0x0001A8E0
|
||||
private int LastIndexOfOrdinal(string s, string target, int start, int length)
|
||||
{
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (s.Length < target.Length || target.Length > length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = start - length + target.Length - 1;
|
||||
char c = target[target.Length - 1];
|
||||
int i = start;
|
||||
while (i > num)
|
||||
{
|
||||
if (s[i] != c)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = i - target.Length + 1;
|
||||
i--;
|
||||
bool flag = false;
|
||||
for (int j = target.Length - 2; j >= 0; j--)
|
||||
{
|
||||
if (s[num2 + j] != target[j])
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600080E RID: 2062 RVA: 0x0001C7B8 File Offset: 0x0001A9B8
|
||||
private int LastIndexOfOrdinalIgnoreCase(string s, string target, int start, int length)
|
||||
{
|
||||
if (target.Length == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (s.Length < length || target.Length > length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = start - length + target.Length - 1;
|
||||
char c = this.textInfo.ToLower(target[target.Length - 1]);
|
||||
int i = start;
|
||||
while (i > num)
|
||||
{
|
||||
if (this.textInfo.ToLower(s[i]) != c)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = i - target.Length + 1;
|
||||
i--;
|
||||
bool flag = false;
|
||||
for (int j = target.Length - 2; j >= 0; j--)
|
||||
{
|
||||
if (this.textInfo.ToLower(s[num2 + j]) != this.textInfo.ToLower(target[j]))
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
return num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600080F RID: 2063 RVA: 0x0001C8B8 File Offset: 0x0001AAB8
|
||||
public int LastIndexOf(string s, char target, CompareOptions opt)
|
||||
{
|
||||
return this.LastIndexOf(s, target, s.Length - 1, s.Length, opt);
|
||||
}
|
||||
|
||||
// Token: 0x06000810 RID: 2064 RVA: 0x0001C8DC File Offset: 0x0001AADC
|
||||
public unsafe int LastIndexOf(string s, char target, int start, int length, CompareOptions opt)
|
||||
{
|
||||
if (opt == CompareOptions.Ordinal)
|
||||
{
|
||||
return this.LastIndexOfOrdinal(s, target, start, length);
|
||||
}
|
||||
if (opt == CompareOptions.OrdinalIgnoreCase)
|
||||
{
|
||||
return this.LastIndexOfOrdinalIgnoreCase(s, target, start, length);
|
||||
}
|
||||
byte* ptr3;
|
||||
byte* ptr5;
|
||||
SimpleCollator.Context context;
|
||||
Contraction contraction;
|
||||
checked
|
||||
{
|
||||
byte* ptr = stackalloc byte[16 * 1];
|
||||
byte* ptr2 = stackalloc byte[16 * 1];
|
||||
ptr3 = stackalloc byte[4 * 1];
|
||||
byte* ptr4 = stackalloc byte[4 * 1];
|
||||
ptr5 = stackalloc byte[4 * 1];
|
||||
this.ClearBuffer(ptr, 16);
|
||||
this.ClearBuffer(ptr2, 16);
|
||||
this.ClearBuffer(ptr3, 4);
|
||||
this.ClearBuffer(ptr4, 4);
|
||||
this.ClearBuffer(ptr5, 4);
|
||||
context = new SimpleCollator.Context(opt, ptr, ptr2, ptr4, ptr5, null, false);
|
||||
contraction = this.GetContraction(target);
|
||||
}
|
||||
if (contraction == null)
|
||||
{
|
||||
int num = this.FilterOptions((int)target, opt);
|
||||
*ptr3 = this.Category(num);
|
||||
ptr3[1] = this.Level1(num);
|
||||
if ((opt & CompareOptions.IgnoreNonSpace) == CompareOptions.None)
|
||||
{
|
||||
ptr3[2] = this.Level2(num, SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
ptr3[3] = MSCompatUnicodeTable.Level3(num);
|
||||
return this.LastIndexOfSortKey(s, start, start, length, ptr3, num, !MSCompatUnicodeTable.HasSpecialWeight((char)num), ref context);
|
||||
}
|
||||
if (contraction.Replacement != null)
|
||||
{
|
||||
return this.LastIndexOf(s, contraction.Replacement, start, length, ptr3, ref context);
|
||||
}
|
||||
for (int i = 0; i < contraction.SortKey.Length; i++)
|
||||
{
|
||||
ptr5[i] = contraction.SortKey[i];
|
||||
}
|
||||
return this.LastIndexOfSortKey(s, start, start, length, ptr5, -1, true, ref context);
|
||||
}
|
||||
|
||||
// Token: 0x06000811 RID: 2065 RVA: 0x0001CA44 File Offset: 0x0001AC44
|
||||
private int LastIndexOfOrdinal(string s, char target, int start, int length)
|
||||
{
|
||||
if (s.Length == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = start - length;
|
||||
for (int i = start; i > num; i--)
|
||||
{
|
||||
if (s[i] == target)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000812 RID: 2066 RVA: 0x0001CA88 File Offset: 0x0001AC88
|
||||
private int LastIndexOfOrdinalIgnoreCase(string s, char target, int start, int length)
|
||||
{
|
||||
if (s.Length == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int num = start - length;
|
||||
char c = this.textInfo.ToUpper(target);
|
||||
for (int i = start; i > num; i--)
|
||||
{
|
||||
if (this.textInfo.ToUpper(s[i]) == c)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000813 RID: 2067 RVA: 0x0001CAE4 File Offset: 0x0001ACE4
|
||||
private unsafe int LastIndexOfSortKey(string s, int start, int orgStart, int length, byte* sortkey, int ti, bool noLv4, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
int num = start - length;
|
||||
int i = start;
|
||||
while (i > num)
|
||||
{
|
||||
int num2 = i;
|
||||
if (this.MatchesBackward(s, ref i, num, orgStart, ti, sortkey, noLv4, ref ctx))
|
||||
{
|
||||
return num2;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06000814 RID: 2068 RVA: 0x0001CB24 File Offset: 0x0001AD24
|
||||
private unsafe int LastIndexOf(string s, string target, int start, int length, byte* targetSortKey, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
CompareOptions option = ctx.Option;
|
||||
int num = start;
|
||||
int i;
|
||||
for (i = 0; i < target.Length; i++)
|
||||
{
|
||||
if (!SimpleCollator.IsIgnorable((int)target[i], option))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == target.Length)
|
||||
{
|
||||
return start;
|
||||
}
|
||||
Contraction contraction = this.GetContraction(target, i, target.Length - i);
|
||||
string text = ((contraction == null) ? null : contraction.Replacement);
|
||||
byte* ptr = ((text != null) ? null : targetSortKey);
|
||||
bool flag = true;
|
||||
int num2 = -1;
|
||||
if (contraction != null && ptr != null)
|
||||
{
|
||||
for (int j = 0; j < contraction.SortKey.Length; j++)
|
||||
{
|
||||
ptr[j] = contraction.SortKey[j];
|
||||
}
|
||||
}
|
||||
else if (ptr != null)
|
||||
{
|
||||
num2 = this.FilterOptions((int)target[i], option);
|
||||
*ptr = this.Category(num2);
|
||||
ptr[1] = this.Level1(num2);
|
||||
if ((option & CompareOptions.IgnoreNonSpace) == CompareOptions.None)
|
||||
{
|
||||
ptr[2] = this.Level2(num2, SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
ptr[3] = MSCompatUnicodeTable.Level3(num2);
|
||||
flag = !MSCompatUnicodeTable.HasSpecialWeight((char)num2);
|
||||
}
|
||||
if (ptr != null)
|
||||
{
|
||||
for (i++; i < target.Length; i++)
|
||||
{
|
||||
if (this.Category((int)target[i]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (ptr[2] == 0)
|
||||
{
|
||||
ptr[2] = 2;
|
||||
}
|
||||
ptr[2] = ptr[2] + this.Level2((int)target[i], SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
}
|
||||
int k;
|
||||
for (;;)
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
k = this.LastIndexOf(s, text, start, length, targetSortKey, ref ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
k = this.LastIndexOfSortKey(s, start, num, length, ptr, num2, flag, ref ctx);
|
||||
}
|
||||
if (k < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
length -= start - k;
|
||||
start = k;
|
||||
if (this.IsPrefix(s, target, k, num - k + 1, false, ref ctx))
|
||||
{
|
||||
goto Block_15;
|
||||
}
|
||||
Contraction contraction2 = this.GetContraction(s, k, num - k + 1);
|
||||
if (contraction2 != null)
|
||||
{
|
||||
start -= contraction2.Source.Length;
|
||||
length -= contraction2.Source.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
start--;
|
||||
length--;
|
||||
}
|
||||
if (length <= 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
Block_15:
|
||||
while (k < num)
|
||||
{
|
||||
if (!SimpleCollator.IsIgnorable((int)s[k], option))
|
||||
{
|
||||
break;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
// Token: 0x06000815 RID: 2069 RVA: 0x0001CD94 File Offset: 0x0001AF94
|
||||
private unsafe bool MatchesForward(string s, ref int idx, int end, int ti, byte* sortkey, bool noLv4, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
int num = (int)s[idx];
|
||||
if (ctx.AlwaysMatchFlags != null && num < 128 && ((int)ctx.AlwaysMatchFlags[num / 8] & (1 << num % 8)) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ctx.NeverMatchFlags != null && num < 128 && ((int)ctx.NeverMatchFlags[num / 8] & (1 << num % 8)) != 0)
|
||||
{
|
||||
idx++;
|
||||
return false;
|
||||
}
|
||||
SimpleCollator.ExtenderType extenderType = this.GetExtenderType((int)s[idx]);
|
||||
Contraction contraction = null;
|
||||
if (this.MatchesForwardCore(s, ref idx, end, ti, sortkey, noLv4, extenderType, ref contraction, ref ctx))
|
||||
{
|
||||
if (ctx.AlwaysMatchFlags != null && contraction == null && extenderType == SimpleCollator.ExtenderType.None && num < 128)
|
||||
{
|
||||
byte* ptr = ctx.AlwaysMatchFlags + num / 8;
|
||||
*ptr |= (byte)(1 << num % 8);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (ctx.NeverMatchFlags != null && contraction == null && extenderType == SimpleCollator.ExtenderType.None && num < 128)
|
||||
{
|
||||
byte* ptr2 = ctx.NeverMatchFlags + num / 8;
|
||||
*ptr2 |= (byte)(1 << num % 8);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000816 RID: 2070 RVA: 0x0001CEBC File Offset: 0x0001B0BC
|
||||
private unsafe bool MatchesForwardCore(string s, ref int idx, int end, int ti, byte* sortkey, bool noLv4, SimpleCollator.ExtenderType ext, ref Contraction ct, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
CompareOptions option = ctx.Option;
|
||||
byte* ptr = ctx.Buffer1;
|
||||
bool flag = (option & CompareOptions.IgnoreNonSpace) != CompareOptions.None;
|
||||
int num = -1;
|
||||
if (ext == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
ct = this.GetContraction(s, idx, end);
|
||||
}
|
||||
else if (ctx.PrevCode < 0)
|
||||
{
|
||||
if (ctx.PrevSortKey == null)
|
||||
{
|
||||
idx++;
|
||||
return false;
|
||||
}
|
||||
ptr = ctx.PrevSortKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = this.FilterExtender(ctx.PrevCode, ext, option);
|
||||
}
|
||||
if (ct != null)
|
||||
{
|
||||
idx += ct.Source.Length;
|
||||
if (!noLv4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (ct.SortKey == null)
|
||||
{
|
||||
int num2 = 0;
|
||||
return this.MatchesForward(ct.Replacement, ref num2, ct.Replacement.Length, ti, sortkey, noLv4, ref ctx);
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
ptr[i] = sortkey[i];
|
||||
}
|
||||
ctx.PrevCode = -1;
|
||||
ctx.PrevSortKey = ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num < 0)
|
||||
{
|
||||
num = this.FilterOptions((int)s[idx], option);
|
||||
}
|
||||
idx++;
|
||||
*ptr = this.Category(num);
|
||||
bool flag2 = false;
|
||||
if (*sortkey == *ptr)
|
||||
{
|
||||
ptr[1] = this.Level1(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
if (!flag && sortkey[1] == ptr[1])
|
||||
{
|
||||
ptr[2] = this.Level2(num, ext);
|
||||
}
|
||||
else if (!flag)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
while (idx < end)
|
||||
{
|
||||
if (this.Category((int)s[idx]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
ptr[3] = MSCompatUnicodeTable.Level3(num);
|
||||
if (*ptr != 1)
|
||||
{
|
||||
ctx.PrevCode = num;
|
||||
}
|
||||
}
|
||||
while (idx < end)
|
||||
{
|
||||
if (this.Category((int)s[idx]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
if (ptr[2] == 0)
|
||||
{
|
||||
ptr[2] = 2;
|
||||
}
|
||||
ptr[2] = ptr[2] + this.Level2((int)s[idx], SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
return this.MatchesPrimitive(option, ptr, num, ext, sortkey, ti, noLv4);
|
||||
}
|
||||
|
||||
// Token: 0x06000817 RID: 2071 RVA: 0x0001D104 File Offset: 0x0001B304
|
||||
private unsafe bool MatchesPrimitive(CompareOptions opt, byte* source, int si, SimpleCollator.ExtenderType ext, byte* target, int ti, bool noLv4)
|
||||
{
|
||||
bool flag = (opt & CompareOptions.IgnoreNonSpace) != CompareOptions.None;
|
||||
return *source == *target && source[1] == target[1] && (flag || source[2] == target[2]) && source[3] == target[3] && ((noLv4 && (si < 0 || !MSCompatUnicodeTable.HasSpecialWeight((char)si))) || (!noLv4 && (flag || ext != SimpleCollator.ExtenderType.Conditional) && MSCompatUnicodeTable.IsJapaneseSmallLetter((char)si) == MSCompatUnicodeTable.IsJapaneseSmallLetter((char)ti) && SimpleCollator.ToDashTypeValue(ext, opt) == SimpleCollator.ToDashTypeValue(SimpleCollator.ExtenderType.None, opt) && !MSCompatUnicodeTable.IsHiragana((char)si) == !MSCompatUnicodeTable.IsHiragana((char)ti) && SimpleCollator.IsHalfKana((int)((ushort)si), opt) == SimpleCollator.IsHalfKana((int)((ushort)ti), opt)));
|
||||
}
|
||||
|
||||
// Token: 0x06000818 RID: 2072 RVA: 0x0001D1E8 File Offset: 0x0001B3E8
|
||||
private unsafe bool MatchesBackward(string s, ref int idx, int end, int orgStart, int ti, byte* sortkey, bool noLv4, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
int num = (int)s[idx];
|
||||
if (ctx.AlwaysMatchFlags != null && num < 128 && ((int)ctx.AlwaysMatchFlags[num / 8] & (1 << num % 8)) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ctx.NeverMatchFlags != null && num < 128 && ((int)ctx.NeverMatchFlags[num / 8] & (1 << num % 8)) != 0)
|
||||
{
|
||||
idx--;
|
||||
return false;
|
||||
}
|
||||
SimpleCollator.ExtenderType extenderType = this.GetExtenderType((int)s[idx]);
|
||||
Contraction contraction = null;
|
||||
if (this.MatchesBackwardCore(s, ref idx, end, orgStart, ti, sortkey, noLv4, extenderType, ref contraction, ref ctx))
|
||||
{
|
||||
if (ctx.AlwaysMatchFlags != null && contraction == null && extenderType == SimpleCollator.ExtenderType.None && num < 128)
|
||||
{
|
||||
byte* ptr = ctx.AlwaysMatchFlags + num / 8;
|
||||
*ptr |= (byte)(1 << num % 8);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (ctx.NeverMatchFlags != null && contraction == null && extenderType == SimpleCollator.ExtenderType.None && num < 128)
|
||||
{
|
||||
byte* ptr2 = ctx.NeverMatchFlags + num / 8;
|
||||
*ptr2 |= (byte)(1 << num % 8);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000819 RID: 2073 RVA: 0x0001D314 File Offset: 0x0001B514
|
||||
private unsafe bool MatchesBackwardCore(string s, ref int idx, int end, int orgStart, int ti, byte* sortkey, bool noLv4, SimpleCollator.ExtenderType ext, ref Contraction ct, ref SimpleCollator.Context ctx)
|
||||
{
|
||||
CompareOptions option = ctx.Option;
|
||||
byte* buffer = ctx.Buffer1;
|
||||
bool flag = (option & CompareOptions.IgnoreNonSpace) != CompareOptions.None;
|
||||
int num = idx;
|
||||
int num2 = -1;
|
||||
if (ext != SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
byte b = 0;
|
||||
for (int i = 0; i >= 0; i--)
|
||||
{
|
||||
if (!SimpleCollator.IsIgnorable((int)s[i], option))
|
||||
{
|
||||
int num3 = this.FilterOptions((int)s[i], option);
|
||||
byte b2 = this.Category(num3);
|
||||
if (b2 != 1)
|
||||
{
|
||||
num2 = this.FilterExtender(num3, ext, option);
|
||||
*buffer = b2;
|
||||
buffer[1] = this.Level1(num2);
|
||||
if (!flag)
|
||||
{
|
||||
buffer[2] = this.Level2(num2, ext);
|
||||
}
|
||||
buffer[3] = MSCompatUnicodeTable.Level3(num2);
|
||||
if (ext != SimpleCollator.ExtenderType.Conditional && b != 0)
|
||||
{
|
||||
buffer[2] = ((buffer[2] != 0) ? b : (b + 2));
|
||||
}
|
||||
idx--;
|
||||
goto IL_101;
|
||||
}
|
||||
b = this.Level2(num3, SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
IL_101:
|
||||
if (ext == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
ct = this.GetTailContraction(s, idx, end);
|
||||
}
|
||||
if (ct != null)
|
||||
{
|
||||
idx -= ct.Source.Length;
|
||||
if (!noLv4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (ct.SortKey == null)
|
||||
{
|
||||
int num4 = ct.Replacement.Length - 1;
|
||||
return 0 <= this.LastIndexOfSortKey(ct.Replacement, num4, num4, ct.Replacement.Length, sortkey, ti, noLv4, ref ctx);
|
||||
}
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
buffer[j] = sortkey[j];
|
||||
}
|
||||
ctx.PrevCode = -1;
|
||||
ctx.PrevSortKey = buffer;
|
||||
}
|
||||
else if (ext == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
if (num2 < 0)
|
||||
{
|
||||
num2 = this.FilterOptions((int)s[idx], option);
|
||||
}
|
||||
idx--;
|
||||
bool flag2 = false;
|
||||
*buffer = this.Category(num2);
|
||||
if (*buffer == *sortkey)
|
||||
{
|
||||
buffer[1] = this.Level1(num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
if (!flag && buffer[1] == sortkey[1])
|
||||
{
|
||||
buffer[2] = this.Level2(num2, ext);
|
||||
}
|
||||
else if (!flag)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
buffer[3] = MSCompatUnicodeTable.Level3(num2);
|
||||
if (*buffer != 1)
|
||||
{
|
||||
ctx.PrevCode = num2;
|
||||
}
|
||||
}
|
||||
if (ext == SimpleCollator.ExtenderType.None)
|
||||
{
|
||||
for (int k = num + 1; k < orgStart; k++)
|
||||
{
|
||||
if (this.Category((int)s[k]) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
if (buffer[2] == 0)
|
||||
{
|
||||
buffer[2] = 2;
|
||||
}
|
||||
buffer[2] = buffer[2] + this.Level2((int)s[k], SimpleCollator.ExtenderType.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.MatchesPrimitive(option, buffer, num2, ext, sortkey, ti, noLv4);
|
||||
}
|
||||
|
||||
// Token: 0x0400016B RID: 363
|
||||
private const int UnsafeFlagLength = 96;
|
||||
|
||||
// Token: 0x0400016C RID: 364
|
||||
private static bool QuickCheckDisabled = Environment.internalGetEnvironmentVariable("MONO_COLLATION_QUICK_CHECK_DISABLED") == "yes";
|
||||
|
||||
// Token: 0x0400016D RID: 365
|
||||
private static SimpleCollator invariant = new SimpleCollator(CultureInfo.InvariantCulture);
|
||||
|
||||
// Token: 0x0400016E RID: 366
|
||||
private readonly TextInfo textInfo;
|
||||
|
||||
// Token: 0x0400016F RID: 367
|
||||
private readonly bool frenchSort;
|
||||
|
||||
// Token: 0x04000170 RID: 368
|
||||
private unsafe readonly byte* cjkCatTable;
|
||||
|
||||
// Token: 0x04000171 RID: 369
|
||||
private unsafe readonly byte* cjkLv1Table;
|
||||
|
||||
// Token: 0x04000172 RID: 370
|
||||
private readonly CodePointIndexer cjkIndexer;
|
||||
|
||||
// Token: 0x04000173 RID: 371
|
||||
private unsafe readonly byte* cjkLv2Table;
|
||||
|
||||
// Token: 0x04000174 RID: 372
|
||||
private readonly CodePointIndexer cjkLv2Indexer;
|
||||
|
||||
// Token: 0x04000175 RID: 373
|
||||
private readonly int lcid;
|
||||
|
||||
// Token: 0x04000176 RID: 374
|
||||
private readonly Contraction[] contractions;
|
||||
|
||||
// Token: 0x04000177 RID: 375
|
||||
private readonly Level2Map[] level2Maps;
|
||||
|
||||
// Token: 0x04000178 RID: 376
|
||||
private readonly byte[] unsafeFlags;
|
||||
|
||||
// Token: 0x0200008B RID: 139
|
||||
internal struct Context
|
||||
{
|
||||
// Token: 0x0600081A RID: 2074 RVA: 0x0001D600 File Offset: 0x0001B800
|
||||
public unsafe Context(CompareOptions opt, byte* alwaysMatchFlags, byte* neverMatchFlags, byte* buffer1, byte* buffer2, byte* prev1, bool quickCheckPossible)
|
||||
{
|
||||
this.Option = opt;
|
||||
this.AlwaysMatchFlags = alwaysMatchFlags;
|
||||
this.NeverMatchFlags = neverMatchFlags;
|
||||
this.Buffer1 = buffer1;
|
||||
this.Buffer2 = buffer2;
|
||||
this.PrevSortKey = prev1;
|
||||
this.PrevCode = -1;
|
||||
this.QuickCheckPossible = quickCheckPossible;
|
||||
}
|
||||
|
||||
// Token: 0x0600081B RID: 2075 RVA: 0x0001D64C File Offset: 0x0001B84C
|
||||
public void ClearPrevInfo()
|
||||
{
|
||||
this.PrevCode = -1;
|
||||
this.PrevSortKey = null;
|
||||
}
|
||||
|
||||
// Token: 0x04000179 RID: 377
|
||||
public readonly CompareOptions Option;
|
||||
|
||||
// Token: 0x0400017A RID: 378
|
||||
public unsafe readonly byte* NeverMatchFlags;
|
||||
|
||||
// Token: 0x0400017B RID: 379
|
||||
public unsafe readonly byte* AlwaysMatchFlags;
|
||||
|
||||
// Token: 0x0400017C RID: 380
|
||||
public unsafe byte* Buffer1;
|
||||
|
||||
// Token: 0x0400017D RID: 381
|
||||
public unsafe byte* Buffer2;
|
||||
|
||||
// Token: 0x0400017E RID: 382
|
||||
public int PrevCode;
|
||||
|
||||
// Token: 0x0400017F RID: 383
|
||||
public unsafe byte* PrevSortKey;
|
||||
|
||||
// Token: 0x04000180 RID: 384
|
||||
public readonly bool QuickCheckPossible;
|
||||
}
|
||||
|
||||
// Token: 0x0200008C RID: 140
|
||||
private struct PreviousInfo
|
||||
{
|
||||
// Token: 0x0600081C RID: 2076 RVA: 0x0001D660 File Offset: 0x0001B860
|
||||
public PreviousInfo(bool dummy)
|
||||
{
|
||||
this.Code = -1;
|
||||
this.SortKey = null;
|
||||
}
|
||||
|
||||
// Token: 0x04000181 RID: 385
|
||||
public int Code;
|
||||
|
||||
// Token: 0x04000182 RID: 386
|
||||
public unsafe byte* SortKey;
|
||||
}
|
||||
|
||||
// Token: 0x0200008D RID: 141
|
||||
private struct Escape
|
||||
{
|
||||
// Token: 0x04000183 RID: 387
|
||||
public string Source;
|
||||
|
||||
// Token: 0x04000184 RID: 388
|
||||
public int Index;
|
||||
|
||||
// Token: 0x04000185 RID: 389
|
||||
public int Start;
|
||||
|
||||
// Token: 0x04000186 RID: 390
|
||||
public int End;
|
||||
|
||||
// Token: 0x04000187 RID: 391
|
||||
public int Optional;
|
||||
}
|
||||
|
||||
// Token: 0x0200008E RID: 142
|
||||
private enum ExtenderType
|
||||
{
|
||||
// Token: 0x04000189 RID: 393
|
||||
None,
|
||||
// Token: 0x0400018A RID: 394
|
||||
Simple,
|
||||
// Token: 0x0400018B RID: 395
|
||||
Voiced,
|
||||
// Token: 0x0400018C RID: 396
|
||||
Conditional,
|
||||
// Token: 0x0400018D RID: 397
|
||||
Buggy
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000090 RID: 144
|
||||
internal class SortKeyBuffer
|
||||
{
|
||||
// Token: 0x06000825 RID: 2085 RVA: 0x0001D890 File Offset: 0x0001BA90
|
||||
public SortKeyBuffer(int lcid)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000826 RID: 2086 RVA: 0x0001D898 File Offset: 0x0001BA98
|
||||
public void Reset()
|
||||
{
|
||||
this.l1 = (this.l2 = (this.l3 = (this.l4s = (this.l4t = (this.l4k = (this.l4w = (this.l5 = 0)))))));
|
||||
this.frenchSorted = false;
|
||||
}
|
||||
|
||||
// Token: 0x06000827 RID: 2087 RVA: 0x0001D8F4 File Offset: 0x0001BAF4
|
||||
internal void ClearBuffer()
|
||||
{
|
||||
this.l1b = (this.l2b = (this.l3b = (this.l4sb = (this.l4tb = (this.l4kb = (this.l4wb = (this.l5b = null)))))));
|
||||
}
|
||||
|
||||
// Token: 0x06000828 RID: 2088 RVA: 0x0001D948 File Offset: 0x0001BB48
|
||||
internal void Initialize(CompareOptions options, int lcid, string s, bool frenchSort)
|
||||
{
|
||||
this.source = s;
|
||||
this.lcid = lcid;
|
||||
this.options = options;
|
||||
int length = s.Length;
|
||||
this.processLevel2 = (options & CompareOptions.IgnoreNonSpace) == CompareOptions.None;
|
||||
this.frenchSort = frenchSort;
|
||||
if (this.l1b == null || this.l1b.Length < length)
|
||||
{
|
||||
this.l1b = new byte[length * 2 + 10];
|
||||
}
|
||||
if (this.processLevel2 && (this.l2b == null || this.l2b.Length < length))
|
||||
{
|
||||
this.l2b = new byte[length + 10];
|
||||
}
|
||||
if (this.l3b == null || this.l3b.Length < length)
|
||||
{
|
||||
this.l3b = new byte[length + 10];
|
||||
}
|
||||
if (this.l4sb == null)
|
||||
{
|
||||
this.l4sb = new byte[10];
|
||||
}
|
||||
if (this.l4tb == null)
|
||||
{
|
||||
this.l4tb = new byte[10];
|
||||
}
|
||||
if (this.l4kb == null)
|
||||
{
|
||||
this.l4kb = new byte[10];
|
||||
}
|
||||
if (this.l4wb == null)
|
||||
{
|
||||
this.l4wb = new byte[10];
|
||||
}
|
||||
if (this.l5b == null)
|
||||
{
|
||||
this.l5b = new byte[10];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000829 RID: 2089 RVA: 0x0001DA84 File Offset: 0x0001BC84
|
||||
internal void AppendCJKExtension(byte lv1msb, byte lv1lsb)
|
||||
{
|
||||
this.AppendBufferPrimitive(254, ref this.l1b, ref this.l1);
|
||||
this.AppendBufferPrimitive(byte.MaxValue, ref this.l1b, ref this.l1);
|
||||
this.AppendBufferPrimitive(lv1msb, ref this.l1b, ref this.l1);
|
||||
this.AppendBufferPrimitive(lv1lsb, ref this.l1b, ref this.l1);
|
||||
if (this.processLevel2)
|
||||
{
|
||||
this.AppendBufferPrimitive(2, ref this.l2b, ref this.l2);
|
||||
}
|
||||
this.AppendBufferPrimitive(2, ref this.l3b, ref this.l3);
|
||||
}
|
||||
|
||||
// Token: 0x0600082A RID: 2090 RVA: 0x0001DB18 File Offset: 0x0001BD18
|
||||
internal void AppendKana(byte category, byte lv1, byte lv2, byte lv3, bool isSmallKana, byte markType, bool isKatakana, bool isHalfWidth)
|
||||
{
|
||||
this.AppendNormal(category, lv1, lv2, lv3);
|
||||
this.AppendBufferPrimitive((!isSmallKana) ? 228 : 196, ref this.l4sb, ref this.l4s);
|
||||
this.AppendBufferPrimitive(markType, ref this.l4tb, ref this.l4t);
|
||||
this.AppendBufferPrimitive((!isKatakana) ? 228 : 196, ref this.l4kb, ref this.l4k);
|
||||
this.AppendBufferPrimitive((!isHalfWidth) ? 228 : 196, ref this.l4wb, ref this.l4w);
|
||||
}
|
||||
|
||||
// Token: 0x0600082B RID: 2091 RVA: 0x0001DBC0 File Offset: 0x0001BDC0
|
||||
internal void AppendNormal(byte category, byte lv1, byte lv2, byte lv3)
|
||||
{
|
||||
if (lv2 == 0)
|
||||
{
|
||||
lv2 = 2;
|
||||
}
|
||||
if (lv3 == 0)
|
||||
{
|
||||
lv3 = 2;
|
||||
}
|
||||
if (category == 6 && (this.options & CompareOptions.StringSort) == CompareOptions.None)
|
||||
{
|
||||
this.AppendLevel5(category, lv1);
|
||||
return;
|
||||
}
|
||||
if (this.processLevel2 && category == 1 && this.l1 > 0)
|
||||
{
|
||||
lv2 += this.l2b[--this.l2];
|
||||
lv3 = this.l3b[--this.l3];
|
||||
}
|
||||
if (category != 1)
|
||||
{
|
||||
this.AppendBufferPrimitive(category, ref this.l1b, ref this.l1);
|
||||
this.AppendBufferPrimitive(lv1, ref this.l1b, ref this.l1);
|
||||
}
|
||||
if (this.processLevel2)
|
||||
{
|
||||
this.AppendBufferPrimitive(lv2, ref this.l2b, ref this.l2);
|
||||
}
|
||||
this.AppendBufferPrimitive(lv3, ref this.l3b, ref this.l3);
|
||||
}
|
||||
|
||||
// Token: 0x0600082C RID: 2092 RVA: 0x0001DCB8 File Offset: 0x0001BEB8
|
||||
private void AppendLevel5(byte category, byte lv1)
|
||||
{
|
||||
int num = (this.l2 + 1) % 8192;
|
||||
this.AppendBufferPrimitive((byte)(num / 64 + 128), ref this.l5b, ref this.l5);
|
||||
this.AppendBufferPrimitive((byte)(num % 64 * 4 + 3), ref this.l5b, ref this.l5);
|
||||
this.AppendBufferPrimitive(category, ref this.l5b, ref this.l5);
|
||||
this.AppendBufferPrimitive(lv1, ref this.l5b, ref this.l5);
|
||||
}
|
||||
|
||||
// Token: 0x0600082D RID: 2093 RVA: 0x0001DD34 File Offset: 0x0001BF34
|
||||
private void AppendBufferPrimitive(byte value, ref byte[] buf, ref int bidx)
|
||||
{
|
||||
buf[bidx++] = value;
|
||||
if (bidx == buf.Length)
|
||||
{
|
||||
byte[] array = new byte[bidx * 2];
|
||||
Array.Copy(buf, array, buf.Length);
|
||||
buf = array;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600082E RID: 2094 RVA: 0x0001DD74 File Offset: 0x0001BF74
|
||||
public SortKey GetResultAndReset()
|
||||
{
|
||||
SortKey result = this.GetResult();
|
||||
this.Reset();
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600082F RID: 2095 RVA: 0x0001DD90 File Offset: 0x0001BF90
|
||||
private int GetOptimizedLength(byte[] data, int len, byte defaultValue)
|
||||
{
|
||||
int num = -1;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (data[i] != defaultValue)
|
||||
{
|
||||
num = i;
|
||||
}
|
||||
}
|
||||
return num + 1;
|
||||
}
|
||||
|
||||
// Token: 0x06000830 RID: 2096 RVA: 0x0001DDC0 File Offset: 0x0001BFC0
|
||||
public SortKey GetResult()
|
||||
{
|
||||
if (this.frenchSort && !this.frenchSorted && this.l2b != null)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < this.l2b.Length; i++)
|
||||
{
|
||||
if (this.l2b[i] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
Array.Reverse(this.l2b, 0, i);
|
||||
this.frenchSorted = true;
|
||||
}
|
||||
this.l2 = this.GetOptimizedLength(this.l2b, this.l2, 2);
|
||||
this.l3 = this.GetOptimizedLength(this.l3b, this.l3, 2);
|
||||
bool flag = this.l4s > 0;
|
||||
this.l4s = this.GetOptimizedLength(this.l4sb, this.l4s, 228);
|
||||
this.l4t = this.GetOptimizedLength(this.l4tb, this.l4t, 3);
|
||||
this.l4k = this.GetOptimizedLength(this.l4kb, this.l4k, 228);
|
||||
this.l4w = this.GetOptimizedLength(this.l4wb, this.l4w, 228);
|
||||
this.l5 = this.GetOptimizedLength(this.l5b, this.l5, 2);
|
||||
int num = this.l1 + this.l2 + this.l3 + this.l5 + 5;
|
||||
int num2 = this.l4s + this.l4t + this.l4k + this.l4w;
|
||||
if (flag)
|
||||
{
|
||||
num += num2 + 4;
|
||||
}
|
||||
byte[] array = new byte[num];
|
||||
Array.Copy(this.l1b, array, this.l1);
|
||||
array[this.l1] = 1;
|
||||
int num3 = this.l1 + 1;
|
||||
if (this.l2 > 0)
|
||||
{
|
||||
Array.Copy(this.l2b, 0, array, num3, this.l2);
|
||||
}
|
||||
num3 += this.l2;
|
||||
array[num3++] = 1;
|
||||
if (this.l3 > 0)
|
||||
{
|
||||
Array.Copy(this.l3b, 0, array, num3, this.l3);
|
||||
}
|
||||
num3 += this.l3;
|
||||
array[num3++] = 1;
|
||||
if (flag)
|
||||
{
|
||||
Array.Copy(this.l4sb, 0, array, num3, this.l4s);
|
||||
num3 += this.l4s;
|
||||
array[num3++] = byte.MaxValue;
|
||||
Array.Copy(this.l4tb, 0, array, num3, this.l4t);
|
||||
num3 += this.l4t;
|
||||
array[num3++] = 2;
|
||||
Array.Copy(this.l4kb, 0, array, num3, this.l4k);
|
||||
num3 += this.l4k;
|
||||
array[num3++] = byte.MaxValue;
|
||||
Array.Copy(this.l4wb, 0, array, num3, this.l4w);
|
||||
num3 += this.l4w;
|
||||
array[num3++] = byte.MaxValue;
|
||||
}
|
||||
array[num3++] = 1;
|
||||
if (this.l5 > 0)
|
||||
{
|
||||
Array.Copy(this.l5b, 0, array, num3, this.l5);
|
||||
}
|
||||
num3 += this.l5;
|
||||
array[num3++] = 0;
|
||||
return new SortKey(this.lcid, this.source, array, this.options, this.l1, this.l2, this.l3, this.l4s, this.l4t, this.l4k, this.l4w, this.l5);
|
||||
}
|
||||
|
||||
// Token: 0x04000192 RID: 402
|
||||
private int l1;
|
||||
|
||||
// Token: 0x04000193 RID: 403
|
||||
private int l2;
|
||||
|
||||
// Token: 0x04000194 RID: 404
|
||||
private int l3;
|
||||
|
||||
// Token: 0x04000195 RID: 405
|
||||
private int l4s;
|
||||
|
||||
// Token: 0x04000196 RID: 406
|
||||
private int l4t;
|
||||
|
||||
// Token: 0x04000197 RID: 407
|
||||
private int l4k;
|
||||
|
||||
// Token: 0x04000198 RID: 408
|
||||
private int l4w;
|
||||
|
||||
// Token: 0x04000199 RID: 409
|
||||
private int l5;
|
||||
|
||||
// Token: 0x0400019A RID: 410
|
||||
private byte[] l1b;
|
||||
|
||||
// Token: 0x0400019B RID: 411
|
||||
private byte[] l2b;
|
||||
|
||||
// Token: 0x0400019C RID: 412
|
||||
private byte[] l3b;
|
||||
|
||||
// Token: 0x0400019D RID: 413
|
||||
private byte[] l4sb;
|
||||
|
||||
// Token: 0x0400019E RID: 414
|
||||
private byte[] l4tb;
|
||||
|
||||
// Token: 0x0400019F RID: 415
|
||||
private byte[] l4kb;
|
||||
|
||||
// Token: 0x040001A0 RID: 416
|
||||
private byte[] l4wb;
|
||||
|
||||
// Token: 0x040001A1 RID: 417
|
||||
private byte[] l5b;
|
||||
|
||||
// Token: 0x040001A2 RID: 418
|
||||
private string source;
|
||||
|
||||
// Token: 0x040001A3 RID: 419
|
||||
private bool processLevel2;
|
||||
|
||||
// Token: 0x040001A4 RID: 420
|
||||
private bool frenchSort;
|
||||
|
||||
// Token: 0x040001A5 RID: 421
|
||||
private bool frenchSorted;
|
||||
|
||||
// Token: 0x040001A6 RID: 422
|
||||
private int lcid;
|
||||
|
||||
// Token: 0x040001A7 RID: 423
|
||||
private CompareOptions options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Globalization.Unicode
|
||||
{
|
||||
// Token: 0x02000080 RID: 128
|
||||
internal class TailoringInfo
|
||||
{
|
||||
// Token: 0x0600078E RID: 1934 RVA: 0x00018038 File Offset: 0x00016238
|
||||
public TailoringInfo(int lcid, int tailoringIndex, int tailoringCount, bool frenchSort)
|
||||
{
|
||||
this.LCID = lcid;
|
||||
this.TailoringIndex = tailoringIndex;
|
||||
this.TailoringCount = tailoringCount;
|
||||
this.FrenchSort = frenchSort;
|
||||
}
|
||||
|
||||
// Token: 0x0400011F RID: 287
|
||||
public readonly int LCID;
|
||||
|
||||
// Token: 0x04000120 RID: 288
|
||||
public readonly int TailoringIndex;
|
||||
|
||||
// Token: 0x04000121 RID: 289
|
||||
public readonly int TailoringCount;
|
||||
|
||||
// Token: 0x04000122 RID: 290
|
||||
public readonly bool FrenchSort;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user