mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-26 06:25:58 +00:00
Merge origin/master
This commit is contained in:
@@ -49,7 +49,7 @@ public class IdentifiersDeobfuscation {
|
||||
public static final String VALID_NEXT_CHARACTERS = VALID_FIRST_CHARACTERS + "\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}";
|
||||
|
||||
private static final Pattern VALID_NAME_PATTERN = Pattern.compile("^[a-zA-Z_\\$][a-zA-Z0-9_\\$]*$");
|
||||
|
||||
|
||||
private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("^[" + VALID_FIRST_CHARACTERS + "][" + VALID_NEXT_CHARACTERS + "]*$");
|
||||
|
||||
public static final String FOO_CHARACTERS = "bcdfghjklmnpqrstvwz";
|
||||
|
||||
@@ -65,6 +65,7 @@ import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.script.AS2ScriptExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
@@ -1131,7 +1132,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean exportAS3Class(String className, String outdir, ScriptExportMode exportMode, boolean parallel, EventListener evl) throws Exception {
|
||||
public boolean exportAS3Class(String className, String outdir, ScriptExportSettings exportSettings, boolean parallel, EventListener evl) throws Exception {
|
||||
boolean exported = false;
|
||||
|
||||
List<ABCContainerTag> abcList = getAbcList();
|
||||
@@ -1146,7 +1147,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
String eventData = cnt + scr.getPath() + " ...";
|
||||
evl.handleExportingEvent("tag", i + 1, abcList.size(), eventData);
|
||||
scr.export(outdir, exportMode, parallel);
|
||||
scr.export(outdir, exportSettings, parallel);
|
||||
evl.handleExportedEvent("tag", i + 1, abcList.size(), eventData);
|
||||
exported = true;
|
||||
}
|
||||
@@ -1193,7 +1194,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
String directory;
|
||||
|
||||
ScriptExportMode exportMode;
|
||||
ScriptExportSettings exportSettings;
|
||||
|
||||
ClassPath path;
|
||||
|
||||
@@ -1211,10 +1212,10 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
EventListener eventListener;
|
||||
|
||||
public ExportPackTask(AbortRetryIgnoreHandler handler, AtomicInteger index, int count, ClassPath path, ScriptPack pack, String directory, ScriptExportMode exportMode, boolean parallel, EventListener evl) {
|
||||
public ExportPackTask(AbortRetryIgnoreHandler handler, AtomicInteger index, int count, ClassPath path, ScriptPack pack, String directory, ScriptExportSettings exportSettings, boolean parallel, EventListener evl) {
|
||||
this.pack = pack;
|
||||
this.directory = directory;
|
||||
this.exportMode = exportMode;
|
||||
this.exportSettings = exportSettings;
|
||||
this.path = path;
|
||||
this.index = index;
|
||||
this.count = count;
|
||||
@@ -1229,7 +1230,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
@Override
|
||||
public void run() throws IOException {
|
||||
startTime = System.currentTimeMillis();
|
||||
this.result = pack.export(directory, exportMode, parallel);
|
||||
this.result = pack.export(directory, exportSettings, parallel);
|
||||
stopTime = System.currentTimeMillis();
|
||||
}
|
||||
};
|
||||
@@ -1250,7 +1251,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
private List<File> exportActionScript2(AbortRetryIgnoreHandler handler, String outdir, ScriptExportMode exportMode, boolean parallel, EventListener evl) throws IOException {
|
||||
private List<File> exportActionScript2(AbortRetryIgnoreHandler handler, String outdir, ScriptExportSettings exportSettings, boolean parallel, EventListener evl) throws IOException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
|
||||
if (!outdir.endsWith(File.separator)) {
|
||||
@@ -1258,11 +1259,11 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
outdir += "scripts" + File.separator;
|
||||
|
||||
ret.addAll(new AS2ScriptExporter().exportAS2ScriptsTimeout(handler, outdir, getASMs(true), exportMode, evl));
|
||||
ret.addAll(new AS2ScriptExporter().exportAS2ScriptsTimeout(handler, outdir, getASMs(true), exportSettings, evl));
|
||||
return ret;
|
||||
}
|
||||
|
||||
private List<File> exportActionScript3(final AbortRetryIgnoreHandler handler, final String outdir, final ScriptExportMode exportMode, final boolean parallel, final EventListener evl) {
|
||||
private List<File> exportActionScript3(final AbortRetryIgnoreHandler handler, final String outdir, final ScriptExportSettings exportSettings, final boolean parallel, final EventListener evl) {
|
||||
final AtomicInteger cnt = new AtomicInteger(1);
|
||||
|
||||
final List<File> ret = new ArrayList<>();
|
||||
@@ -1274,7 +1275,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
for (ScriptPack item : packs) {
|
||||
ExportPackTask task = new ExportPackTask(handler, cnt, packs.size(), item.getClassPath(), item, outdir, exportMode, parallel, evl);
|
||||
ExportPackTask task = new ExportPackTask(handler, cnt, packs.size(), item.getClassPath(), item, outdir, exportSettings, parallel, evl);
|
||||
ret.add(task.call());
|
||||
}
|
||||
return null;
|
||||
@@ -1289,7 +1290,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(Configuration.getParallelThreadCount());
|
||||
List<Future<File>> futureResults = new ArrayList<>();
|
||||
for (ScriptPack item : packs) {
|
||||
Future<File> future = executor.submit(new ExportPackTask(handler, cnt, packs.size(), item.getClassPath(), item, outdir, exportMode, parallel, evl));
|
||||
Future<File> future = executor.submit(new ExportPackTask(handler, cnt, packs.size(), item.getClassPath(), item, outdir, exportSettings, parallel, evl));
|
||||
futureResults.add(future);
|
||||
}
|
||||
|
||||
@@ -1343,13 +1344,13 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return evl;
|
||||
}
|
||||
|
||||
public List<File> exportActionScript(AbortRetryIgnoreHandler handler, String outdir, ScriptExportMode exportMode, boolean parallel, EventListener evl) throws IOException {
|
||||
public List<File> exportActionScript(AbortRetryIgnoreHandler handler, String outdir, ScriptExportSettings exportSettings, boolean parallel, EventListener evl) throws IOException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
|
||||
if (isAS3()) {
|
||||
ret.addAll(exportActionScript3(handler, outdir, exportMode, parallel, evl));
|
||||
ret.addAll(exportActionScript3(handler, outdir, exportSettings, parallel, evl));
|
||||
} else {
|
||||
ret.addAll(exportActionScript2(handler, outdir, exportMode, parallel, evl));
|
||||
ret.addAll(exportActionScript2(handler, outdir, exportSettings, parallel, evl));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ABCInputStream implements AutoCloseable {
|
||||
public static final boolean DEBUG_READ = false;
|
||||
|
||||
public DumpInfo dumpInfo;
|
||||
|
||||
|
||||
private byte[] stringDataBuffer = new byte[256];
|
||||
|
||||
public void startBuffer() {
|
||||
@@ -477,17 +477,17 @@ public class ABCInputStream implements AutoCloseable {
|
||||
public String readString(String name) throws IOException {
|
||||
newDumpLevel(name, "String");
|
||||
int length = readU30Internal();
|
||||
|
||||
|
||||
// avoid creating new byte array every time
|
||||
if (stringDataBuffer.length < length) {
|
||||
int newLength = stringDataBuffer.length * 2;
|
||||
while (newLength < length) {
|
||||
newLength *= 2;
|
||||
}
|
||||
|
||||
|
||||
stringDataBuffer = new byte[newLength];
|
||||
}
|
||||
|
||||
|
||||
safeRead(length, stringDataBuffer);
|
||||
String r = new String(stringDataBuffer, 0, length, Utf8Helper.charset);
|
||||
endDumpLevel(r);
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
|
||||
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
@@ -186,7 +187,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
appendTo(writer, traits, exportMode, parallel);
|
||||
}
|
||||
|
||||
public File export(String directory, ScriptExportMode exportMode, boolean parallel) throws IOException {
|
||||
public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException {
|
||||
String scriptName = getPathScriptName();
|
||||
String packageName = getPathPackage();
|
||||
File outDir = new File(directory + File.separatorChar + "scripts" + File.separatorChar + makeDirPath(packageName));
|
||||
@@ -202,14 +203,14 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
File file = new File(fileName);
|
||||
try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) {
|
||||
try {
|
||||
toSource(writer, abc.script_info.get(scriptIndex).traits.traits, exportMode, parallel);
|
||||
toSource(writer, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ScriptPack.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(ScriptPack.class.getName()).log(Level.SEVERE, "The file path is probably too long", ex);
|
||||
}
|
||||
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,11 +33,11 @@ public class ClassInfo {
|
||||
public ClassInfo() {
|
||||
static_traits = new Traits();
|
||||
}
|
||||
|
||||
|
||||
public ClassInfo(Traits traits) {
|
||||
static_traits = traits;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "method_index=" + cinit_index + "\r\n" + static_traits.toString();
|
||||
|
||||
@@ -56,11 +56,11 @@ public class InstanceInfo {
|
||||
public InstanceInfo() {
|
||||
instance_traits = new Traits();
|
||||
}
|
||||
|
||||
|
||||
public InstanceInfo(Traits traits) {
|
||||
instance_traits = traits;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "name_index=" + name_index + " super_index=" + super_index + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString();
|
||||
|
||||
@@ -85,13 +85,13 @@ public final class MethodBody implements Cloneable {
|
||||
this.codeBytes = new byte[0];
|
||||
this.exceptions = new ABCException[0];
|
||||
}
|
||||
|
||||
|
||||
public MethodBody(Traits traits, byte[] codeBytes, ABCException[] exceptions) {
|
||||
this.traits = traits;
|
||||
this.codeBytes = codeBytes;
|
||||
this.exceptions = exceptions;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setCodeBytes(byte codeBytes[]) {
|
||||
this.codeBytes = codeBytes;
|
||||
this.code = null;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ScriptInfo {
|
||||
traitIndices.addAll(otherTraits);
|
||||
otherTraits.clear();
|
||||
}
|
||||
|
||||
|
||||
if (packagePrefix == null || packageName.startsWith(packagePrefix)) {
|
||||
ClassPath cp = new ClassPath(packageName, objectName);
|
||||
ret.add(new ScriptPack(cp, abc, scriptIndex, traitIndices));
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
public abstract class Trait implements Serializable {
|
||||
|
||||
private static final int[] EMPTY_METADATA_ARRAY = new int[0];
|
||||
|
||||
|
||||
public int name_index;
|
||||
|
||||
public int kindType;
|
||||
|
||||
@@ -39,11 +39,11 @@ public class Traits implements Serializable {
|
||||
public Traits() {
|
||||
traits = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public Traits(int initialCapacity) {
|
||||
traits = new ArrayList<>(initialCapacity);
|
||||
}
|
||||
|
||||
|
||||
public void delete(ABC abc, boolean d) {
|
||||
for (Trait t : traits) {
|
||||
t.delete(abc, d);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class FontExporter {
|
||||
f.getEngine().setCopyrightYear(cop == null ? "" : cop);
|
||||
f.setAuthor(ApplicationInfo.shortApplicationVerName);
|
||||
f.setVersion("1.0");
|
||||
|
||||
|
||||
SWF swf = t.getSwf();
|
||||
if (swf != null && swf.swfList != null && swf.swfList.sourceInfo != null) {
|
||||
String fileName = swf.swfList.sourceInfo.getFile();
|
||||
@@ -278,7 +278,7 @@ public class FontExporter {
|
||||
WritableFontData woffData = w.convert(font);
|
||||
woffData.copyTo(fos);
|
||||
}
|
||||
|
||||
|
||||
ttfFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,13 +308,13 @@ public class FrameExporter {
|
||||
if (evl != null) {
|
||||
evl.handleExportingEvent("frame", pos + 1, fframes.size(), tim.parentTag == null ? "" : tim.parentTag.getName());
|
||||
}
|
||||
|
||||
|
||||
BufferedImage result = SWF.frameToImageGet(ftim, fframes.get(pos++), 0, null, 0, ftim.displayRect, new Matrix(), new ColorTransform(), fbackgroundColor, false, settings.zoom).getBufferedImage();
|
||||
|
||||
if (evl != null) {
|
||||
evl.handleExportedEvent("frame", pos, fframes.size(), tim.parentTag == null ? "" : tim.parentTag.getName());
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.EventListener;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
|
||||
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
@@ -49,13 +50,13 @@ public class AS2ScriptExporter {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AS2ScriptExporter.class.getName());
|
||||
|
||||
public List<File> exportAS2ScriptsTimeout(final AbortRetryIgnoreHandler handler, final String outdir, final Map<String, ASMSource> asms, final ScriptExportMode exportMode, final EventListener evl) throws IOException {
|
||||
public List<File> exportAS2ScriptsTimeout(final AbortRetryIgnoreHandler handler, final String outdir, final Map<String, ASMSource> asms, final ScriptExportSettings exportSettings, final EventListener evl) throws IOException {
|
||||
try {
|
||||
List<File> result = CancellableWorker.call(new Callable<List<File>>() {
|
||||
|
||||
@Override
|
||||
public List<File> call() throws Exception {
|
||||
return exportAS2Scripts(handler, outdir, asms, exportMode, evl);
|
||||
return exportAS2Scripts(handler, outdir, asms, exportSettings, evl);
|
||||
}
|
||||
}, Configuration.exportTimeout.get(), TimeUnit.SECONDS);
|
||||
return result;
|
||||
@@ -67,7 +68,7 @@ public class AS2ScriptExporter {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private List<File> exportAS2Scripts(AbortRetryIgnoreHandler handler, String outdir, Map<String, ASMSource> asms, ScriptExportMode exportMode, EventListener evl) throws IOException {
|
||||
private List<File> exportAS2Scripts(AbortRetryIgnoreHandler handler, String outdir, Map<String, ASMSource> asms, ScriptExportSettings exportSettings, EventListener evl) throws IOException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (!outdir.endsWith(File.separator)) {
|
||||
outdir += File.separator;
|
||||
@@ -95,7 +96,7 @@ public class AS2ScriptExporter {
|
||||
}
|
||||
existingNames.add(name);
|
||||
|
||||
File f = exportAS2Script(handler, currentOutDir, asm, exportMode, evl, cnt, asms.size(), name);
|
||||
File f = exportAS2Script(handler, currentOutDir, asm, exportSettings, evl, cnt, asms.size(), name);
|
||||
if (f != null) {
|
||||
ret.add(f);
|
||||
}
|
||||
@@ -104,7 +105,7 @@ public class AS2ScriptExporter {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private File exportAS2Script(AbortRetryIgnoreHandler handler, String outdir, ASMSource asm, ScriptExportMode exportMode, EventListener evl, AtomicInteger index, int count, String name) throws IOException {
|
||||
private File exportAS2Script(AbortRetryIgnoreHandler handler, String outdir, ASMSource asm, ScriptExportSettings exportSettings, EventListener evl, AtomicInteger index, int count, String name) throws IOException {
|
||||
boolean retry;
|
||||
do {
|
||||
retry = false;
|
||||
@@ -129,6 +130,7 @@ public class AS2ScriptExporter {
|
||||
|
||||
File file = new File(f);
|
||||
try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(f))) {
|
||||
ScriptExportMode exportMode = exportSettings.mode;
|
||||
if (exportMode == ScriptExportMode.HEX) {
|
||||
asm.getActionSourcePrefix(writer);
|
||||
asm.getActionBytesAsHex(writer);
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters.settings;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
@@ -25,7 +26,10 @@ public class ScriptExportSettings {
|
||||
|
||||
public ScriptExportMode mode;
|
||||
|
||||
|
||||
public boolean singleFile;
|
||||
|
||||
public ScriptExportSettings(ScriptExportMode mode, boolean singleFile) {
|
||||
this.mode = mode;
|
||||
this.singleFile = singleFile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ public class SwfXmlExporter {
|
||||
StringBuilder sb = new StringBuilder(data.length * 2);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
sb.append(String.format("%02x", data[i]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
private static void generateXml(Document doc, Node node, String name, Object obj, boolean isListItem, int level) {
|
||||
Class cls = obj != null ? obj.getClass() : null;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class DefineTextTag extends TextTag {
|
||||
ret += "\r\n";
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
if (fnt == null) {
|
||||
ret.add(AppResources.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)));
|
||||
} else {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AS2Package implements TreeItem {
|
||||
result.addAll(scripts.values());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public TreeItem getChild(int index) {
|
||||
if (index < subPackages.size()) {
|
||||
for (AS2Package subPackage : subPackages.values()) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.MovieExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.SoundExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
import com.jpexs.decompiler.flash.tags.CSMTextSettingsTag;
|
||||
@@ -3041,7 +3042,8 @@ public class XFLConverter {
|
||||
}
|
||||
if (useAS3) {
|
||||
try {
|
||||
swf.exportActionScript(handler, outDir.getAbsolutePath(), ScriptExportMode.AS, parallel, null);
|
||||
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(ScriptExportMode.AS, false);
|
||||
swf.exportActionScript(handler, outDir.getAbsolutePath(), scriptExportSettings, parallel, null);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, "Error during ActionScript3 export", ex);
|
||||
}
|
||||
|
||||
@@ -1299,16 +1299,16 @@ public class Graph {
|
||||
currentLoop.phase = 0;
|
||||
}
|
||||
switch (part.stopPartType) {
|
||||
case AND_OR:
|
||||
part.setAndOrStack(stack); //Save stack for later use
|
||||
break;
|
||||
case AND_OR:
|
||||
part.setAndOrStack(stack); //Save stack for later use
|
||||
break;
|
||||
|
||||
case COMMONPART:
|
||||
part.setCommonPartStack(stack); //Save stack for later use
|
||||
break;
|
||||
case COMMONPART:
|
||||
part.setCommonPartStack(stack); //Save stack for later use
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1603,7 +1603,7 @@ public class Graph {
|
||||
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
|
||||
GraphPart.CommonPartStack commonPartStack = null;
|
||||
if ((!isEmpty) && (next != null)) {
|
||||
commonPartStack=next.new CommonPartStack();
|
||||
commonPartStack = next.new CommonPartStack();
|
||||
if (next.commonPartStacks == null) {
|
||||
next.commonPartStacks = new ArrayList<>();
|
||||
}
|
||||
@@ -1613,8 +1613,8 @@ public class Graph {
|
||||
if (!isEmpty) {
|
||||
if (next != null) {
|
||||
next.commonPartStacks.add(commonPartStack);
|
||||
commonPartStack.isTrueStack=true; //stopPart must know it needs to store trueStack
|
||||
}
|
||||
commonPartStack.isTrueStack = true; //stopPart must know it needs to store trueStack
|
||||
}
|
||||
onTrue = printGraph(visited, prepareBranchLocalData(localData), trueStack, allParts, part, nps.get(1), stopPart2, loops, null, staticOperation, path, recursionLevel + 1);
|
||||
}
|
||||
List<GraphTargetItem> onFalse = new ArrayList<>();
|
||||
@@ -1626,16 +1626,16 @@ public class Graph {
|
||||
onFalse = printGraph(visited, prepareBranchLocalData(localData), falseStack, allParts, part, nps.get(0), stopPart2, loops, null, staticOperation, path, recursionLevel + 1);
|
||||
}
|
||||
|
||||
/* if there is a stopPart (next), then Graph will be further analyzed starting from the stopPart:
|
||||
/* if there is a stopPart (next), then Graph will be further analyzed starting from the stopPart:
|
||||
* trueStack and falseStack must be set equal to corresponding stack that was built upon reaching stopPart. */
|
||||
if ((!isEmpty) && (next != null)) {
|
||||
if ((commonPartStack.trueStack != null) && (commonPartStack.falseStack != null)) {
|
||||
trueStack = commonPartStack.trueStack;
|
||||
falseStack = commonPartStack.falseStack;
|
||||
if ((commonPartStack.trueStack != null) && (commonPartStack.falseStack != null)) {
|
||||
trueStack = commonPartStack.trueStack;
|
||||
falseStack = commonPartStack.falseStack;
|
||||
}
|
||||
next.commonPartStacks.remove(next.commonPartStacks.size()-1);
|
||||
next.commonPartStacks.remove(next.commonPartStacks.size() - 1);
|
||||
if (next.commonPartStacks.isEmpty()) {
|
||||
next.stopPartType = GraphPart.StopPartType.NONE; /* reset StopPartType */
|
||||
next.stopPartType = GraphPart.StopPartType.NONE; // reset StopPartType
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ public class GraphPart implements Serializable {
|
||||
public List<GraphPart> throwParts = new ArrayList<>();
|
||||
|
||||
public enum StopPartType {
|
||||
|
||||
NONE, AND_OR, COMMONPART
|
||||
}
|
||||
|
||||
@@ -66,24 +67,27 @@ public class GraphPart implements Serializable {
|
||||
public TranslateStack andOrStack; // Stores stack when AND_OR stopPart has been reached
|
||||
|
||||
public class CommonPartStack { // Stores stack when COMMONPART stopPart has been reached
|
||||
boolean isTrueStack;
|
||||
TranslateStack trueStack;
|
||||
TranslateStack falseStack;
|
||||
|
||||
boolean isTrueStack;
|
||||
|
||||
TranslateStack trueStack;
|
||||
|
||||
TranslateStack falseStack;
|
||||
}
|
||||
|
||||
public ArrayList<CommonPartStack> commonPartStacks;
|
||||
|
||||
|
||||
public void setAndOrStack(TranslateStack stack) {
|
||||
andOrStack = stack;
|
||||
andOrStack = stack;
|
||||
}
|
||||
|
||||
public void setCommonPartStack(TranslateStack stack) {
|
||||
CommonPartStack currentStack = commonPartStacks.get(commonPartStacks.size()-1);
|
||||
if (currentStack.isTrueStack) {
|
||||
currentStack.trueStack = stack;
|
||||
} else {
|
||||
currentStack.falseStack = stack;
|
||||
}
|
||||
CommonPartStack currentStack = commonPartStacks.get(commonPartStacks.size() - 1);
|
||||
if (currentStack.isTrueStack) {
|
||||
currentStack.trueStack = stack;
|
||||
} else {
|
||||
currentStack.falseStack = stack;
|
||||
}
|
||||
}
|
||||
|
||||
public int setTime(int time, List<GraphPart> ordered, List<GraphPart> visited) {
|
||||
|
||||
Reference in New Issue
Block a user