MCPcopy Create free account
hub / github.com/boazy/TWEditorEnhanced / unpackSave

Method unpackSave

src/main/java/MainWindow.java:338–370  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

336 }
337
338 private void unpackSave()
339 {
340 String extractDirectory = Main.properties.getProperty("extract.directory");
341 JFileChooser chooser;
342 if (extractDirectory != null) {
343 File dirFile = new File(extractDirectory);
344 if ((dirFile.exists()) && (dirFile.isDirectory()))
345 chooser = new JFileChooser(dirFile);
346 else
347 chooser = new JFileChooser();
348 } else {
349 chooser = new JFileChooser();
350 }
351
352 chooser.putClientProperty("FileChooser.useShellFolder", Boolean.valueOf(Main.useShellFolder));
353 chooser.setDialogTitle("Select Destination Directory");
354 chooser.setApproveButtonText("Select");
355 chooser.setFileSelectionMode(1);
356 if (chooser.showOpenDialog(this) != 0) {
357 return;
358 }
359 File dirFile = chooser.getSelectedFile();
360 Main.properties.setProperty("extract.directory", dirFile.getPath());
361 if (!dirFile.exists()) {
362 dirFile.mkdirs();
363 }
364
365 ProgressDialog dialog = new ProgressDialog(this, "Unpacking " + Main.saveDatabase.getName());
366 UnpackSave task = new UnpackSave(dialog, dirFile);
367 task.start();
368 if (dialog.showDialog())
369 JOptionPane.showMessageDialog(this, "Save game unpacked to " + dirFile.getPath(), "Save Unpacked", 1);
370 }
371
372 private void packSave()
373 {

Callers 1

actionPerformedMethod · 0.95

Calls 3

showDialogMethod · 0.95
getPathMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected