예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
            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);
            }
예제 #4
0
        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);
        }
예제 #5
0
 public override bool MoveToElement()
 {
     if (this.position == ReaderPosition.None)
     {
         this.position = ReaderPosition.StartElement;
         return(true);
     }
     return(false);
 }
예제 #6
0
 public override void Close()
 {
     if (!this.closed)
     {
         this.closed       = true;
         this.position     = ReaderPosition.EOF;
         this.readerQuotas = null;
         if (this.streamOwner)
         {
             this.stream.Close();
         }
     }
 }
예제 #7
0
 public override void Close()
 {
     if (!this.closed)
     {
         try
         {
             this.OnClose();
         }
         finally
         {
             this.position = ReaderPosition.EOF;
             this.closed   = true;
         }
     }
 }
예제 #8
0
 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;
     }
 }
예제 #9
0
            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);
            }
예제 #10
0
파일: RawXmlReader.cs 프로젝트: ncdc/qpid
 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;
     }
 }
예제 #11
0
파일: RawXmlReader.cs 프로젝트: ncdc/qpid
 public override void Close()
 {
     if (!this.closed)
     {
         this.closed = true;
         this.position = ReaderPosition.EOF;
         this.readerQuotas = null;
         if (this.streamOwner)
         {
             this.stream.Close();
         }
     }
 }
예제 #12
0
파일: RawXmlReader.cs 프로젝트: ncdc/qpid
        public override bool MoveToElement()
        {
            if (this.position == ReaderPosition.None)
            {
                this.position = ReaderPosition.StartElement;
                return true;
            }

            return false;
        }
예제 #13
0
 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;
     }
 }
 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 override void MoveToStartElement()
 {
     base.MoveToStartElement();
     this.position = ReaderPosition.StartElement; 
 }
예제 #17
0
            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; 
 }
예제 #19
0
파일: RawXmlReader.cs 프로젝트: ncdc/qpid
        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;
        }
예제 #20
0
 protected XmlByteStreamReader(XmlDictionaryReaderQuotas quotas)
 {
     this.quotas   = quotas;
     this.position = ReaderPosition.None;
 }
 public override void Close()
 {
     if (!this.closed)
     {
         try
         {
             this.OnClose(); 
         }
         finally
         {
             this.position = ReaderPosition.EOF;
             this.closed = true;
         }
     }
 }