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

◆ ReadBOMEncoding() [2/2]

static SupportedEncoding System.Xml.EncodingStreamWrapper.ReadBOMEncoding ( byte b1,
byte b2,
byte b3,
byte b4,
bool notOutOfBand,
out int preserve )
inlinestaticprivate

Definition at line 292 of file EncodingStreamWrapper.cs.

293 {
294 SupportedEncoding result = SupportedEncoding.UTF8;
295 preserve = 0;
296 if (b1 == 60 && b2 != 0)
297 {
298 result = SupportedEncoding.UTF8;
299 preserve = 4;
300 }
301 else if (b1 == byte.MaxValue && b2 == 254)
302 {
303 result = SupportedEncoding.UTF16LE;
304 preserve = 2;
305 }
306 else if (b1 == 254 && b2 == byte.MaxValue)
307 {
308 result = SupportedEncoding.UTF16BE;
309 preserve = 2;
310 }
311 else if (b1 == 0 && b2 == 60)
312 {
313 result = SupportedEncoding.UTF16BE;
314 if (notOutOfBand && (b3 != 0 || b4 != 63))
315 {
317 }
318 preserve = 4;
319 }
320 else if (b1 == 60 && b2 == 0)
321 {
322 result = SupportedEncoding.UTF16LE;
323 if (notOutOfBand && (b3 != 63 || b4 != 0))
324 {
326 }
327 preserve = 4;
328 }
329 else if (b1 == 239 && b2 == 187)
330 {
331 if (notOutOfBand && b3 != 191)
332 {
333 throw new XmlException(System.SR.XmlBadBOM);
334 }
335 preserve = 1;
336 }
337 else
338 {
339 preserve = 4;
340 }
341 return result;
342 }
static string XmlDeclMissing
Definition SR.cs:366
static string XmlBadBOM
Definition SR.cs:352
Definition SR.cs:7

References System.Xml.Dictionary, System.SR.XmlBadBOM, System.SR.XmlDeclMissing, and System.Xml.XmlException.