()
| 370 | } |
| 371 | |
| 372 | private void packSave() |
| 373 | { |
| 374 | if (Main.dataModified) { |
| 375 | int option = JOptionPane.showConfirmDialog(this, "The current save has been modified and these changes will be lost. Do you want to continue?", "Save Modified", 0); |
| 376 | |
| 377 | if (option != 0) { |
| 378 | return; |
| 379 | } |
| 380 | |
| 381 | } |
| 382 | |
| 383 | String extractDirectory = Main.properties.getProperty("extract.directory"); |
| 384 | JFileChooser chooser; |
| 385 | if (extractDirectory != null) { |
| 386 | File dirFile = new File(extractDirectory); |
| 387 | if ((dirFile.exists()) && (dirFile.isDirectory())) |
| 388 | chooser = new JFileChooser(dirFile); |
| 389 | else |
| 390 | chooser = new JFileChooser(); |
| 391 | } else { |
| 392 | chooser = new JFileChooser(); |
| 393 | } |
| 394 | |
| 395 | chooser.putClientProperty("FileChooser.useShellFolder", Boolean.valueOf(Main.useShellFolder)); |
| 396 | chooser.setDialogTitle("Select Source Directory"); |
| 397 | chooser.setApproveButtonText("Select"); |
| 398 | chooser.setFileSelectionMode(1); |
| 399 | if (chooser.showOpenDialog(this) != 0) { |
| 400 | return; |
| 401 | } |
| 402 | File dirFile = chooser.getSelectedFile(); |
| 403 | Main.properties.setProperty("extract.directory", dirFile.getPath()); |
| 404 | if (!dirFile.exists()) { |
| 405 | JOptionPane.showMessageDialog(this, "Source directory does not exist", "Directory not found", 0); |
| 406 | |
| 407 | return; |
| 408 | } |
| 409 | |
| 410 | Main.dataModified = false; |
| 411 | ProgressDialog dialog = new ProgressDialog(this, "Packing " + Main.saveDatabase.getName()); |
| 412 | PackFile task = new PackFile(dialog, dirFile); |
| 413 | task.start(); |
| 414 | boolean saved = dialog.showDialog(); |
| 415 | |
| 416 | File file = Main.saveDatabase.getFile(); |
| 417 | closeFile(); |
| 418 | if (saved) |
| 419 | loadSave(file); |
| 420 | } |
| 421 | |
| 422 | private void exitProgram() |
| 423 | { |
no test coverage detected