public object Deserialize(NbtReader nbtReader) { NbtTagInfo tagInfo = nbtReader.ReadTagInfo(); if (tagInfo.Type != NbtTagType.Compound) throw new FormatException("the deserialized stream must contain root tag which is compound."); NbtCompound root = nbtReader.ReadCompound(tagInfo); return DeserializeTag(root, m_type); }
public object Deserialize(NbtReader nbtReader) { NbtTagInfo tagInfo = nbtReader.ReadTagInfo(); if (tagInfo.Type != NbtTagType.Compound) { throw new FormatException("the deserialized stream must contain root tag which is compound."); } NbtCompound root = nbtReader.ReadCompound(tagInfo); return(DeserializeTag(root, m_type)); }
public void ReadTagInfo_ArgumentOutOfRangeException() { // Arrange byte[] data = new byte[] { 0xFF, 0x00, 0x0D }; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); NbtTagType expectedTagType = (NbtTagType)0x04; int expectedNameLength = 0x0D; // Act NbtTagInfo tagInfo = reader.ReadTagInfo(); }
public void ReadTagInfo_EndTag() { // Arrange byte[] data = new byte[] { 0x00}; MemoryStream stream = new MemoryStream(data); NbtReader reader = new NbtReader(stream); NbtTagType expectedTagType = NbtTagType.End; int expectedNameLength = 0x00; // Act NbtTagInfo tagInfo = reader.ReadTagInfo(); // Assert Assert.AreEqual(expectedTagType, tagInfo.Type); Assert.AreEqual(expectedNameLength, tagInfo.NameLength); }