mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-01 02:02:28 +00:00
Added #1414 Cancelling in-progress exportation
Fixed FLA export printing xxx string on exporting character with id 320
This commit is contained in:
@@ -41,6 +41,10 @@ public class BinaryDataExporter {
|
||||
|
||||
public List<File> exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, BinaryDataExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -77,6 +81,10 @@ public class BinaryDataExporter {
|
||||
|
||||
ret.add(file);
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("binarydata", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ public class FontExporter {
|
||||
|
||||
public List<File> exportFonts(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, final FontExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -98,6 +102,10 @@ public class FontExporter {
|
||||
|
||||
ret.add(file);
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("font", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
@@ -169,6 +169,10 @@ public class FrameExporter {
|
||||
|
||||
public List<File> exportFrames(AbortRetryIgnoreHandler handler, String outdir, final SWF swf, int containerId, List<Integer> frames, final FrameExportSettings settings, final EventListener evl) throws IOException, InterruptedException {
|
||||
final List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (swf.getTags().isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -230,6 +234,10 @@ public class FrameExporter {
|
||||
}
|
||||
ret.add(f);
|
||||
}, handler).run();
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (evl != null) {
|
||||
Tag parentTag = tim.getParentTag();
|
||||
@@ -398,6 +406,9 @@ public class FrameExporter {
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return false;
|
||||
}
|
||||
return fframes.size() > pos;
|
||||
}
|
||||
|
||||
@@ -407,7 +418,7 @@ public class FrameExporter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage next() {
|
||||
public BufferedImage next() {
|
||||
if (!hasNext()) {
|
||||
return null;
|
||||
}
|
||||
@@ -421,7 +432,9 @@ public class FrameExporter {
|
||||
|
||||
int fframe = fframes.get(pos++);
|
||||
BufferedImage result = SWF.frameToImageGet(tim, fframe, 0, null, 0, tim.displayRect, new Matrix(), null, fusesTransparency ? null : fbackgroundColor, settings.zoom).getBufferedImage();
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return null;
|
||||
}
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("frame", pos, fframes.size(), tagName);
|
||||
}
|
||||
@@ -443,7 +456,10 @@ public class FrameExporter {
|
||||
final int fi = i;
|
||||
new RetryTask(() -> {
|
||||
File f = new File(foutdir + File.separator + (fframes.get(fi) + 1) + ".bmp");
|
||||
BMPFile.saveBitmap(frameImages.next(), f);
|
||||
BufferedImage img = frameImages.next();
|
||||
if (img != null) {
|
||||
BMPFile.saveBitmap(img, f);
|
||||
}
|
||||
ret.add(f);
|
||||
}, handler).run();
|
||||
}
|
||||
@@ -453,8 +469,11 @@ public class FrameExporter {
|
||||
final int fi = i;
|
||||
new RetryTask(() -> {
|
||||
File file = new File(foutdir + File.separator + (fframes.get(fi) + 1) + ".png");
|
||||
ImageHelper.write(frameImages.next(), ImageFormat.PNG, file);
|
||||
ret.add(file);
|
||||
BufferedImage img = frameImages.next();
|
||||
if (img != null) {
|
||||
ImageHelper.write(img, ImageFormat.PNG, file);
|
||||
ret.add(file);
|
||||
}
|
||||
}, handler).run();
|
||||
}
|
||||
|
||||
@@ -537,11 +556,10 @@ public class FrameExporter {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
g.dispose();
|
||||
/*if (frameImages.hasNext()) {
|
||||
img = frameImages.next();
|
||||
} else {
|
||||
break;
|
||||
}*/
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
@@ -626,7 +644,11 @@ public class FrameExporter {
|
||||
try {
|
||||
out.write(0, img0, 1);
|
||||
while (images.hasNext()) {
|
||||
out.write(0, images.next(), 1);
|
||||
BufferedImage img = images.next();
|
||||
if (img == null) {
|
||||
break;
|
||||
}
|
||||
out.write(0, img, 1);
|
||||
}
|
||||
} finally {
|
||||
out.close();
|
||||
@@ -643,7 +665,11 @@ public class FrameExporter {
|
||||
encoder.start(file.getAbsolutePath());
|
||||
encoder.setDelay((int) (1000.0 / frameRate));
|
||||
while (images.hasNext()) {
|
||||
encoder.addFrame(images.next());
|
||||
BufferedImage img = images.next();
|
||||
if (img == null) {
|
||||
break;
|
||||
}
|
||||
encoder.addFrame(img);
|
||||
}
|
||||
|
||||
encoder.finish();
|
||||
@@ -660,7 +686,11 @@ public class FrameExporter {
|
||||
writer.writeToSequence(img0);
|
||||
|
||||
while (images.hasNext()) {
|
||||
writer.writeToSequence(images.next());
|
||||
BufferedImage img = images.next();
|
||||
if (img == null) {
|
||||
break;
|
||||
}
|
||||
writer.writeToSequence(img);
|
||||
}
|
||||
|
||||
writer.close();
|
||||
@@ -682,6 +712,10 @@ public class FrameExporter {
|
||||
int maxDepth = timeline.getMaxDepth();
|
||||
Stack<Integer> clipDepths = new Stack<>();
|
||||
for (int frame : frames) {
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
result.append("\t\tcase ").append(frame).append(":\r\n");
|
||||
Frame frameObj = timeline.getFrame(frame);
|
||||
for (int i = 1; i <= maxDepth + 1; i++) {
|
||||
|
||||
@@ -45,6 +45,10 @@ public class ImageExporter {
|
||||
|
||||
public List<File> exportImages(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, ImageExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -103,6 +107,10 @@ public class ImageExporter {
|
||||
}, handler).run();
|
||||
ret.add(file);
|
||||
}
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("image", currentIndex, count, t.getName());
|
||||
|
||||
@@ -57,6 +57,10 @@ public class MorphShapeExporter {
|
||||
//TODO: implement morphshape export. How to handle 65536 frames?
|
||||
public List<File> exportMorphShapes(AbortRetryIgnoreHandler handler, final String outdir, ReadOnlyTagList tags, final MorphShapeExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -132,6 +136,9 @@ public class MorphShapeExporter {
|
||||
}, handler).run();
|
||||
ret.add(file);
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("morphshape", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ public class MovieExporter {
|
||||
|
||||
public List<File> exportMovies(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, final MovieExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -85,6 +88,9 @@ public class MovieExporter {
|
||||
}
|
||||
}, handler).run();
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("movie", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ public class ShapeExporter {
|
||||
|
||||
public List<File> exportShapes(AbortRetryIgnoreHandler handler, final String outdir, final SWF swf, ReadOnlyTagList tags, final ShapeExportSettings settings, EventListener evl, double unzoom) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -159,6 +163,9 @@ public class ShapeExporter {
|
||||
}, handler).run();
|
||||
ret.add(file);
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("shape", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ public class SoundExporter {
|
||||
|
||||
public List<File> exportSounds(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, final SoundExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -107,6 +111,10 @@ public class SoundExporter {
|
||||
|
||||
ret.add(file);
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("sound", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ public class SymbolClassExporter {
|
||||
|
||||
public List<File> exportNames(AbortRetryIgnoreHandler handler, final String outdir, ReadOnlyTagList tags, SymbolClassExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof ExportAssetsTag || t instanceof SymbolClassTag) {
|
||||
@@ -74,6 +78,9 @@ public class SymbolClassExporter {
|
||||
writer.append(sct.tags.get(i) + ";" + sct.names.get(i) + Helper.newLine);
|
||||
}
|
||||
}
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, handler).run();
|
||||
|
||||
@@ -51,6 +51,10 @@ public class TextExporter {
|
||||
|
||||
public List<File> exportTexts(AbortRetryIgnoreHandler handler, String outdir, ReadOnlyTagList tags, final TextExportSettings settings, EventListener evl) throws IOException, InterruptedException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
@@ -125,6 +129,9 @@ public class TextExporter {
|
||||
fos.write(Utf8Helper.getBytes(Helper.newLine + Configuration.textExportSingleFileSeparator.get() + Helper.newLine));
|
||||
}, handler).run();
|
||||
}
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret.add(file);
|
||||
@@ -151,6 +158,9 @@ public class TextExporter {
|
||||
}, handler).run();
|
||||
ret.add(file);
|
||||
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("text", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user