diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 844d1ddb1..c1e240dbd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2421,7 +2421,11 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { if (importedSwfs.containsKey(url)) { iSwf = importedSwfs.get(url); } else { - iSwf = resolver.resolveUrl(this.file, url); + if (resolver.doIgnoreUrl(this.file, url)) { + iSwf = null; + } else { + iSwf = resolver.resolveUrl(this.file, url); + } importedSwfs.put(url, iSwf); } if (iSwf != null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/UrlResolver.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/UrlResolver.java index 1b87538f0..b7d836297 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/UrlResolver.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/UrlResolver.java @@ -16,6 +16,8 @@ */ package com.jpexs.decompiler.flash; +import java.util.Stack; + /** * URL resolver interface. * @@ -31,4 +33,12 @@ public interface UrlResolver { * @return SWF object or null if not valid */ public SWF resolveUrl(String basePath, String url); + + /** + * Check whether to ignore this url + * @param basePath Base SWF path + * @param url URL + * @return True on ignore + */ + public boolean doIgnoreUrl(String basePath, String url); } diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 20b07135e..93f6ad740 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFCompression; import com.jpexs.decompiler.flash.SearchMode; import com.jpexs.decompiler.flash.SwfOpenException; -import com.jpexs.decompiler.flash.UrlResolver; import com.jpexs.decompiler.flash.ValueTooLargeException; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABCInputStream; @@ -504,7 +503,7 @@ public class CommandLineArgumentParser { } AbortRetryIgnoreHandler handler = null; - UrlResolver urlResolver = new ConsoleUrlResolver(false, false, false, new HashMap<>()); + ConsoleUrlResolver urlResolver = new ConsoleUrlResolver(false, false, false, new HashMap<>()); Map format = new HashMap<>(); Map changedImports = new LinkedHashMap<>(); double zoom = 1; @@ -1925,7 +1924,7 @@ public class CommandLineArgumentParser { changedImports.put(args.pop(), args.pop()); } - private static UrlResolver parseImportAssets(Stack args, Map changedImports) { + private static ConsoleUrlResolver parseImportAssets(Stack args, Map changedImports) { if (args.isEmpty()) { System.err.println("importassets options expected"); badArguments("importassets"); @@ -2164,7 +2163,7 @@ public class CommandLineArgumentParser { String charset, boolean exportEmbed, boolean transparentBackground, - UrlResolver urlResolver, + ConsoleUrlResolver urlResolver, int subFrameLength, double morphDuration, int morphNumFrames @@ -2240,6 +2239,9 @@ public class CommandLineArgumentParser { } for (File inFile : inFiles) { + + urlResolver.clearIgnored(); + String inFileName = Path.getFileNameWithoutExtension(inFile); if (stdOut != null) { String outFilePath = stdOut.replace("{swfFile}", inFileName); diff --git a/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java b/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java index d777a161f..38bf87978 100644 --- a/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java +++ b/src/com/jpexs/decompiler/flash/console/ConsoleUrlResolver.java @@ -26,7 +26,9 @@ import java.io.FileInputStream; import java.io.InputStream; import java.net.URI; import java.net.URL; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Scanner; @@ -46,6 +48,8 @@ public class ConsoleUrlResolver implements UrlResolver { private Character toAll = null; private Map importSources = new HashMap<>(); + + private final List ignoredUrls = new ArrayList<>(); /** * @@ -61,9 +65,18 @@ public class ConsoleUrlResolver implements UrlResolver { this.importSources = importSources; } + public void clearIgnored() { + ignoredUrls.clear(); + } + + @Override + public boolean doIgnoreUrl(String basePath, String url) { + return ignoredUrls.contains(basePath + "|" + url); + } + @Override public SWF resolveUrl(String basePath, String url) { - + ignoredUrls.add(url); Character choice = toAll; String currentUrl = url; diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 249c9082b..998222217 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1474,6 +1474,8 @@ public class Main { private boolean yestoall = false; private boolean notoall = false; + + private List processedUrls = new ArrayList<>(); private SWF open(InputStream is, String file, String fileTitle) throws IOException, InterruptedException { final CancellableWorker worker = this; @@ -1513,8 +1515,14 @@ public class Main { } } }, Configuration.parallelSpeedUp.get(), false, true, new UrlResolver() { + @Override + public boolean doIgnoreUrl(String basePath, String url) { + return processedUrls.contains(basePath + "|" + url); + } + @Override public SWF resolveUrl(String file, final String url) { + processedUrls.add(file + "|" + url); loadedUrls.add(url); File selFile = null; int opt = -1;