internal override void WriteData(NbtBinaryWriter writeStream) { writeStream.Write(Value.Length); for (int i = 0; i < Value.Length; i++) { writeStream.Write(Value[i]); } }
/// <summary> Initializes a new instance of the NbtWriter class. </summary> /// <param name="stream"> Stream to write to. </param> /// <param name="rootTagName"> Name to give to the root tag (written immediately). </param> /// <param name="bigEndian"> Whether NBT data should be in Big-Endian encoding. </param> /// <exception cref="ArgumentNullException"> <paramref name="stream"/> or <paramref name="rootTagName"/> is <c>null</c>. </exception> /// <exception cref="ArgumentException"> <paramref name="stream"/> is not writable. </exception> public NbtWriter([NotNull] Stream stream, [NotNull] String rootTagName, bool bigEndian) { if (rootTagName == null) throw new ArgumentNullException("rootTagName"); writer = new NbtBinaryWriter(stream, bigEndian); writer.Write((byte)NbtTagType.Compound); writer.Write(rootTagName); parentType = NbtTagType.Compound; }
internal override void WriteTag(NbtBinaryWriter writeStream) { writeStream.Write(NbtTagType.Long); if (Name == null) { throw new NbtFormatException("Name is null"); } writeStream.Write(Name); writeStream.Write(Value); }
internal override void WriteTag(NbtBinaryWriter writeStream) { writeStream.Write(NbtTagType.IntArray); if (Name == null) { throw new NbtFormatException("Name is null"); } writeStream.Write(Name); WriteData(writeStream); }
/// <summary> Initializes a new instance of the NbtWriter class. </summary> /// <param name="stream"> Stream to write to. </param> /// <param name="rootTagName"> Name to give to the root tag (written immediately). </param> /// <param name="bigEndian"> Whether NBT data should be in Big-Endian encoding. </param> /// <exception cref="ArgumentNullException"> <paramref name="stream"/> or <paramref name="rootTagName"/> is <c>null</c>. </exception> /// <exception cref="ArgumentException"> <paramref name="stream"/> is not writable. </exception> public NbtWriter(Stream stream, String rootTagName, bool bigEndian) { if (rootTagName == null) { throw new ArgumentNullException("rootTagName"); } writer = new NbtBinaryWriter(stream, bigEndian); writer.Write((byte)NbtTagType.Compound); writer.Write(rootTagName); parentType = NbtTagType.Compound; }
internal override void WriteTag(NbtBinaryWriter writeStream, bool writeName) { writeStream.Write(NbtTagType.Double); if (writeName) { if (Name == null) { throw new NbtFormatException("Name is null"); } writeStream.Write(Name); } writeStream.Write(Value); }
internal override void WriteData(NbtBinaryWriter writeStream) { if (ListType == NbtTagType.Unknown) { throw new NbtFormatException("NbtList had no elements and an Unknown ListType"); } writeStream.Write(ListType); writeStream.Write(tags.Count); foreach (NbtTag tag in tags) { tag.WriteData(writeStream); } }
internal override void WriteTag(NbtBinaryWriter writeStream, bool writeName) { writeStream.Write(NbtTagType.Compound); if (writeName) { if (Name == null) { throw new NbtFormatException("Name is null"); } writeStream.Write(Name); } WriteData(writeStream); }
internal override void WriteData(NbtBinaryWriter writeStream) { foreach (NbtTag tag in tags.Values) { tag.WriteTag(writeStream); } writeStream.Write(NbtTagType.End); }
internal override void WriteData(NbtBinaryWriter writeStream) { writeStream.Write(Value); }
internal override void WriteTag(NbtBinaryWriter writeStream) { writeStream.Write(NbtTagType.Long); if (Name == null) throw new NbtFormatException("Name is null"); writeStream.Write(Name); writeStream.Write(Value); }
internal override void WriteData(NbtBinaryWriter writeStream) { writeStream.Write(Value.Length); writeStream.Write(Value, 0, Value.Length); }
/// <summary> Begins a named compound tag. </summary> /// <param name="tagName"> Name to give to this compound tag. May not be null. </param> /// <exception cref="NbtFormatException"> No more tags can be written -OR- /// an unnamed compound tag was expected -OR- a tag of a different type was expected. </exception> public void BeginCompound(String tagName) { EnforceConstraints(tagName, NbtTagType.Compound); GoDown(NbtTagType.Compound); writer.Write((byte)NbtTagType.Compound); writer.Write(tagName); }
internal override void WriteTag(NbtBinaryWriter writeStream) { writeStream.Write(NbtTagType.IntArray); if (Name == null) throw new NbtFormatException("Name is null"); writeStream.Write(Name); WriteData(writeStream); }
internal override void WriteTag( NbtBinaryWriter writeStream, bool writeName ) { writeStream.Write( NbtTagType.Double ); if( writeName ) { if( Name == null ) throw new NbtFormatException( "Name is null" ); writeStream.Write( Name ); } writeStream.Write( Value ); }
internal override void WriteData( NbtBinaryWriter writeStream ) { writeStream.Write( Value.Length ); writeStream.Write( Value, 0, Value.Length ); }