From c4befddd5fc7c87bbac4ab53d5c0aad18259a19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 21 Dec 2022 17:06:46 +0100 Subject: [PATCH] Fixed #1908 Slow commandline opening SWF --- CHANGELOG.md | 2 ++ .../flash/console/CommandLineArgumentParser.java | 2 +- .../flash/console/StdInAwareFileInputStream.java | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9867046..769a8fbbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file. - Image flickering - Show Hex dump for AS1/2 script tags - Speaker image when sound selected not in the center +- [#1908] Slow commandline opening SWF ### Changed - Warning before switching deobfuscation is now optional @@ -2771,6 +2772,7 @@ All notable changes to this project will be documented in this file. [#1460]: https://www.free-decompiler.com/flash/issues/1460 [#1904]: https://www.free-decompiler.com/flash/issues/1904 [#595]: https://www.free-decompiler.com/flash/issues/595 +[#1908]: https://www.free-decompiler.com/flash/issues/1908 [#1898]: https://www.free-decompiler.com/flash/issues/1898 [#1511]: https://www.free-decompiler.com/flash/issues/1511 [#1765]: https://www.free-decompiler.com/flash/issues/1765 diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index d642048ee..f85c32bbf 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -2267,7 +2267,7 @@ public class CommandLineArgumentParser { OpenableSourceInfo sourceInfo = new OpenableSourceInfo(null, inFile.getAbsolutePath(), inFile.getName()); SWF swf; try { - swf = new SWF(new StdInAwareFileInputStream(inFile), sourceInfo.getFile(), sourceInfo.getFileTitle(), Configuration.parallelSpeedUp.get(), charset); + swf = new SWF(new BufferedInputStream(new StdInAwareFileInputStream(inFile)), sourceInfo.getFile(), sourceInfo.getFileTitle(),null, Configuration.parallelSpeedUp.get(), false, true, charset); } catch (FileNotFoundException | SwfOpenException ex) { // FileNotFoundException when anti virus software blocks to open the file logger.log(Level.SEVERE, "Failed to open swf: " + inFile.getName(), ex); diff --git a/src/com/jpexs/decompiler/flash/console/StdInAwareFileInputStream.java b/src/com/jpexs/decompiler/flash/console/StdInAwareFileInputStream.java index bffd0cef0..5a6c8649a 100644 --- a/src/com/jpexs/decompiler/flash/console/StdInAwareFileInputStream.java +++ b/src/com/jpexs/decompiler/flash/console/StdInAwareFileInputStream.java @@ -69,5 +69,15 @@ public class StdInAwareFileInputStream extends InputStream implements AutoClosea @Override public void close() throws IOException { is.close(); - } + } + + @Override + public int read(byte[] b) throws IOException { + return is.read(b); + } + + @Override + public int read(byte[] b, int off, int len) throws IOException { + return is.read(b, off, len); + } }