private void InitBase64Decoder() { if (this.base64Decoder == null) { this.base64Decoder = new Base64Decoder(); } else { this.base64Decoder.Reset(); } this.decoder = this.base64Decoder; }
private void InitBinHexDecoder() { if (binHexDecoder == null) { binHexDecoder = new BinHexDecoder(); } else { binHexDecoder.Reset(); } decoder = binHexDecoder; }
private void InitBinHexDecoder() { if (this.binHexDecoder == null) { this.binHexDecoder = new BinHexDecoder(); } else { this.binHexDecoder.Reset(); } this.decoder = this.binHexDecoder; }
private void InitBase64Decoder() { if (base64Decoder == null) { base64Decoder = new Base64Decoder(); } else { base64Decoder.Reset(); } decoder = base64Decoder; }
private void InitBinHexDecoder() { if (_binHexDecoder == null) { _binHexDecoder = new BinHexDecoder(); } else { _binHexDecoder.Reset(); } _decoder = _binHexDecoder; }
private void InitBase64Decoder() { if (_base64Decoder == null) { _base64Decoder = new Base64Decoder(); } else { _base64Decoder.Reset(); } _decoder = _base64Decoder; }
internal int CopyToBinary(IncrementalReadDecoder decoder, int valueOffset) { if (_value == null) { Debug.Assert(_valueStartPos != -1); Debug.Assert(_chars != null); return(decoder.Decode(_chars, _valueStartPos + valueOffset, _valueLength - valueOffset)); } else { return(decoder.Decode(_value, valueOffset, _value.Length - valueOffset)); } }
private void InitBase64Decoder() { if (_base64Decoder == null) { _base64Decoder = new Base64Decoder(); } else { _base64Decoder.Reset(); } _incReadDecoder = _base64Decoder; }
private void FinishIncrementalRead() { _incReadDecoder = new IncrementalReadDummyDecoder(); IncrementalRead(); Debug.Assert(IncrementalRead() == 0, "Previous call of IncrementalRead should eat up all characters!"); _incReadDecoder = null; }
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; }
// Reads the contents of an element including markup into a character buffer. Wellformedness checks are limited. // This method is designed to read large streams of embedded text by calling it successively. internal int ReadChars(char[] buffer, int index, int count) { Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadChars cannot be called on reader created via XmlReader.Create."); Debug.Assert(_outerReader is XmlTextReader); if (_parsingFunction == ParsingFunction.InIncrementalRead) { if (_incReadDecoder != _readCharsDecoder) { // mixing ReadChars with ReadBase64 or ReadBinHex if (_readCharsDecoder == null) { _readCharsDecoder = new IncrementalReadCharsDecoder(); } _readCharsDecoder.Reset(); _incReadDecoder = _readCharsDecoder; } return IncrementalRead(buffer, index, count); } else { if (_curNode.type != XmlNodeType.Element) { return 0; } if (_curNode.IsEmptyElement) { _outerReader.Read(); return 0; } if (_readCharsDecoder == null) { _readCharsDecoder = new IncrementalReadCharsDecoder(); } InitIncrementalRead(_readCharsDecoder); return IncrementalRead(buffer, index, count); } }
void InitBinHexDecoder() { if ( binHexDecoder == null ) { binHexDecoder = new BinHexDecoder(); } else { binHexDecoder.Reset(); } incReadDecoder = binHexDecoder; }
internal int CopyToBinary(IncrementalReadDecoder decoder, int valueOffset) { if (value == null) { Debug.Assert(valueStartPos != -1); Debug.Assert(chars != null); return decoder.Decode(chars, valueStartPos + valueOffset, valueLength - valueOffset); } else { return decoder.Decode(value, valueOffset, value.Length - valueOffset); } }
public override int ReadContentAsBinHex(byte[] buffer, int index, int count) { int num; switch (this.state) { case State.Initial: case State.Error: case State.EndOfFile: case State.Closed: return 0; case State.Interactive: this.state = State.ReadContentAsBinHex; goto Label_015F; case State.PopNamespaceScope: case State.ClearNsAttributes: switch (this.NodeType) { case XmlNodeType.Element: throw base.CreateReadContentAsException("ReadContentAsBinHex"); case XmlNodeType.Attribute: if ((this.curNsAttr != -1) && base.reader.CanReadBinaryContent) { this.CheckBuffer(buffer, index, count); if (count == 0) { return 0; } if (this.nsIncReadOffset == 0) { if ((this.binDecoder != null) && (this.binDecoder is BinHexDecoder)) { this.binDecoder.Reset(); } else { this.binDecoder = new BinHexDecoder(); } } if (this.nsIncReadOffset == this.curNode.value.Length) { return 0; } this.binDecoder.SetNextOutputBuffer(buffer, index, count); this.nsIncReadOffset += this.binDecoder.Decode(this.curNode.value, this.nsIncReadOffset, this.curNode.value.Length - this.nsIncReadOffset); return this.binDecoder.DecodedCount; } goto Label_0146; case XmlNodeType.EndElement: return 0; } return 0; case State.ReadElementContentAsBase64: case State.ReadElementContentAsBinHex: case State.ReadContentAsBase64: throw new InvalidOperationException(Res.GetString("Xml_MixingBinaryContentMethods")); case State.ReadContentAsBinHex: goto Label_015F; default: return 0; } Label_0146: return base.reader.ReadContentAsBinHex(buffer, index, count); Label_015F: num = base.reader.ReadContentAsBinHex(buffer, index, count); if (num == 0) { this.state = State.Interactive; this.ProcessNamespaces(); } return num; }
public override int ReadContentAsBinHex(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(nameof(ReadContentAsBinHex)); 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 BinHexDecoder) { _binDecoder.Reset(); } else { _binDecoder = new BinHexDecoder(); } } 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.ReadContentAsBinHex(buffer, index, count); default: Debug.Assert(false); return 0; } case State.Interactive: _state = State.ReadContentAsBinHex; goto case State.ReadContentAsBinHex; case State.ReadContentAsBinHex: int read = reader.ReadContentAsBinHex(buffer, index, count); if (read == 0) { _state = State.Interactive; ProcessNamespaces(); } return read; case State.ReadContentAsBase64: case State.ReadElementContentAsBase64: case State.ReadElementContentAsBinHex: throw new InvalidOperationException(SR.Xml_MixingBinaryContentMethods); default: Debug.Assert(false); return 0; } }
private void InitBinHexDecoder() { if (_binHexDecoder == null) { _binHexDecoder = new BinHexDecoder(); } else { _binHexDecoder.Reset(); } _incReadDecoder = _binHexDecoder; }
public override int ReadContentAsBinHex(byte[] buffer, int index, int count) { int num; switch (this.state) { case State.Initial: case State.Error: case State.EndOfFile: case State.Closed: return(0); case State.Interactive: this.state = State.ReadContentAsBinHex; goto Label_015F; case State.PopNamespaceScope: case State.ClearNsAttributes: switch (this.NodeType) { case XmlNodeType.Element: throw base.CreateReadContentAsException("ReadContentAsBinHex"); case XmlNodeType.Attribute: if ((this.curNsAttr != -1) && base.reader.CanReadBinaryContent) { this.CheckBuffer(buffer, index, count); if (count == 0) { return(0); } if (this.nsIncReadOffset == 0) { if ((this.binDecoder != null) && (this.binDecoder is BinHexDecoder)) { this.binDecoder.Reset(); } else { this.binDecoder = new BinHexDecoder(); } } if (this.nsIncReadOffset == this.curNode.value.Length) { return(0); } this.binDecoder.SetNextOutputBuffer(buffer, index, count); this.nsIncReadOffset += this.binDecoder.Decode(this.curNode.value, this.nsIncReadOffset, this.curNode.value.Length - this.nsIncReadOffset); return(this.binDecoder.DecodedCount); } goto Label_0146; case XmlNodeType.EndElement: return(0); } return(0); case State.ReadElementContentAsBase64: case State.ReadElementContentAsBinHex: case State.ReadContentAsBase64: throw new InvalidOperationException(Res.GetString("Xml_MixingBinaryContentMethods")); case State.ReadContentAsBinHex: goto Label_015F; default: return(0); } Label_0146: return(base.reader.ReadContentAsBinHex(buffer, index, count)); Label_015F: num = base.reader.ReadContentAsBinHex(buffer, index, count); if (num == 0) { this.state = State.Interactive; this.ProcessNamespaces(); } return(num); }
void InitBase64Decoder() { if ( base64Decoder == null ) { base64Decoder = new Base64Decoder(); } else { base64Decoder.Reset(); } incReadDecoder = base64Decoder; }
public override int ReadContentAsBinHex(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("ReadContentAsBinHex"); 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 BinHexDecoder) { binDecoder.Reset(); } else { binDecoder = new BinHexDecoder(); } } 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.ReadContentAsBinHex(buffer, index, count)); default: Debug.Assert(false); return(0); } case State.Interactive: state = State.ReadContentAsBinHex; goto case State.ReadContentAsBinHex; case State.ReadContentAsBinHex: int read = reader.ReadContentAsBinHex(buffer, index, count); if (read == 0) { state = State.Interactive; ProcessNamespaces(); } return(read); case State.ReadContentAsBase64: case State.ReadElementContentAsBase64: case State.ReadElementContentAsBinHex: throw new InvalidOperationException(Res.GetString(Res.Xml_MixingBinaryContentMethods)); default: Debug.Assert(false); return(0); } }
// Reads the contents of an element including markup into a character buffer. Wellformedness checks are limited. // This method is designed to read large streams of embedded text by calling it successively. internal int ReadChars(char[] buffer, int index, int count) { if (parsingFunction == ParsingFunction.InIncrementalRead) { if (incReadDecoder != readCharsDecoder) { // mixing ReadChars with ReadBase64 or ReadBinHex if (readCharsDecoder == null) { readCharsDecoder = new IncrementalReadCharsDecoder(); } readCharsDecoder.Reset(); incReadDecoder = readCharsDecoder; } return IncrementalRead(buffer, index, count); } else { if (curNode.type != XmlNodeType.Element) { return 0; } if (curNode.IsEmptyElement) { Read(); return 0; } if (readCharsDecoder == null) { readCharsDecoder = new IncrementalReadCharsDecoder(); } InitIncrementalRead(readCharsDecoder); return IncrementalRead(buffer, index, count); } }