void ReadLevel( FileStream fs ) {
blocks = new byte[widthX][][];
GZipStream zip = new GZipStream( fs, CompressionMode.Decompress );
for( int x = 0; x < widthX; x++ ) {
blocks[x] = new byte[widthY][];
for( int y = 0; y < widthY; y++ ) {
blocks[x][y] = new byte[height];
zip.Read( blocks[x][y], 0, (int)height );
}
}
}
public static Level Load(string fileName) { FileStream fs = null; Level level = null; if (!File.Exists(fileName)) { Logger.LogError("Level.Load: Specified file does not exist: " + fileName); return(null); } try { fs = File.OpenRead(fileName); if (level.ReadHeader(fs)) { level.ReadLevel(fs); return(level); } else { return(null); } } catch (Exception) { Logger.LogError("Level.Load: Error trying to read from file: " + fileName); return(null); } finally { if (fs != null) { fs.Close(); } } }