public override int ReadContentAsBase64(byte[] buffer, int offset, int count)
{
if (buffer == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(buffer)));
if (offset < 0)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.ValueMustBeNonNegative)));
if (offset > buffer.Length)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(offset), SR.Format(SR.OffsetExceedsBufferSize, buffer.Length)));
if (count < 0)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.ValueMustBeNonNegative)));
if (count > buffer.Length - offset)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.SizeExceedsRemainingBufferSpace, buffer.Length - offset)));
if (count == 0)
return 0;
int actual;
if (_trailByteCount == 0 && _trailCharCount == 0 && _value == null)
{
if (_node.QNameType == QNameType.Normal)
{
while (_node.NodeType != XmlNodeType.Comment && _node.Value.TryReadBase64(buffer, offset, count, out actual))
{
if (actual != 0)
return actual;
Read();
}
}
}
XmlNodeType nodeType = _node.NodeType;
if (nodeType == XmlNodeType.Element || nodeType == XmlNodeType.EndElement)
return 0;
return ReadBytes(Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true);
}