Exemple #1
0
        public override void WriteEndDocument()
        {
            _state.SetComplete();

            _writer.WriteEndDocument();
            _writer.Flush();
        }
Exemple #2
0
        public bool Read()
        {
            switch (_readState)
            {
            case ReadState.NotInitialized:
                int value;
                value = _stream.ReadByte();
                if (value != (int)TagType.Compound)
                {
                    throw new InvalidDataException("Stream does not contain a NBT compound.");
                }
                _type      = TagType.Compound;
                _readState = ReadState.Tag;
                _state.Start();
                _state.StartTag(_type);
                break;

            case ReadState.TagEnd:
            case ReadState.TagType:
                this.SetType(_stream.ReadByte());
                break;

            case ReadState.Tag:
            case ReadState.TagValue:
                this.MoveToNextElement();
                break;

            case ReadState.End:
                _state.SetComplete();
                break;

            default:
                throw new InvalidOperationException($"Unexpected read state '{_readState}'.");
            }

            return(_readState != ReadState.End);
        }
Exemple #3
0
 public override void WriteEndDocument()
 {
     _state.SetComplete();
 }