public void Run( MainForm form ) { using( WebClient client = new GZipWebClient() ) { WebRequest.DefaultWebProxy = null; int i = 0; DownloadData( classicJarUri, client, "classic.jar", form, ref i ); DownloadData( modernJarUri, client, "1.6.2.jar", form, ref i ); DownloadData( terrainPatchUri, client, "terrain-patch.png", form, ref i ); } reader = new ZipReader(); reader.ShouldProcessZipEntry = ShouldProcessZipEntry_Classic; reader.ProcessZipEntry = ProcessZipEntry_Classic; using( FileStream srcClassic = File.OpenRead( "classic.jar" ), srcModern = File.OpenRead( "1.6.2.jar" ), dst = new FileStream( "default.zip", FileMode.Create, FileAccess.Write ) ) { writer = new ZipWriter( dst ); reader.Extract( srcClassic ); // Grab animations and snow animBitmap = new Bitmap( 1024, 64, PixelFormat.Format32bppArgb ); reader.ShouldProcessZipEntry = ShouldProcessZipEntry_Modern; reader.ProcessZipEntry = ProcessZipEntry_Modern; reader.Extract( srcModern ); writer.WriteNewImage( animBitmap, "animations.png" ); writer.WriteNewString( animationsTxt, "animations.txt" ); animBitmap.Dispose(); writer.WriteCentralDirectoryRecords(); } if( !File.Exists( "terrain-patched.png" ) ) File.Move( "terrain-patch.png", "terrain-patched.png" ); }
public void Run() { reader = new ZipReader(); reader.ShouldProcessZipEntry = ShouldProcessZipEntry_Classic; reader.ProcessZipEntry = ProcessZipEntry_Classic; string texDir = Path.Combine( Program.AppDirectory, "texpacks" ); string path = Path.Combine( texDir, "default.zip" ); using( Stream srcClassic = new MemoryStream( jarClassic ), srcModern = new MemoryStream( jar162 ), dst = new FileStream( path, FileMode.Create, FileAccess.Write ) ) { writer = new ZipWriter( dst ); reader.Extract( srcClassic ); // Grab animations and snow animBitmap = new Bitmap( 1024, 64, PixelFormat.Format32bppArgb ); reader.ShouldProcessZipEntry = ShouldProcessZipEntry_Modern; reader.ProcessZipEntry = ProcessZipEntry_Modern; reader.Extract( srcModern ); writer.WriteNewImage( animBitmap, "animations.png" ); writer.WriteNewString( animationsTxt, "animations.txt" ); using( Bitmap guiBitmap = new Bitmap( new MemoryStream( pngGuiPatch ) ) ) { writer.WriteNewImage( guiBitmap, "gui.png" ); } animBitmap.Dispose(); writer.WriteCentralDirectoryRecords(); } }