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

◆ Decode() [2/3]

void System.Xml.Base64Decoder.Decode ( ReadOnlySpan< char > chars,
Span< byte > bytes,
out int charsDecoded,
out int bytesDecoded )
inlineprivate

Definition at line 105 of file Base64Decoder.cs.

106 {
107 int num = 0;
108 int num2 = 0;
109 int num3 = _bits;
110 int num4 = _bitsFilled;
111 while (true)
112 {
113 if ((uint)num2 < (uint)chars.Length && (uint)num < (uint)bytes.Length)
114 {
115 char c = chars[num2];
116 if (c != '=')
117 {
118 num2++;
119 if (XmlCharType.IsWhiteSpace(c))
120 {
121 continue;
122 }
123 int num5;
124 if (c > 'z' || (num5 = s_mapBase64[(uint)c]) == 255)
125 {
126 throw new XmlException(System.SR.Xml_InvalidBase64Value, chars.ToString());
127 }
128 num3 = (num3 << 6) | num5;
129 num4 += 6;
130 if (num4 >= 8)
131 {
132 bytes[num++] = (byte)((uint)(num3 >> num4 - 8) & 0xFFu);
133 num4 -= 8;
134 if (num == bytes.Length)
135 {
136 break;
137 }
138 }
139 continue;
140 }
141 }
142 if ((uint)num2 >= (uint)chars.Length || chars[num2] != '=')
143 {
144 break;
145 }
146 num4 = 0;
147 do
148 {
149 num2++;
150 }
151 while ((uint)num2 < (uint)chars.Length && chars[num2] == '=');
152 while ((uint)num2 < (uint)chars.Length)
153 {
154 if (!XmlCharType.IsWhiteSpace(chars[num2++]))
155 {
156 throw new XmlException(System.SR.Xml_InvalidBase64Value, chars.ToString());
157 }
158 }
159 break;
160 }
161 _bits = num3;
163 bytesDecoded = num;
165 }
static string Xml_InvalidBase64Value
Definition SR.cs:118
Definition SR.cs:7
static readonly byte[] s_mapBase64

References System.Xml.Base64Decoder._bits, System.Xml.Base64Decoder._bitsFilled, System.bytes, System.chars, System.Xml.Dictionary, System.Xml.XmlCharType.IsWhiteSpace(), System.Xml.Base64Decoder.s_mapBase64, System.SR.Xml_InvalidBase64Value, and System.Xml.XmlException.