Пример #1
0
 public virtual void Load(NbtReader reader, INbtContainerNode parent)
 {
     Parent = parent;
     if (parent == null || parent.Type != NbtType.List)
     {
         reader.ReadType(); // Skip type byte
         Name = reader.ReadString();
     }
 }
Пример #2
0
		public void ReadString_EndOfStreamException()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x08, 0x00, 0x04 };
			byte[] data = new byte[] { 0x61, 0x73 };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			// Act
			NbtString result = reader.ReadString(tagInfo);
		}
Пример #3
0
		public void ReadString_Normal()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x08, 0x00, 0x04 };
			byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x00, 0x04, 0x6A, 0x6B, 0x6C, 0x3B };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			NbtTagType expectedTagType = NbtTagType.String;
			string expectedName = "asdf";
			string expectedValue = "jkl;";

			// Act
			NbtString result = reader.ReadString(tagInfo);

			// Assert
			Assert.AreEqual(expectedName, result.Name);
			Assert.AreEqual(expectedTagType, result.Type);
			Assert.AreEqual(expectedValue, result.Value);
		}
Пример #4
0
		public void ReadString_ObjectDisposedException()
		{
			// Arrange
			NbtTagInfo tagInfo = (NbtTagInfo)new byte[] { 0x08, 0x00, 0x04 };
			byte[] data = new byte[] { 0x61, 0x73, 0x64, 0x66, 0x00, 0x04, 0x6A, 0x6B, 0x6C, 0x3B };

			MemoryStream stream = new MemoryStream(data);

			NbtReader reader = new NbtReader(stream);

			stream.Close();

			// Act
			NbtString result = reader.ReadString(tagInfo);
		}
Пример #5
0
 public override void Load(NbtReader reader, INbtContainerNode parent)
 {
     base.Load(reader, parent);
     Value = reader.ReadString();
 }