System.Xml.XmlSubtreeReader.ReadElementContentAsBinHex C# (CSharp) Méthode

ReadElementContentAsBinHex() public méthode

public ReadElementContentAsBinHex ( byte buffer, int index, int count ) : int
buffer byte
index int
count int
Résultat int
        public override int ReadElementContentAsBinHex( byte[] buffer, int index, int count ) {
            switch ( state ) {
                case State.Initial:
                case State.EndOfFile:
                case State.Closed:
                    return 0;

                case State.Interactive:
                case State.PopNamespaceScope:
                case State.ClearNsAttributes:
                    if ( !InitReadElementContentAsBinary( State.ReadElementContentAsBinHex ) ) {
                        return 0;
                    }
                    goto case State.ReadElementContentAsBinHex;
                case State.ReadElementContentAsBinHex:
                    int read = reader.ReadContentAsBinHex( buffer, index, count );
                    if ( read > 0 ) {
                        return read;
                    }
                    if ( NodeType != XmlNodeType.EndElement ) {
                        throw new XmlException( Res.Xml_InvalidNodeType, reader.NodeType.ToString(), reader as IXmlLineInfo );
                    }

                    // pop namespace scope
                    state = State.Interactive;
                    ProcessNamespaces();

                    // set eof state or move off the end element
                    if ( reader.Depth == initialDepth ) {
                        state = State.EndOfFile;
                        SetEmptyNode();
                    }
                    else {
                        Read();
                    }
                    return 0;

                case State.ReadContentAsBase64:
                case State.ReadContentAsBinHex:
                case State.ReadElementContentAsBase64:
                    throw new InvalidOperationException( Res.GetString( Res.Xml_MixingBinaryContentMethods ) );

                default:
                    Debug.Assert( false );
                    return 0;
            }
        }