Ejemplo n.º 1
0
        internal override void WriteData(Stream writeStream)
        {
            // Figure out the type of this list, then check
            // to make sure all elements are that type.
            if (Tags.Count > 0)
            {
                NbtTagType listType = Tags[0].GetTagType();
                foreach (NbtTag tag in Tags)
                {
                    if (tag.GetTagType() != listType)
                    {
                        throw new Exception("All list items must be the same tag type.");
                    }
                }
                Type = listType;
            }

            var tagType = new NbtByte("", (byte)Type);

            tagType.WriteData(writeStream);

            var length = new NbtInt("", Tags.Count);

            length.WriteData(writeStream);

            foreach (NbtTag tag in Tags)
            {
                tag.WriteData(writeStream);
            }
        }
Ejemplo n.º 2
0
        internal override void WriteData(Stream writeStream)
        {
            var length = new NbtInt("", Value.Length);

            length.WriteData(writeStream);

            writeStream.Write(Value, 0, Value.Length);
        }