Пример #1
0
        /// <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);
        }
Пример #2
0
 public override void WritePayloadTo(ENbtBinaryWriter writer)
 {
     writer.Write(this.X);
     writer.Write(this.Y);
     writer.Write(this.Z);
     writer.Write(this.W);
 }
Пример #3
0
        /// <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);
            }
        }
Пример #4
0
        [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);
            }
        }
Пример #5
0
 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);
 }
Пример #6
0
 public override void WritePayloadTo(ENbtBinaryWriter writer)
 {
     writer.Write(this.Value.ToUnixTimeMilliseconds());
 }
Пример #7
0
 public override void WritePayloadTo(ENbtBinaryWriter writer)
 {
     writer.Write(this.Value);
 }
Пример #8
0
 public override void WritePayloadTo(ENbtBinaryWriter writer)
 {
 }
Пример #9
0
 public override void WritePayloadTo(ENbtBinaryWriter writer)
 {
     Contract.Requires <ArgumentNullException>(writer != null);
 }
Пример #10
0
 /// <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);