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

◆ ReadContentAsBase64() [2/3]

override int System.Xml.XmlBaseReader.ReadContentAsBase64 ( byte[] buffer,
int offset,
int count )
inlinevirtualinherited

Reimplemented from System.Xml.XmlReader.

Definition at line 2419 of file XmlBaseReader.cs.

2420 {
2421 if (buffer == null)
2422 {
2423 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("buffer"));
2424 }
2425 if (offset < 0)
2426 {
2427 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", System.SR.ValueMustBeNonNegative));
2428 }
2429 if (offset > buffer.Length)
2430 {
2431 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("offset", System.SR.Format(System.SR.OffsetExceedsBufferSize, buffer.Length)));
2432 }
2433 if (count < 0)
2434 {
2435 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", System.SR.ValueMustBeNonNegative));
2436 }
2437 if (count > buffer.Length - offset)
2438 {
2439 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("count", System.SR.Format(System.SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
2440 }
2441 if (count == 0)
2442 {
2443 return 0;
2444 }
2445 if (_trailByteCount == 0 && _trailCharCount == 0 && _value == null && _node.QNameType == QNameType.Normal)
2446 {
2447 int actual;
2448 while (_node.NodeType != XmlNodeType.Comment && _node.Value.TryReadBase64(buffer, offset, count, out actual))
2449 {
2450 if (actual != 0)
2451 {
2452 return actual;
2453 }
2454 Read();
2455 }
2456 }
2457 XmlNodeType nodeType = _node.NodeType;
2458 if (nodeType == XmlNodeType.Element || nodeType == XmlNodeType.EndElement)
2459 {
2460 return 0;
2461 }
2462 return ReadBytes(Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), readContent: true);
2463 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ValueMustBeNonNegative
Definition SR.cs:296
static string SizeExceedsRemainingBufferSpace
Definition SR.cs:324
static string OffsetExceedsBufferSize
Definition SR.cs:322
Definition SR.cs:7
bool TryReadBase64(byte[] buffer, int offset, int count, out int actual)
int ReadBytes(Encoding encoding, int byteBlock, int charBlock, byte[] buffer, int offset, int byteCount, bool readContent)

References System.Xml.XmlBaseReader._node, System.Xml.XmlBaseReader._trailByteCount, System.Xml.XmlBaseReader._trailCharCount, System.Xml.XmlBaseReader._value, System.buffer, System.count, System.Xml.Dictionary, System.SR.Format(), System.Math.Min(), System.Xml.XmlBaseReader.XmlNode.NodeType, System.offset, System.SR.OffsetExceedsBufferSize, System.Xml.XmlBaseReader.XmlNode.QNameType, System.Xml.XmlReader.Read(), System.Xml.XmlBaseReader.ReadBytes(), System.SR.SizeExceedsRemainingBufferSpace, System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(), System.Xml.ValueHandle.TryReadBase64(), System.Xml.XmlBaseReader.XmlNode.Value, and System.SR.ValueMustBeNonNegative.