Write() public méthode

public Write ( NbtTagType value ) : void
value NbtTagType
Résultat void
Exemple #1
0
 internal override void WriteData(NbtBinaryWriter writeStream)
 {
     writeStream.Write(Value.Length);
     for (int i = 0; i < Value.Length; i++)
     {
         writeStream.Write(Value[i]);
     }
 }
Exemple #2
0
 /// <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;
 }
Exemple #3
0
 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);
 }
Exemple #4
0
 internal override void WriteTag(NbtBinaryWriter writeStream)
 {
     writeStream.Write(NbtTagType.IntArray);
     if (Name == null)
     {
         throw new NbtFormatException("Name is null");
     }
     writeStream.Write(Name);
     WriteData(writeStream);
 }
Exemple #5
0
 /// <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;
 }
Exemple #6
0
 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);
 }
Exemple #7
0
 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);
     }
 }
Exemple #8
0
        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);
        }
Exemple #9
0
 internal override void WriteData(NbtBinaryWriter writeStream)
 {
     foreach (NbtTag tag in tags.Values)
     {
         tag.WriteTag(writeStream);
     }
     writeStream.Write(NbtTagType.End);
 }
Exemple #10
0
 internal override void WriteData(NbtBinaryWriter writeStream)
 {
     writeStream.Write(Value);
 }
Exemple #11
0
 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);
 }
Exemple #12
0
 internal override void WriteData(NbtBinaryWriter writeStream)
 {
     writeStream.Write(Value);
 }
Exemple #13
0
 internal override void WriteData(NbtBinaryWriter writeStream)
 {
     writeStream.Write(Value.Length);
     writeStream.Write(Value, 0, Value.Length);
 }
Exemple #14
0
        /// <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);
        }
Exemple #15
0
 internal override void WriteTag(NbtBinaryWriter writeStream)
 {
     writeStream.Write(NbtTagType.IntArray);
     if (Name == null)
         throw new NbtFormatException("Name is null");
     writeStream.Write(Name);
     WriteData(writeStream);
 }
Exemple #16
0
 internal override void WriteData(NbtBinaryWriter writeStream)
 {
     writeStream.Write(Value.Length);
     for (int i = 0; i < Value.Length; i++) {
         writeStream.Write(Value[i]);
     }
 }
Exemple #17
0
 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 );
 }
Exemple #18
0
 internal override void WriteData( NbtBinaryWriter writeStream )
 {
     writeStream.Write( Value.Length );
     writeStream.Write( Value, 0, Value.Length );
 }