internal override void ReadTag(NBTStream stream)
        {
            stream.ReadByte();
            string name = stream.ReadString();

            this.Read(stream);
        }
示例#2
0
        internal void ReadTag(NBTStream stream)
        {
            stream.ReadByteTag();
            string name = stream.ReadStringTag();

            this.Read(stream);
        }
 internal override void Write(NBTStream stream)
 {
     foreach (Tag t in this.tags.Values)
     {
         t.WriteTag(stream);
     }
     stream.WriteByte((byte)NBTTagType.END);
 }
示例#4
0
        internal override void Write(NBTStream stream)
        {
            int len = this.Data.Length;

            stream.WriteInt(len);
            stream.Reservation(len);
            stream.WriteBytes(this.Data);
        }
示例#5
0
 internal override void Write(NBTStream stream)
 {
     stream.WriteByteTag((byte)this.ListTagType);
     stream.WriteIntTag(this.Tags.Count);
     for (int i = 0; i < this.Tags.Count; ++i)
     {
         this.Tags[i].Write(stream);
     }
 }
        internal override void Write(NBTStream stream)
        {
            int len = this.Data.Length;

            stream.WriteInt(len);
            for (int i = 0; i < len; ++i)
            {
                stream.WriteByte(this.Data[i]);
            }
        }
示例#7
0
        internal override void Read(NBTStream stream)
        {
            int len = stream.ReadIntTag();

            this.Data = new byte[len];
            for (int i = 0; i < len; ++i)
            {
                this.Data[i] = stream.ReadByteTag();
            }
        }
        internal override void Read(NBTStream stream)
        {
            int len = stream.ReadInt();

            this.Data = new long[len];
            for (int i = 0; i < len; ++i)
            {
                this.Data[i] = stream.ReadLong();
            }
        }
示例#9
0
        internal override void Read(NBTStream stream)
        {
            int len = stream.ReadInt();

            this.Data = new int[len];
            for (int i = 0; i < len; i++)
            {
                this.Data[i] = stream.ReadInt();
            }
        }
        internal override void Write(NBTStream stream)
        {
            int len = this.Data.Length;

            stream.WriteInt(len);
            stream.Reservation(len * sizeof(long));
            for (int i = 0; i < len; ++i)
            {
                stream.WriteLong(this.Data[i]);
            }
        }
示例#11
0
 internal override void WriteTag(NBTStream stream)
 {
     if (this.Name != null)
     {
         stream.WriteByte((byte)this.TagType);
         stream.WriteString(this.Name);
         this.Write(stream);
     }
     else
     {
         throw new NullReferenceException("Tag Name Null");
     }
 }
示例#12
0
        internal override void WriteTag(NBTStream stream)
        {
            int len = this.Data.Length;

            if (this.Name != null)
            {
                stream.WriteByte((byte)this.TagType);
                stream.WriteString(this.Name);
                stream.WriteInt(len);
                stream.Reservation(len);
                stream.WriteBytes(this.Data);
            }
            else
            {
                throw new NullReferenceException("Tag Name Null");
            }
        }
        internal override void WriteTag(NBTStream stream)
        {
            int len = this.Data.Length;

            if (this.Name != null)
            {
                stream.WriteByte((byte)this.TagType);
                stream.WriteString(this.Name);
                stream.WriteInt(len);
                for (int i = 0; i < len; ++i)
                {
                    stream.WriteByte(this.Data[i]);
                }
            }
            else
            {
                throw new NullReferenceException("Tag Name Null");
            }
        }
示例#14
0
 internal abstract void ReadTag(NBTStream stream);
示例#15
0
 internal override void Write(NBTStream stream)
 {
     stream.WriteShort(this.Data);
 }
示例#16
0
 internal override void Read(NBTStream stream)
 {
     stream.ReadInt();
     this.Data = stream.ReadBytes();
 }
示例#17
0
        internal override void Read(NBTStream stream)
        {
            while (stream.Position != stream.Length)
            {
                NBTTagType type = (NBTTagType)stream.ReadByteTag();
                String     name = "";
                int        len  = 0;
                switch (type)
                {
                case NBTTagType.END:
                    return;

                case NBTTagType.BYTE:
                    this.SetByte(stream.ReadStringTag(), stream.ReadByteTag());
                    break;

                case NBTTagType.SHORT:
                    this.SetShort(stream.ReadStringTag(), stream.ReadShortTag());
                    break;

                case NBTTagType.INT:
                    this.SetInt(stream.ReadStringTag(), stream.ReadIntTag());
                    break;

                case NBTTagType.LONG:
                    this.SetLong(stream.ReadStringTag(), stream.ReadLongTag());
                    break;

                case NBTTagType.FLOAT:
                    this.SetFloat(stream.ReadStringTag(), stream.ReadFloatTag());
                    break;

                case NBTTagType.DOUBLE:
                    this.SetDouble(stream.ReadStringTag(), stream.ReadDoubleTag());
                    break;

                case NBTTagType.BYTE_ARRAY:
                    name = stream.ReadStringTag();
                    byte[] byteArray = new byte[stream.ReadIntTag()];
                    for (int i = 0; i < len; ++i)
                    {
                        byteArray[i] = stream.ReadByteTag();
                    }
                    this.SetByteArray(name, byteArray);
                    break;

                case NBTTagType.STRING:
                    this.SetString(stream.ReadStringTag(), stream.ReadStringTag());
                    break;

                case NBTTagType.LIST:
                    ListTag list = new ListTag(stream.ReadStringTag(), NBTTagType.END);
                    list.Read(stream);
                    this.SetTag(list);
                    break;

                case NBTTagType.COMPOUND:
                    CompoundTag compound = new CompoundTag(stream.ReadStringTag());
                    compound.Read(stream);
                    this.SetTag(compound);
                    break;

                case NBTTagType.INT_ARRAY:
                    name = stream.ReadStringTag();
                    int[] intArray = new int[stream.ReadIntTag()];
                    for (int i = 0; i < len; ++i)
                    {
                        intArray[i] = stream.ReadIntTag();
                    }
                    this.SetIntArray(name, intArray);
                    break;

                case NBTTagType.LONG_ARRAY:
                    name = stream.ReadStringTag();
                    long[] longArray = new long[stream.ReadIntTag()];
                    for (int i = 0; i < len; ++i)
                    {
                        longArray[i] = stream.ReadLongTag();
                    }
                    this.SetLongArray(stream.ReadStringTag(), longArray);
                    break;

                default:
                    throw new FormatException();
                }
            }
        }
示例#18
0
 internal override void Write(NBTStream stream)
 {
     stream.WriteDouble(this.Data);
 }
示例#19
0
        internal override void Read(NBTStream stream)
        {
            this.ListTagType = (NBTTagType)stream.ReadByteTag();
            for (int i = 0; i < stream.ReadIntTag(); ++i)
            {
                Tag tag = null;
                switch (this.ListTagType)
                {
                case NBTTagType.BYTE:
                    tag = new ByteTag(0);
                    break;

                case NBTTagType.SHORT:
                    tag = new ShortTag(0);
                    break;

                case NBTTagType.INT:
                    tag = new IntTag(0);
                    break;

                case NBTTagType.LONG:
                    tag = new LongTag(0);
                    break;

                case NBTTagType.FLOAT:
                    tag = new FloatTag(0);
                    break;

                case NBTTagType.DOUBLE:
                    tag = new DoubleTag(0);
                    break;

                case NBTTagType.BYTE_ARRAY:
                    tag = new ByteArrayTag(new byte[0]);
                    break;

                case NBTTagType.STRING:
                    tag = new StringTag("");
                    break;

                case NBTTagType.LIST:
                    tag = new ListTag(NBTTagType.END);
                    break;

                case NBTTagType.COMPOUND:
                    tag = new CompoundTag();
                    break;

                case NBTTagType.INT_ARRAY:
                    tag = new IntArrayTag(new int[0]);
                    break;

                case NBTTagType.LONG_ARRAY:
                    tag = new LongArrayTag(new long[0]);
                    break;

                default:
                    throw new NotSupportedException();
                }

                tag.Read(stream);
                this.Tags.Add(tag);
            }
        }
示例#20
0
 internal override void Read(NBTStream stream)
 {
     this.Data = stream.ReadDouble();
 }
示例#21
0
 internal void WriteTag(NBTStream stream)
 {
     stream.WriteByteTag((byte)this.Type);
     stream.WriteStringTag(this.Name);
     this.Write(stream);
 }
        internal override void Read(NBTStream stream)
        {
            while (stream.Offset != stream.Length)
            {
                NBTTagType type    = (NBTTagType)stream.ReadByte();
                string     tagName = "";
                int        len     = 0;
                switch (type)
                {
                case NBTTagType.END:
                    return;

                case NBTTagType.BYTE:
                    tagName = stream.ReadString();
                    this.PutByte(tagName, stream.ReadByte());
                    break;

                case NBTTagType.SHORT:
                    tagName = stream.ReadString();
                    this.PutShort(tagName, stream.ReadShort());
                    break;

                case NBTTagType.INT:
                    tagName = stream.ReadString();
                    this.PutInt(tagName, stream.ReadInt());
                    break;

                case NBTTagType.LONG:
                    tagName = stream.ReadString();
                    this.PutLong(tagName, stream.ReadLong());
                    break;

                case NBTTagType.FLOAT:
                    tagName = stream.ReadString();
                    this.PutFloat(tagName, stream.ReadFloat());
                    break;

                case NBTTagType.DOUBLE:
                    tagName = stream.ReadString();
                    this.PutDouble(tagName, stream.ReadDouble());
                    break;

                case NBTTagType.BYTE_ARRAY:
                    tagName = stream.ReadString();
                    len     = stream.ReadInt();
                    byte[] b = new byte[len];
                    for (int i = 0; i < len; ++i)
                    {
                        b[i] = stream.ReadByte();
                    }
                    this.PutByteArray(tagName, b);
                    break;

                case NBTTagType.STRING:
                    tagName = stream.ReadString();
                    this.PutString(tagName, stream.ReadString());
                    break;

                case NBTTagType.LIST:
                    tagName = stream.ReadString();
                    ListTag listtag = new ListTag(NBTTagType.BYTE);
                    listtag.Read(stream);
                    listtag.Name = tagName;
                    this.PutList(listtag);
                    break;

                case NBTTagType.COMPOUND:
                    tagName = stream.ReadString();
                    CompoundTag comp = new CompoundTag();
                    comp.Read(stream);
                    this.PutCompound(tagName, comp);
                    break;

                case NBTTagType.INT_ARRAY:
                    tagName = stream.ReadString();
                    len     = stream.ReadInt();
                    int[] n = new int[len];
                    for (int i = 0; i < len; ++i)
                    {
                        n[i] = stream.ReadInt();
                    }
                    this.PutIntArray(tagName, n);
                    break;

                case NBTTagType.LONG_ARRAY:
                    tagName = stream.ReadString();
                    len     = stream.ReadInt();
                    long[] l = new long[len];
                    for (int i = 0; i < len; ++i)
                    {
                        l[i] = stream.ReadLong();
                    }
                    this.PutLongArray(tagName, l);
                    break;

                default:
                    throw new FormatException();
                }
            }
        }
示例#23
0
 internal override void Read(NBTStream stream)
 {
     this.Data = stream.ReadByteTag();
 }
示例#24
0
 internal override void Read(NBTStream stream)
 {
     this.Data = stream.ReadShort();
 }
示例#25
0
 internal abstract void WriteTag(NBTStream stream);
示例#26
0
 internal override void ReadTag(NBTStream stream)
 {
     throw new NotImplementedException();
 }
示例#27
0
 internal override void Write(NBTStream stream)
 {
     stream.WriteByteTag(this.Data);
 }