flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [2/2] git commit: [flex-falcon] [refs/heads/develop] - add ability to uncompress a SWF so LZMA compressed SWFs can be dumped with the old Flex SDK SWFDump which I am more used to reading
Date Thu, 23 Jun 2016 23:38:11 GMT
add ability to uncompress a SWF so LZMA compressed SWFs can be dumped with the old Flex SDK
SWFDump which I am more used to reading


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f36ceb25
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f36ceb25
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f36ceb25

Branch: refs/heads/develop
Commit: f36ceb25fafcf183e0d3ffc1a9a0df8b6beb1505
Parents: 3fd7d0e
Author: Alex Harui <aharui@apache.org>
Authored: Wed Jun 22 08:48:20 2016 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Jun 23 14:23:59 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/flex/swf/io/SWFDump.java    | 36 +++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f36ceb25/compiler/src/main/java/org/apache/flex/swf/io/SWFDump.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/swf/io/SWFDump.java b/compiler/src/main/java/org/apache/flex/swf/io/SWFDump.java
index 2f500ae..6d6c22b 100644
--- a/compiler/src/main/java/org/apache/flex/swf/io/SWFDump.java
+++ b/compiler/src/main/java/org/apache/flex/swf/io/SWFDump.java
@@ -2333,6 +2333,7 @@ public final class SWFDump
     static boolean defuncOption = true;
     static boolean saveOption = false;
     static boolean tabbedGlyphsOption = true;
+    static boolean uncompressOption = false;
 
     /**
      * SWFDump will dump a SWF file as XML.
@@ -2371,6 +2372,12 @@ public final class SWFDump
                 saveOption = true;
                 outfile = args[index++];
             }
+            else if (args[index].equals("-uncompress"))
+            {
+                ++index;
+                uncompressOption = true;
+                outfile = args[index++];
+            }
             else if (args[index].equals("-decompile"))
             {
                 decompileOption = true;
@@ -2512,8 +2519,35 @@ public final class SWFDump
                         in.close();
                     }
                 }
+                if (uncompressOption)
+                {
+                    final SWFReader swfReader = new SWFReader();
+                    final String path = url.getPath();
+                    try
+                    {
+                        SWF swf = (SWF)swfReader.readFrom(
+                                new BufferedInputStream(url.openStream()),
+                                path);
+
+                        ProblemQuery problemQuery = new ProblemQuery();
+                        problemQuery.addAll(swfReader.getProblems());
+                        if (!problemQuery.hasErrors())
+                        {
+                            OutputStream fileOut = new BufferedOutputStream(new FileOutputStream(outfile));
+                            SWFWriter swfWriter = new SWFWriter(swf, Header.Compression.NONE);
+                            swfWriter.writeTo(fileOut);
+                            swfWriter.close();
+                        }
+                    }
+                    finally
+                    {
+                        IOUtils.closeQuietly(swfReader);
+                    }
+
+                }
 
-                dumpSwf(out, url, outfile);
+                if (!uncompressOption)
+                    dumpSwf(out, url, outfile);
 
                 out.flush();
             }


Mime
View raw message