Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ LoadManagedCodePage()

unsafe override void System.Text.GB18030Encoding.LoadManagedCodePage ( )
inlineprotected

Definition at line 92 of file GB18030Encoding.cs.

93 {
94 iExtraBytes = 87032;
95 base.LoadManagedCodePage();
96 byte* ptr = (byte*)(void*)safeNativeMemoryHandle.DangerousGetHandle();
97 mapUnicodeTo4BytesFlags = ptr + 262144;
98 map4BytesToUnicode = (char*)(ptr + 262144 + 8192);
99 char c = '\0';
100 ushort num = 0;
101 for (int i = 0; i < _tableUnicodeToGBDiffs.Length; i++)
102 {
103 ushort num2 = _tableUnicodeToGBDiffs[i];
104 if ((num2 & 0x8000u) != 0)
105 {
106 if (num2 > 36864 && num2 != 53670)
107 {
108 mapBytesToUnicode[(int)num2] = c;
109 mapUnicodeToBytes[(int)c] = num2;
110 c = (char)(c + 1);
111 }
112 else
113 {
114 c = (char)(c + (ushort)(num2 & 0x7FFF));
115 }
116 continue;
117 }
118 while (num2 > 0)
119 {
120 map4BytesToUnicode[(int)num] = c;
121 mapUnicodeToBytes[(int)c] = num;
122 byte* num3 = mapUnicodeTo4BytesFlags + c / 8;
123 *num3 |= (byte)(1 << c % 8);
124 c = (char)(c + 1);
125 num++;
126 num2--;
127 }
128 }
129 }
readonly ushort[] _tableUnicodeToGBDiffs
unsafe byte * mapUnicodeTo4BytesFlags

References System.Text.GB18030Encoding._tableUnicodeToGBDiffs, System.Text.BaseCodePageEncoding.iExtraBytes, System.Text.GB18030Encoding.map4BytesToUnicode, System.Text.DBCSCodePageEncoding.mapBytesToUnicode, System.Text.GB18030Encoding.mapUnicodeTo4BytesFlags, System.Text.DBCSCodePageEncoding.mapUnicodeToBytes, and System.Text.BaseCodePageEncoding.safeNativeMemoryHandle.