public void TestCreateString() { String Value = "Hello, Is it me your looking for?"; ITag Tag = NBTTagFactory.Create(DefaultName, Value); TestTag(Tag, DefaultName, NBTTagType.String); }
public void TestCreateByte() { ITag Tag = NBTTagFactory.Create(DefaultName, false); TestTag(Tag, DefaultName, NBTTagType.Byte); Tag = NBTTagFactory.Create(DefaultName, (Byte)1); TestTag(Tag, DefaultName, NBTTagType.Byte); }
/// <summary>Reads the nbt's content from the <see cref="Stream"/></summary> /// <param name="tag">The tag to read from the <see cref="Stream"/></param> /// <param name="Context">The context to read from</param> public void ReadContent(ITag tag, SerializationContext Context) { ITag SubTag; Object O = tag.GetInformation(NBTTagInformation.ListSubtype); if (O == null) { throw new Exception("List returned no subtype"); } var SubTagType = (NBTTagType)O; ITagReader Reader = NBTReader.GetReader(SubTagType); if (Reader == null) { throw new Exception($"No reader for type: {SubTagType}"); } if (SubTagType == NBTTagType.List) { for (Int32 I = 0; I < tag.Count; I++) { SubTag = new NBTTagList(SubTagType); SubTag.SetInformation(NBTTagInformation.ListSubtype, (NBTTagType)Context.Stream.ReadByte()); SubTag.SetInformation(NBTTagInformation.ListSize, Context.ReadInt32()); Reader.ReadContent(SubTag, Context); tag[I] = SubTag; } } else { for (Int32 I = 0; I < tag.Count; I++) { SubTag = NBTTagFactory.Create(SubTagType); tag[I] = SubTag; Reader.ReadContent(SubTag, Context); } } }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(Byte[] Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.ByteArray, String.Empty, Value)); }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(Boolean Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Byte, String.Empty, (Byte)(Value ? 1 : 0))); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, List <String> Value) { this._Tag.Add(NBTTagFactory.Create(Name, Value)); }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.String, String.Empty, Value)); }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(Int64[] Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.LongArray, String.Empty, Value)); }
public void TestCreateInt16() { ITag Tag = NBTTagFactory.Create(DefaultName, (Int16)128); TestTag(Tag, DefaultName, NBTTagType.Short); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, Int64[] Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.LongArray, Name, Value)); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, Int32 Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Int, Name, Value)); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, Single Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Float, Name, Value)); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, Double Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Double, Name, Value)); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, Byte[] Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.ByteArray, Name, Value)); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, Boolean Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Byte, Name, (Byte)(Value ? 1 : 0))); }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(Double Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Double, String.Empty, Value)); }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(Single Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Float, String.Empty, Value)); }
public void TestCreateInt32() { ITag Tag = NBTTagFactory.Create(DefaultName, 128); TestTag(Tag, DefaultName, NBTTagType.Int); }
/// <summary>Add an item to the list</summary> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(Int16 Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.Short, String.Empty, Value)); }
public void TestCreateInt64() { ITag Tag = NBTTagFactory.Create(DefaultName, (Int64)128); TestTag(Tag, DefaultName, NBTTagType.Long); }
public void TestCreateFloat() { ITag Tag = NBTTagFactory.Create(DefaultName, 128f); TestTag(Tag, DefaultName, NBTTagType.Float); }
/// <summary>Adds a new sub <see cref="NBTTag"/> to the collection</summary> /// <param name="Name">The name of the tag to add to the collection</param> /// <param name="Value">The value of the tag to add to the collection</param> public void Add(String Name, String Value) { this._Tag.Add(NBTTagFactory.Create(NBTTagType.String, Name, Value)); }