Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Ucs4Decoder2143.cs
Go to the documentation of this file.
1namespace System.Xml;
2
3internal sealed class Ucs4Decoder2143 : Ucs4Decoder
4{
5 internal override int GetFullChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
6 {
8 int i = byteIndex;
9 int num = charIndex;
10 for (; i + 3 < byteCount; i += 4)
11 {
12 uint num2 = (uint)((bytes[i + 1] << 24) | (bytes[i] << 16) | (bytes[i + 3] << 8) | bytes[i + 2]);
13 if (num2 > 1114111)
14 {
15 throw new ArgumentException(System.SR.Format(System.SR.Enc_InvalidByteInEncoding, new object[1] { i }), (string?)null);
16 }
17 if (num2 > 65535)
18 {
19 Ucs4ToUTF16(num2, chars, num);
20 num++;
21 }
22 else
23 {
25 {
26 throw new XmlException(System.SR.Xml_InvalidCharInThisEncoding, string.Empty);
27 }
28 chars[num] = (char)num2;
29 }
30 num++;
31 }
32 return num - charIndex;
33 }
34}
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Xml_InvalidCharInThisEncoding
Definition SR.cs:56
static string Enc_InvalidByteInEncoding
Definition SR.cs:1818
Definition SR.cs:7
override int GetFullChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
void Ucs4ToUTF16(uint code, char[] chars, int charIndex)
static bool IsSurrogate(int ch)