public NbtTag Deserialize(BinaryReader br, bool requireName) { string name = null; if (requireName) { name = br.ReadTagString(); } var elementType = br.ReadTagType(); var count = br.ReadInt32().ToggleEndian(); if (count <= 0) { return(new NbtList(elementType, name)); } var elements = new NbtTag[count]; for (var i = 0; i < count; ++i) { elements[i] = NbtTagSerializer.DeserializeTag(br, elementType, false); } return(new NbtList(elements, name)); }
public void Serialize(NbtTag tag, BinaryWriter bw) { var nbtLong = (NbtLong)tag; if (nbtLong.Name != null) { bw.WriteTagValue(nbtLong.Name); } bw.Write(nbtLong.Value.ToggleEndian()); }
public void Serialize(NbtTag tag, BinaryWriter bw, bool requireName) { var nbtShort = (NbtShort)tag; if (requireName) { bw.WriteTagValue(nbtShort.Name); } bw.Write(nbtShort.Value.ToggleEndian()); }
public void Serialize(NbtTag tag, BinaryWriter bw, bool requireName) { var nbtByte = (NbtByte)tag; if (requireName) { bw.WriteTagValue(nbtByte.Name); } bw.Write(nbtByte.Value); }
public void Serialize(NbtTag tag, BinaryWriter bw) { var nbtDouble = (NbtDouble)tag; if (nbtDouble.Name != null) { bw.WriteTagValue(nbtDouble.Name); } bw.WriteTagValue(nbtDouble.Value); }
public void Serialize(NbtTag tag, BinaryWriter bw) { var nbtList = (NbtList)tag; if (nbtList.Name != null) { bw.WriteTagValue(nbtList.Name); } foreach (var elem in nbtList._childTags) { NbtTagSerializer.SerializeTag(elem, bw, false); } }
public void Serialize(NbtTag tag, BinaryWriter bw, bool requireName) { var nbtCompound = (NbtCompound)tag; if (requireName) { bw.WriteTagValue(nbtCompound.Name); } foreach (var elem in nbtCompound._childTags) { NbtTagSerializer.SerializeTag(elem.Value, bw); } NbtTagSerializer.SerializeTag(new NbtEnd(), bw); }
public void Serialize(NbtTag tag, BinaryWriter bw, bool requireName) { var nbtList = (NbtList)tag; if (requireName) { bw.WriteTagValue(nbtList.Name); } bw.WriteTagValue(nbtList.ElementType); bw.Write(nbtList.Count.ToggleEndian()); foreach (var elem in nbtList._childTags) { NbtTagSerializer.SerializeTag(elem, bw, false, false); } }
public void Serialize(NbtTag tag, BinaryWriter bw) { }
public void Serialize(NbtTag tag, BinaryWriter bw, bool requireName) { }