public void Run() { reader = new ZipReader(); reader.SelectZipEntry = SelectZipEntry_Classic; reader.ProcessZipEntry = ProcessZipEntry_Classic; string defPath = Path.Combine("texpacks", "default.zip"); if (Platform.FileExists(defPath)) { using (Stream src = Platform.FileOpen(defPath)) { reader.ProcessZipEntry = ExtractExisting; reader.Extract(src); } } using (Stream dst = Platform.FileCreate(defPath)) { writer = new ZipWriter(dst); writer.entries = new ZipEntry[100]; for (int i = 0; i < entries.Count; i++) { writer.WriteZipEntry(entries[i], datas[i]); } ExtractClassic(); ExtractModern(); if (pngGuiPatch != null) { using (Bitmap gui = Platform.ReadBmp(drawer, pngGuiPatch)) writer.WriteNewImage(gui, "gui.png"); } if (patchedTerrain) { writer.WriteNewImage(terrainBmp, "terrain.png"); } writer.WriteCentralDirectoryRecords(); } }
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" ); ExtractExisting( path ); using( Stream dst = new FileStream( path, FileMode.Create, FileAccess.Write ) ) { writer = new ZipWriter( dst ); writer.entries = new ZipEntry[100]; for( int i = 0; i < entries.Count; i++ ) writer.WriteZipEntry( entries[i], datas[i] ); ExtractClassic(); ExtractModern(); if( pngGuiPatch != null ) { using( Bitmap guiBitmap = new Bitmap( new MemoryStream( pngGuiPatch ) ) ) writer.WriteNewImage( guiBitmap, "gui.png" ); } writer.WriteCentralDirectoryRecords(); } }