private static void testCompression() { MyMaze3dGenerator smg = new MyMaze3dGenerator(); Maze maze = smg.generate(9, 6, 5); byte[] byets = ((Maze3d)maze).toByteArray(); using (FileStream fileOutStream = new FileStream("1.maze", FileMode.Create)) { using (MyCompressorStream outStream = new MyCompressorStream(fileOutStream, MyCompressorStream.Compress)) { outStream.Write(byets, 0, byets.Length); outStream.Flush(); } } byte[] mazeBytes; using (FileStream fileInStream = new FileStream("1.maze", FileMode.Open)) { using (MyCompressorStream inStream = new MyCompressorStream(fileInStream, MyCompressorStream.Decompress)) { mazeBytes = new byte[byets.Length]; inStream.Read(mazeBytes, 0, mazeBytes.Length); } } Maze3d loadedMaze = new Maze3d(mazeBytes); Console.WriteLine(loadedMaze.equals(maze)); Console.WriteLine("*******************************"); Console.WriteLine("Press any key to continue"); Console.WriteLine(); Console.ReadKey(); }