public override bool Read() { switch (this.position) { case ReaderPosition.None: this.position = ReaderPosition.StartElement; return(true); case ReaderPosition.StartElement: this.position = ReaderPosition.Content; return(true); case ReaderPosition.Content: this.position = ReaderPosition.EndElement; return(true); case ReaderPosition.EndElement: this.position = ReaderPosition.EOF; return(false); case ReaderPosition.EOF: return(false); default: return(false); } }
public override bool Read() { switch (this.position) { case ReaderPosition.None: position = ReaderPosition.StartElement; return(true); case ReaderPosition.StartElement: position = ReaderPosition.Content; return(true); case ReaderPosition.Content: position = ReaderPosition.EndElement; return(true); case ReaderPosition.EndElement: position = ReaderPosition.EOF; return(false); case ReaderPosition.EOF: return(false); default: // we should never get here // it means we managed to get into some unknown position in the stream Fx.Assert(false, "Unknown read position in XmlByteStreamReader"); return(false); } }
public bool Read() { if (_itemEnumerator == null) { _itemEnumerator = _items.GetEnumerator(); } bool isEmpty; if (MoveNextValue()) { _position = ReaderPosition.Value; } else if (MoveNextAttribute()) { _position = ReaderPosition.Attribute; } else if (MoveNextItem(out isEmpty)) { _position = isEmpty ? ReaderPosition.EmptyItem : ReaderPosition.Item; } else { _position = ReaderPosition.None; return(false); } return(true); }
public override int ReadContentAsBase64(byte[] buffer, int index, int count) { if (buffer == null) { throw new ArgumentNullException("buffer"); } if (this.position != ReaderPosition.Content) { throw new InvalidOperationException("XML reader not in Element"); } if (count == 0) { return(0); } int readCount = this.stream.Read(buffer, index, count); if (readCount == 0) { this.position = ReaderPosition.EndElement; } return(readCount); }
public override bool MoveToElement() { if (this.position == ReaderPosition.None) { this.position = ReaderPosition.StartElement; return(true); } return(false); }
public override void Close() { if (!this.closed) { this.closed = true; this.position = ReaderPosition.EOF; this.readerQuotas = null; if (this.streamOwner) { this.stream.Close(); } } }
public override void Close() { if (!this.closed) { try { this.OnClose(); } finally { this.position = ReaderPosition.EOF; this.closed = true; } } }
protected void EnsureInContent() { // This method is only being called from XmlByteStreamReader.ReadContentAsBase64. // We don't block if the position is None or StartElement since we want our XmlByteStreamReader // to be a little bit smarter when people just to access the content of the ByteStreamMessage. if (this.position == ReaderPosition.EndElement || this.position == ReaderPosition.EOF) { throw FxTrace.Exception.AsError( new InvalidOperationException(SR.ByteStreamReaderNotInByteStream(ByteStreamMessageUtility.StreamElementName))); } else { this.position = ReaderPosition.Content; } }
public bool Read() { if (_reader == null) { _reader = _command.ExecuteReader(); } if (_reader.Read()) { if (_lastItemName != ItemName) { _lastItemName = ItemName; if (_reader.IsDBNull(1)) { _lastAttributeName = null; _position = ReaderPosition.EmptyItem; } else { _lastAttributeName = AttributeName; _position = ReaderPosition.Item; } } else if (_lastAttributeName != AttributeName) { _lastAttributeName = AttributeName; _position = ReaderPosition.Attribute; } else { _position = ReaderPosition.Value; } return(true); } _position = ReaderPosition.None; return(false); }
public override bool Read() { switch (this.position) { case ReaderPosition.None: this.position = ReaderPosition.StartElement; return true; case ReaderPosition.StartElement: this.position = ReaderPosition.Content; return true; case ReaderPosition.Content: this.position = ReaderPosition.EndElement; return true; case ReaderPosition.EndElement: this.position = ReaderPosition.EOF; return false; case ReaderPosition.EOF: return false; default: return false; } }
public override bool MoveToElement() { if (this.position == ReaderPosition.None) { this.position = ReaderPosition.StartElement; return true; } return false; }
public override void MoveToStartElement() { base.MoveToStartElement(); this.position = ReaderPosition.StartElement; }
public override bool Read() { switch (this.position) { case ReaderPosition.None: position = ReaderPosition.StartElement; return true; case ReaderPosition.StartElement: position = ReaderPosition.Content; return true; case ReaderPosition.Content: position = ReaderPosition.EndElement; return true; case ReaderPosition.EndElement: position = ReaderPosition.EOF; return false; case ReaderPosition.EOF: return false; default: // we should never get here // it means we managed to get into some unknown position in the stream Fx.Assert(false, "Unknown read position in XmlByteStreamReader"); return false; } }
public bool Read() { if (_itemEnumerator == null) { _itemEnumerator = _items.GetEnumerator(); } bool isEmpty; if (MoveNextValue()) { _position = ReaderPosition.Value; } else if (MoveNextAttribute()) { _position = ReaderPosition.Attribute; } else if (MoveNextItem(out isEmpty)) { _position = isEmpty ? ReaderPosition.EmptyItem : ReaderPosition.Item; } else { _position = ReaderPosition.None; return false; } return true; }
protected XmlByteStreamReader(XmlDictionaryReaderQuotas quotas) { this.quotas = quotas; this.position = ReaderPosition.None; }
public override int ReadContentAsBase64(byte[] buffer, int index, int count) { if (buffer == null) { throw new ArgumentNullException("buffer"); } if (this.position != ReaderPosition.Content) { throw new InvalidOperationException("XML reader not in Element"); } if (count == 0) { return 0; } int readCount = this.stream.Read(buffer, index, count); if (readCount == 0) { this.position = ReaderPosition.EndElement; } return readCount; }