()
| 18 | } |
| 19 | |
| 20 | public void run() |
| 21 | { |
| 22 | FileInputStream in = null; |
| 23 | OutputStream out = null; |
| 24 | try |
| 25 | { |
| 26 | Main.database.save(); |
| 27 | this.progressDialog.updateProgress(15); |
| 28 | |
| 29 | ResourceEntry resourceEntry = new ResourceEntry("module.ifo", Main.databaseFile); |
| 30 | Main.modDatabase.addEntry(resourceEntry); |
| 31 | Main.modDatabase.save(); |
| 32 | this.progressDialog.updateProgress(30); |
| 33 | |
| 34 | ResourceDatabase modDatabase = new ResourceDatabase(Main.modDatabase.getPath()); |
| 35 | modDatabase.load(); |
| 36 | Main.modDatabase = modDatabase; |
| 37 | this.progressDialog.updateProgress(45); |
| 38 | |
| 39 | SaveEntry saveEntry = new SaveEntry(Main.savePrefix + Main.modName); |
| 40 | in = new FileInputStream(Main.modFile); |
| 41 | out = saveEntry.getOutputStream(); |
| 42 | byte[] buffer = new byte[4096]; |
| 43 | int count; |
| 44 | while ((count = in.read(buffer)) > 0) { |
| 45 | out.write(buffer, 0, count); |
| 46 | } |
| 47 | in.close(); |
| 48 | in = null; |
| 49 | out.close(); |
| 50 | out = null; |
| 51 | Main.saveDatabase.addEntry(saveEntry); |
| 52 | this.progressDialog.updateProgress(60); |
| 53 | |
| 54 | Main.saveDatabase.save(); |
| 55 | this.progressDialog.updateProgress(80); |
| 56 | |
| 57 | SaveDatabase saveDatabase = new SaveDatabase(Main.saveDatabase.getPath()); |
| 58 | saveDatabase.load(); |
| 59 | Main.saveDatabase = saveDatabase; |
| 60 | this.progressDialog.updateProgress(100); |
| 61 | |
| 62 | this.saveSuccessful = true; |
| 63 | } catch (DBException exc) { |
| 64 | Main.logException("Unable to update save database", exc); |
| 65 | } catch (IOException exc) { |
| 66 | Main.logException("Unable to save file", exc); |
| 67 | } catch (Throwable exc) { |
| 68 | Main.logException("Exception while saving file", exc); |
| 69 | } |
| 70 | |
| 71 | try |
| 72 | { |
| 73 | if (in != null) { |
| 74 | in.close(); |
| 75 | } |
| 76 | if (out != null) { |
| 77 | out.close(); |
nothing calls this directly
no test coverage detected