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

◆ Decode() [3/4]

static void System.Xml.BinHexDecoder.Decode ( ReadOnlySpan< char > chars,
Span< byte > bytes,
ref bool hasHalfByteCached,
ref byte cachedHalfByte,
out int charsDecoded,
out int bytesDecoded )
inlinestaticprivate

Definition at line 115 of file BinHexDecoder.cs.

116 {
117 int num = 0;
118 int i;
119 for (i = 0; i < chars.Length; i++)
120 {
121 if ((uint)num >= (uint)bytes.Length)
122 {
123 break;
124 }
125 char c = chars[i];
127 if (num2 != 255)
128 {
129 byte b = (byte)num2;
131 {
132 bytes[num++] = (byte)((cachedHalfByte << 4) + b);
133 hasHalfByteCached = false;
134 }
135 else
136 {
138 hasHalfByteCached = true;
139 }
140 }
141 else if (!XmlCharType.IsWhiteSpace(c))
142 {
143 throw new XmlException(System.SR.Xml_InvalidBinHexValue, chars.ToString());
144 }
145 }
146 bytesDecoded = num;
147 charsDecoded = i;
148 }
static int FromChar(int c)
static string Xml_InvalidBinHexValue
Definition SR.cs:112
Definition SR.cs:7

References System.bytes, System.chars, System.Xml.Dictionary, System.HexConverter.FromChar(), System.Xml.XmlCharType.IsWhiteSpace(), System.SR.Xml_InvalidBinHexValue, and System.Xml.XmlException.