/// <summary> /// Writes the <see cref="Tag"/> to the specified <paramref name="writer"/>. /// </summary> /// <param name="writer">The <see cref="ENbtBinaryWriter"/> to write the tag to.</param> public void WriteTo(ENbtBinaryWriter writer) { Contract.Requires <ArgumentNullException>(writer != null); writer.Write(this.Type); this.WritePayloadTo(writer); }
public override void WritePayloadTo(ENbtBinaryWriter writer) { writer.Write(this.X); writer.Write(this.Y); writer.Write(this.Z); writer.Write(this.W); }
/// <summary> /// Writes the <see cref="Tag"/> to the specified <paramref name="destination"/>. /// </summary> /// <param name="destination">The <see cref="Stream"/> to write the <see cref="Tag"/> to.</param> public void WriteTo(Stream destination) { Contract.Requires <ArgumentNullException>(destination != null); using (ENbtBinaryWriter bw = new ENbtBinaryWriter(destination, true)) { this.WriteTo(bw); } }
[ContractVerification(false)] // Code contracts doesn't see the .Where(child => child != null)-clause and thus warns. public override void WritePayloadTo(ENbtBinaryWriter writer) { List <Tag> childsToWrite = this.children.Where(child => child != null).ToList(); writer.Write(childsToWrite.Count); for (int i = 0; i < childsToWrite.Count; i++) { childsToWrite[i].WriteTo(writer); } }
public override void WritePayloadTo(ENbtBinaryWriter writer) { foreach (KeyValuePair <StringTag, Tag> child in this.children) { if (child.Key != null && child.Value != null) { child.Key.WriteTo(writer); child.Value.WriteTo(writer); } } EndTag.Default.WriteTo(writer); }
public override void WritePayloadTo(ENbtBinaryWriter writer) { writer.Write(this.Value.ToUnixTimeMilliseconds()); }
public override void WritePayloadTo(ENbtBinaryWriter writer) { writer.Write(this.Value); }
public override void WritePayloadTo(ENbtBinaryWriter writer) { }
public override void WritePayloadTo(ENbtBinaryWriter writer) { Contract.Requires <ArgumentNullException>(writer != null); }
/// <summary> /// Writes the payload (all data without the tag type) of the <see cref="Tag"/> to the specified <paramref name="writer"/>. /// </summary> /// <param name="writer">The <see cref="ENbtBinaryWriter"/> to write the tag to.</param> public abstract void WritePayloadTo(ENbtBinaryWriter writer);