public static void ReadRealFile() { const string LEVEL_DAT_PATH = @"D:\Minecraft\saves\ยง9Creative Test\playerdata\b9d55d02-b553-4d8d-ac4e-4cc1b151ade9.dat"; using (GZipStream stream = new GZipStream(new FileStream(LEVEL_DAT_PATH, FileMode.Open), CompressionMode.Decompress)) { TagCompound parsed = NbtIO.Parse(stream); Console.WriteLine("NBT Data from '{0}':", LEVEL_DAT_PATH.ToUpper()); Console.WriteLine(); Console.WriteLine(parsed.ToTreeString()); } }
public static void TestFileStream() { using (FileStream stream = new FileStream("D:\\Test\\level.dat", FileMode.Create)) { TagCompound root = MakeRootTag(); NbtIO.WriteToStream(stream, root); Console.WriteLine("Input NBT:"); Console.WriteLine(root.ToTreeString()); Console.WriteLine("\nSaved {0} bytes.", stream.Length); Console.WriteLine(); } using (FileStream stream = new FileStream("D:\\Test\\level.dat", FileMode.Open)) { TagCompound parsed = NbtIO.Parse(stream); Console.WriteLine("Read NBT:"); Console.WriteLine(parsed.ToTreeString()); } }