Exemple #1
0
        }                                            //{get{return this.reader.tags;}}
        public override void Read(Stream stream, bool nameread = true)
        {
            if (nameread)
            {
                base.Read(stream);
            }
            int tagtype = stream.ReadByte();

            if (tagtype == -1)
            {
                throw new IllegalNBTException(NBT.SmallStreamMessage);
            }
            this.ListTagType = (TagType)tagtype;
            int ListSize = stream.ReadIntBigEndian();

            Tags = new List <Tag>(ListSize);
            //this.ListSize = stream.ReadIntBigEndian();
            if (ListSize == -1)
            {
                throw new IllegalNBTException(NBT.SmallStreamMessage);
            }

            for (int i = 0; i < ListSize; i++)
            {
                Tag tag = NBT.ReadTag(this.ListTagType, stream, false);
                if (tag.Type == TagType.End)
                {
                    return;
                }
                //this.Root = tag;
                this.Tags.Add(tag);
            }
            //reader = new NBTListReader(stream, this);
            //reader.Read();
        }
Exemple #2
0
        //public NBT reader;
        public override void Read(Stream stream, bool nameread = true)
        {
            if (nameread)
            {
                base.Read(stream);
            }
            int read = stream.ReadByte();

            while (read != -1)
            {
                Tag tag = NBT.ReadTag((TagType)read, stream);
                if (tag is TagEnd)
                {
                    return;
                }
                this.tags.Add(tag.Name, tag);
                read = stream.ReadByte();
            }
            //reader = new NBT(stream);
            //reader.Read();
        }