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

◆ Convert() [2/3]

override void System.Xml.UTF16Decoder.Convert ( byte[] bytes,
int byteIndex,
int byteCount,
char[] chars,
int charIndex,
int charCount,
bool flush,
out int bytesUsed,
out int charsUsed,
out bool completed )
inlinevirtual

Reimplemented from System.Text.Decoder.

Definition at line 79 of file UTF16Decoder.cs.

80 {
81 charsUsed = 0;
82 bytesUsed = 0;
83 if (_lastByte >= 0)
84 {
85 if (byteCount == 0)
86 {
87 completed = true;
88 return;
89 }
90 int num = bytes[byteIndex++];
91 byteCount--;
92 bytesUsed++;
93 chars[charIndex++] = (_bigEndian ? ((char)((_lastByte << 8) | num)) : ((char)((num << 8) | _lastByte)));
94 charCount--;
95 charsUsed++;
96 _lastByte = -1;
97 }
98 if (charCount * 2 < byteCount)
99 {
100 byteCount = charCount * 2;
101 completed = false;
102 }
103 else
104 {
105 completed = true;
106 }
107 if (_bigEndian == BitConverter.IsLittleEndian)
108 {
109 int num2 = byteIndex;
110 int num3 = num2 + (byteCount & -2);
111 if (_bigEndian)
112 {
113 while (num2 < num3)
114 {
115 int num4 = bytes[num2++];
116 int num5 = bytes[num2++];
117 chars[charIndex++] = (char)((num4 << 8) | num5);
118 }
119 }
120 else
121 {
122 while (num2 < num3)
123 {
124 int num6 = bytes[num2++];
125 int num7 = bytes[num2++];
126 chars[charIndex++] = (char)((num7 << 8) | num6);
127 }
128 }
129 }
130 else
131 {
132 Buffer.BlockCopy(bytes, byteIndex, chars, charIndex * 2, byteCount & -2);
133 }
134 charsUsed += byteCount / 2;
135 bytesUsed += byteCount;
136 if (((uint)byteCount & (true ? 1u : 0u)) != 0)
137 {
139 }
140 }
readonly bool _bigEndian

References System.Xml.UTF16Decoder._bigEndian, System.Xml.UTF16Decoder._lastByte, System.Buffer.BlockCopy(), System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, System.Xml.Dictionary, and System.BitConverter.IsLittleEndian.