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

◆ GetChars() [2/4]

override int System.Xml.UTF16Decoder.GetChars ( byte[] bytes,
int byteIndex,
int byteCount,
char[] chars,
int charIndex )
inline

Definition at line 32 of file UTF16Decoder.cs.

33 {
35 if (_lastByte >= 0)
36 {
37 if (byteCount == 0)
38 {
39 return charCount;
40 }
41 int num = bytes[byteIndex++];
42 byteCount--;
43 chars[charIndex++] = (_bigEndian ? ((char)((_lastByte << 8) | num)) : ((char)((num << 8) | _lastByte)));
44 _lastByte = -1;
45 }
46 if (((uint)byteCount & (true ? 1u : 0u)) != 0)
47 {
49 }
50 if (_bigEndian == BitConverter.IsLittleEndian)
51 {
52 int num2 = byteIndex + byteCount;
53 if (_bigEndian)
54 {
55 while (byteIndex < num2)
56 {
57 int num3 = bytes[byteIndex++];
58 int num4 = bytes[byteIndex++];
59 chars[charIndex++] = (char)((num3 << 8) | num4);
60 }
61 }
62 else
63 {
64 while (byteIndex < num2)
65 {
66 int num5 = bytes[byteIndex++];
67 int num6 = bytes[byteIndex++];
68 chars[charIndex++] = (char)((num6 << 8) | num5);
69 }
70 }
71 }
72 else
73 {
74 Buffer.BlockCopy(bytes, byteIndex, chars, charIndex * 2, byteCount);
75 }
76 return charCount;
77 }
readonly bool _bigEndian
override int GetCharCount(byte[] bytes, int index, int count)

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, System.Xml.UTF16Decoder.GetCharCount(), and System.BitConverter.IsLittleEndian.