Reset() abstract private method

abstract private Reset ( ) : void
return void
示例#1
0
        private void InitIncrementalRead(IncrementalReadDecoder decoder)
        {
            ResetAttributes();

            decoder.Reset();
            _incReadDecoder = decoder;
            _incReadState = IncrementalReadState.Text;
            _incReadDepth = 1;
            _incReadLeftStartPos = _ps.charPos;
            _incReadLeftEndPos = _ps.charPos;
            _incReadLineInfo.Set(_ps.LineNo, _ps.LinePos);

            _parsingFunction = ParsingFunction.InIncrementalRead;
        }
示例#2
0
        public override int  ReadContentAsBase64(byte[] buffer, int index, int count)
        {
            switch (state)
            {
            case State.Initial:
            case State.EndOfFile:
            case State.Closed:
            case State.Error:
                return(0);

            case State.ClearNsAttributes:
            case State.PopNamespaceScope:
                switch (NodeType)
                {
                case XmlNodeType.Element:
                    throw CreateReadContentAsException("ReadContentAsBase64");

                case XmlNodeType.EndElement:
                    return(0);

                case XmlNodeType.Attribute:
                    if (curNsAttr != -1 && reader.CanReadBinaryContent)
                    {
                        CheckBuffer(buffer, index, count);
                        if (count == 0)
                        {
                            return(0);
                        }
                        if (nsIncReadOffset == 0)
                        {
                            // called first time on this ns attribute
                            if (binDecoder != null && binDecoder is Base64Decoder)
                            {
                                binDecoder.Reset();
                            }
                            else
                            {
                                binDecoder = new Base64Decoder();
                            }
                        }
                        if (nsIncReadOffset == curNode.value.Length)
                        {
                            return(0);
                        }
                        binDecoder.SetNextOutputBuffer(buffer, index, count);
                        nsIncReadOffset += binDecoder.Decode(curNode.value, nsIncReadOffset, curNode.value.Length - nsIncReadOffset);
                        return(binDecoder.DecodedCount);
                    }
                    goto case XmlNodeType.Text;

                case XmlNodeType.Text:
                    Debug.Assert(AttributeCount > 0);
                    return(reader.ReadContentAsBase64(buffer, index, count));

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

            case State.Interactive:
                state = State.ReadContentAsBase64;
                goto case State.ReadContentAsBase64;

            case State.ReadContentAsBase64:
                int read = reader.ReadContentAsBase64(buffer, index, count);
                if (read == 0)
                {
                    state = State.Interactive;
                    ProcessNamespaces();
                }
                return(read);

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

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