mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 08:42:11 +00:00
Added Bulk import sounds and sound streams
This commit is contained in:
@@ -3129,6 +3129,66 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}.execute();
|
||||
}
|
||||
}
|
||||
|
||||
public void importSound(final SWF swf) {
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importSounds2"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportSoundInfo);
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setCurrentDirectory(new File(Configuration.lastExportDir.get()));
|
||||
chooser.setDialogTitle(translate("import.select.directory"));
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
|
||||
previewPanel.clear();
|
||||
|
||||
String selFile = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
File soundsDir = new File(Path.combine(selFile, SoundExportSettings.EXPORT_FOLDER_NAME));
|
||||
if (!soundsDir.exists()) {
|
||||
soundsDir = new File(selFile);
|
||||
}
|
||||
final File fSoundsDir = soundsDir;
|
||||
SoundImporter soundImporter = new SoundImporter();
|
||||
|
||||
final long timeBefore = System.currentTimeMillis();
|
||||
new CancellableWorker<Void>() {
|
||||
|
||||
private int count = 0;
|
||||
|
||||
@Override
|
||||
public Void doInBackground() throws Exception {
|
||||
try {
|
||||
count = soundImporter.bulkImport(fSoundsDir, swf, false);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, "Error during import", ex);
|
||||
ViewMessages.showMessageDialog(null, translate("error.import") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
Main.startWork(translate("work.importing") + "...", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
Main.stopWork();
|
||||
long timeAfter = System.currentTimeMillis();
|
||||
final long timeMs = timeAfter - timeBefore;
|
||||
|
||||
View.execInEventDispatch(() -> {
|
||||
refreshTree(swf);
|
||||
setStatus(translate("import.finishedin").replace("%time%", Helper.formatTimeSec(timeMs)));
|
||||
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("import.sound.result").replace("%count%", Integer.toString(count)));
|
||||
if (count != 0) {
|
||||
reload(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
}
|
||||
public void importShape(final SWF swf, boolean noFill) {
|
||||
ViewMessages.showMessageDialog(MainPanel.this, translate("message.info.importShapes2"), translate("message.info"), JOptionPane.INFORMATION_MESSAGE, Configuration.showImportShapeInfo);
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
|
||||
Reference in New Issue
Block a user