private int ReadElementContentAsBinary( byte[] buffer, int index, int count ) {
if ( count == 0 ) {
return 0;
}
// read binary
int decoded = ReadContentAsBinary( buffer, index, count );
if ( decoded > 0 ) {
return decoded;
}
// if 0 bytes returned check if we are on a closing EndElement, throw exception if not
if ( reader.NodeType != XmlNodeType.EndElement ) {
throw new XmlException( Res.Xml_InvalidNodeType, reader.NodeType.ToString(), reader as IXmlLineInfo );
}
// move off the EndElement
reader.Read();
state = State.None;
return 0;
}