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); } }
internal override void WriteData(Stream writeStream) { var length = new NbtInt("", Value.Length); length.WriteData(writeStream); writeStream.Write(Value, 0, Value.Length); }