Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<byte[]> CompressMap()
- {
- byte[] rawinput = new byte[DimX * DimY * DimZ];
- for (int x = 0; x < DimX; x++)
- for (int y = 0; y < DimY; y++)
- for (int z = 0; z < DimZ; z++)
- rawinput[DimX * DimY * DimZ] = map[x, y, z];
- MemoryStream output = new MemoryStream();
- MemoryStream input = new MemoryStream(rawinput);
- using (GZipStream compress = new GZipStream(output, CompressionMode.Compress))
- {
- byte[] buff = new byte[DimX * DimY * DimZ];
- int bytes;
- while ((bytes = input.Read(buff, 0, buff.Length)) != 0)
- {
- compress.Write(buff, 0, bytes);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement