home *** CD-ROM | disk | FTP | other *** search
- package com.sfs.iavazip;
-
- import com.sfs.awt.treeview.Folder;
- import com.sfs.awt.treeview.Item;
- import com.sfs.debug.Debug;
- import java.awt.Dialog;
- import java.awt.Window;
- import java.io.File;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.util.Enumeration;
- import java.util.Vector;
- import java.util.zip.ZipEntry;
- import java.util.zip.ZipOutputStream;
-
- class processDelete extends processDlg {
- iavaZip mainApp;
- ZipOutputStream tempZip;
- // $FF: renamed from: is java.io.InputStream
- InputStream field_0;
- FileOutputStream fos;
-
- public processDelete(iavaZip var1) {
- super(var1, "Delete entries ...");
- this.mainApp = var1;
- ((Dialog)this).setResizable(true);
- }
-
- public void processCanceled() {
- super.thread.stop();
-
- try {
- if (this.field_0 != null) {
- this.field_0.close();
- }
-
- if (this.fos != null) {
- this.fos.close();
- }
-
- if (this.tempZip != null) {
- this.tempZip.close();
- File var1 = new File("temp.zip");
- var1.delete();
- }
- } catch (IOException var2) {
- }
-
- this.mainApp.setDefaultCursor();
- this.mainApp.showStatus("Delete Files canceled.");
- }
-
- public void run() {
- this.mainApp.showStatus("Deleting files");
- Vector var1 = new Vector();
- ((processDlg)this).showStatus("building copy list ...");
-
- for(int var2 = 1; var2 < this.mainApp.tw.Root.Rows.size(); ++var2) {
- Item var3 = (Item)this.mainApp.tw.Root.Rows.elementAt(var2);
- if (!(var3 instanceof Folder) && !var3.isSelected()) {
- var1.addElement(var3.getContent());
- Debug.Info(((ZipEntry)var3.getContent()).getName());
- }
- }
-
- if (var1.size() > 0) {
- try {
- this.tempZip = new ZipOutputStream(new FileOutputStream("temp.zip"));
- } catch (IOException var28) {
- ((Throwable)var28).printStackTrace(System.out);
- }
-
- super.pb.setMaximum((float)var1.size());
- byte[] var4 = new byte[256];
- ((processDlg)this).showHeading("Copying");
- Enumeration var5 = var1.elements();
-
- try {
- int var6 = 0;
-
- while(var5.hasMoreElements()) {
- ZipEntry var31 = (ZipEntry)var5.nextElement();
- ZipEntry var32 = new ZipEntry(var31.getName());
- var32.setTime(var31.getTime());
- this.tempZip.putNextEntry(var32);
- this.field_0 = this.mainApp.zipFile.getInputStream(var31);
- String var7 = var31.getName();
- int var8;
- if ((var8 = var7.lastIndexOf(var7)) != -1) {
- var7 = var7.substring(var8 + 1);
- }
-
- ((processDlg)this).showStatus("copying " + var7);
-
- int var9;
- while((var9 = this.field_0.read(var4)) != -1) {
- this.tempZip.write(var4, 0, var9);
- }
-
- this.tempZip.closeEntry();
- this.field_0.close();
- super.pb.setProgress((float)(var6++));
-
- try {
- Thread.sleep(20L);
- } catch (InterruptedException var27) {
- }
- }
-
- if (var1.size() > 0) {
- this.tempZip.finish();
- this.tempZip.close();
- this.tempZip = null;
- }
- } catch (IOException var30) {
- ((Throwable)var30).printStackTrace(System.out);
- }
-
- synchronized(this){}
-
- try {
- this.mainApp.cleanup();
- File var33 = new File("temp.zip");
- File var34 = new File(this.mainApp.zipFileName);
- if (!var34.delete()) {
- Debug.Info("delete failed.");
- }
-
- if (!var33.renameTo(var34)) {
- Debug.Info("rename failed.");
- } else {
- Debug.Info("rename succeeded.");
- }
- } catch (Throwable var29) {
- throw var29;
- }
- } else {
- try {
- synchronized(this){}
-
- try {
- this.mainApp.cleanup();
- this.fos = new FileOutputStream(this.mainApp.zipFileName);
- this.fos.close();
- } catch (Throwable var25) {
- throw var25;
- }
- } catch (IOException var26) {
- this.mainApp.showStatus("Error: " + ((Throwable)var26).getMessage());
- ((Throwable)var26).printStackTrace(System.out);
- }
- }
-
- ((Window)this).dispose();
- this.mainApp.Open(this.mainApp.zipFileName);
- this.mainApp.showStatus("Delete " + Integer.toString(var1.size()) + " entries completed.");
- }
- }
-