Пример #1
0
        public void NestedListTest()
        {
            var root = new NbtCompound("root")
            {
                new NbtList("OuterList")
                {
                    new NbtList {
                        new NbtByte()
                    },
                    new NbtList {
                        new NbtShort()
                    },
                    new NbtList {
                        new NbtInt()
                    }
                }
            };

            byte[] testData = new NbtFile(root).SaveToBuffer(NbtCompression.None);
            using (var ms = new MemoryStream(testData)) {
                var reader = new NbtReader(ms);
                while (reader.ReadToFollowing())
                {
                    Console.WriteLine(reader.ToString(true));
                }
            }
        }
Пример #2
0
 public void PrintBigFileUncompressed()
 {
     using( FileStream fs = File.OpenRead( "TestFiles/bigtest.nbt" ) ) {
         NbtReader reader = new NbtReader( fs );
         while( reader.ReadToFollowing() ) {
             Console.Write( "@" + reader.TagStartOffset + " " );
             Console.WriteLine( reader.ToString( true ) );
         }
         Assert.AreEqual( reader.RootName, "Level" );
     }
 }
Пример #3
0
 public void PrintBigFileUncompressed()
 {
     using (FileStream fs = File.OpenRead("TestFiles/bigtest.nbt")) {
         NbtReader reader = new NbtReader(fs);
         while (reader.ReadToFollowing())
         {
             Console.Write("@" + reader.TagStartOffset + " ");
             Console.WriteLine(reader.ToString(true));
         }
         Assert.AreEqual(reader.RootName, "Level");
     }
 }
Пример #4
0
 public void PrintBigFileUncompressed()
 {
     using (FileStream fs = File.OpenRead(TestFiles.Big)) {
         var reader = new NbtReader(fs);
         Assert.AreEqual(fs, reader.BaseStream);
         while (reader.ReadToFollowing())
         {
             Console.Write("@" + reader.TagStartOffset + " ");
             Console.WriteLine(reader.ToString());
         }
         Assert.AreEqual("Level", reader.RootName);
     }
 }
Пример #5
0
 public void PrintBigFileUncompressedNoSkip()
 {
     using (FileStream fs = File.OpenRead("TestFiles/bigtest.nbt")) {
         var reader = new NbtReader(fs)
         {
             SkipEndTags = false
         };
         Assert.AreEqual(fs, reader.BaseStream);
         while (reader.ReadToFollowing())
         {
             Console.Write("@" + reader.TagStartOffset + " ");
             Console.WriteLine(reader.ToString());
         }
         Assert.AreEqual("Level", reader.RootName);
     }
 }
 public void PrintBigFileUncompressedNoSkip()
 {
     using (FileStream fs = File.OpenRead("TestFiles/bigtest.nbt"))
     {
         var reader = new NbtReader(fs)
         {
             SkipEndTags = false
         };
         Assert.Equal(fs, reader.BaseStream);
         while (reader.ReadToFollowing())
         {
             Console.Write("@" + reader.TagStartOffset + " ");
             Console.WriteLine(reader.ToString());
         }
         Assert.Equal("Level", reader.RootName);
     }
 }
Пример #7
0
 public void NestedListTest()
 {
     NbtCompound root = new NbtCompound( "root" ) {
         new NbtList( "OuterList" ) {
             new NbtList {
                 new NbtByte()
             },
             new NbtList {
                 new NbtShort()
             },
             new NbtList {
                 new NbtInt()
             }
         }
     };
     byte[] testData = new NbtFile( root ).SaveToBuffer( NbtCompression.None );
     using( MemoryStream ms = new MemoryStream( testData ) ) {
         NbtReader reader = new NbtReader( ms );
         while( reader.ReadToFollowing() ) {
             Console.WriteLine( reader.ToString( true ) );
         }
     }
 }