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

ReadElementContentAsBase64() public méthode

public ReadElementContentAsBase64 ( byte buffer, int index, int count ) : int
buffer byte
index int
count int
Résultat int
        public override int ReadElementContentAsBase64( 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.ReadElementContentAsBase64 ) ) {
                        return 0;
                    }
                    goto case State.ReadElementContentAsBase64;

                case State.ReadElementContentAsBase64:
                    int read = reader.ReadContentAsBase64( 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.ReadElementContentAsBinHex:
                    throw new InvalidOperationException( Res.GetString( Res.Xml_MixingBinaryContentMethods ) );

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