This commit is contained in:
Jindra Pet��k
2013-11-07 20:32:58 +01:00
111 changed files with 1927 additions and 1532 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ public class ChromeCache implements CacheImplementation {
for (EntryStore en : entries) {
if (en.state == EntryStore.ENTRY_NORMAL) {
String key = en.getKey();
if (key != null && !key.trim().equals("")) {
if (key != null && !key.trim().isEmpty()) {
ret.add(en);
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash;
import java.io.IOException;
import java.util.Properties;
/**
*
* @author JPEXS
*/
public class ApplicationInfo {
public static final String applicationName = "JPEXS Free Flash Decompiler";
public static final String shortApplicationName = "FFDec";
public static final String vendor = "JPEXS";
public static String version = "";
public static String applicationVerName;
public static String shortApplicationVerName;
public static final String projectPage = "http://www.free-decompiler.com/flash";
public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion=";
public static String updatePage;
static {
loadProperties();
}
private static void loadProperties() {
Properties prop = new Properties();
try {
prop.load(ApplicationInfo.class.getResourceAsStream("/project.properties"));
version = prop.getProperty("version");
applicationVerName = applicationName + " v." + version;
updatePage = updatePageStub + version;
shortApplicationVerName = shortApplicationName + " v." + version;
} catch (IOException ex) {
//ignore
version = "unknown";
}
}
}
@@ -18,16 +18,22 @@ package com.jpexs.decompiler.flash;
import com.jpexs.proxy.Replacement;
import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
public class Configuration {
private static final String CONFIG_NAME = "config.bin";
private static final String REPLACEMENTS_NAME = "replacements.cfg";
private static final File unspecifiedFile = new File("unspecified");
private static File directory = unspecifiedFile;
public static final boolean DISPLAY_FILENAME = true;
public static boolean DEBUG_COPY = false;
public static boolean dump_tags = false;
@@ -92,6 +98,85 @@ public class Configuration {
}
};
private enum OSId {
WINDOWS, OSX, UNIX
}
private static OSId getOSId() {
PrivilegedAction<String> doGetOSName = new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("os.name");
}
};
OSId id = OSId.UNIX;
String osName = AccessController.doPrivileged(doGetOSName);
if (osName != null) {
if (osName.toLowerCase().startsWith("mac os x")) {
id = OSId.OSX;
} else if (osName.contains("Windows")) {
id = OSId.WINDOWS;
}
}
return id;
}
public static String getFFDecHome() throws IOException {
if (directory == unspecifiedFile) {
directory = null;
String userHome = null;
try {
userHome = System.getProperty("user.home");
} catch (SecurityException ignore) {
}
if (userHome != null) {
String applicationId = ApplicationInfo.shortApplicationName;
OSId osId = getOSId();
if (osId == OSId.WINDOWS) {
File appDataDir = null;
try {
String appDataEV = System.getenv("APPDATA");
if ((appDataEV != null) && (appDataEV.length() > 0)) {
appDataDir = new File(appDataEV);
}
} catch (SecurityException ignore) {
}
String vendorId = ApplicationInfo.vendor;
if ((appDataDir != null) && appDataDir.isDirectory()) {
// ${APPDATA}\{vendorId}\${applicationId}
String path = vendorId + "\\" + applicationId + "\\";
directory = new File(appDataDir, path);
} else {
// ${userHome}\Application Data\${vendorId}\${applicationId}
String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\";
directory = new File(userHome, path);
}
} else if (osId == OSId.OSX) {
// ${userHome}/Library/Application Support/${applicationId}
String path = "Library/Application Support/" + applicationId + "/";
directory = new File(userHome, path);
} else {
// ${userHome}/.${applicationId}/
String path = "." + applicationId + "/";
directory = new File(userHome, path);
}
}
}
if (!directory.exists()) {
if (!directory.mkdirs()) {
if (!directory.exists()) {
throw new IOException("cannot create directory " + directory);
}
}
}
String ret = directory.getAbsolutePath();
if (!ret.endsWith(File.separator)) {
ret += File.separator;
}
return ret;
}
/**
* Saves replacements to file for future use
*/
@@ -166,13 +251,12 @@ public class Configuration {
return result;
}
public static void unsetConfig(String cfg) {
config.remove(cfg);
private static String getReplacementsFile() throws IOException {
return getFFDecHome() + REPLACEMENTS_NAME;
}
public static void loadFromMap(Map<String, Object> map) {
config.clear();
config.putAll(map);
private static String getConfigFile() throws IOException {
return getFFDecHome() + CONFIG_NAME;
}
@SuppressWarnings("unchecked")
@@ -189,16 +273,16 @@ public class Configuration {
}
if (containsConfig("paralelSpeedUp")) {
setConfig("parallelSpeedUp", getConfig("paralelSpeedUp"));
unsetConfig("paralelSpeedUp");
config.remove("paralelSpeedUp");
}
}
public static void saveToFile(String file, String replacementsFile) {
private static void saveToFile(String file, String replacementsFile) {
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file))) {
oos.writeObject(config);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE);
Logger.getLogger(SWFInputStream.class.getName()).severe("Configuration directory is read only.");
Logger.getLogger(Configuration.class.getName()).severe("Configuration directory is read only.");
}
if (replacementsFile != null) {
saveReplacements(replacementsFile);
@@ -208,4 +292,16 @@ public class Configuration {
public static List<Replacement> getReplacements() {
return replacements;
}
public static void loadConfig() throws IOException {
loadFromFile(getConfigFile(), getReplacementsFile());
}
public static void saveConfig() {
try {
saveToFile(getConfigFile(), getReplacementsFile());
} catch (IOException ex) {
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
+65 -62
View File
@@ -141,7 +141,7 @@ import javax.imageio.ImageIO;
*
* @author JPEXS
*/
public class SWF {
public final class SWF {
/**
* Default version of SWF file format
@@ -479,52 +479,56 @@ public class SWF {
byte[] hdr = new byte[3];
fis.read(hdr);
String shdr = new String(hdr, "utf-8");
if (shdr.equals("CWS")) {
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
SWFOutputStream sos = new SWFOutputStream(fos, version);
sos.write("FWS".getBytes("utf-8"));
sos.writeUI8(version);
sos.writeUI32(fileSize);
InflaterInputStream iis = new InflaterInputStream(fis);
int i;
while ((i = iis.read()) != -1) {
fos.write(i);
}
fis.close();
fos.close();
} else if (shdr.equals("ZWS")) {
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
sis.readUI32(); //outSize
int propertiesSize = 5;
byte[] lzmaProperties = new byte[propertiesSize];
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
throw new IOException("LZMA:input .lzma file is too short");
}
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
if (!decoder.SetDecoderProperties(lzmaProperties)) {
throw new IOException("LZMA:Incorrect stream properties");
}
if (!decoder.Code(sis, baos, fileSize - 8)) {
throw new IOException("LZMA:Error in data stream");
}
try (SWFOutputStream sos = new SWFOutputStream(fos, version)) {
sos.write("FWS".getBytes("utf-8"));
sos.write(version);
sos.writeUI32(fileSize);
sos.write(baos.toByteArray());
}
fis.close();
fos.close();
} else {
return false;
switch (shdr) {
case "CWS":
{
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
SWFOutputStream sos = new SWFOutputStream(fos, version);
sos.write("FWS".getBytes("utf-8"));
sos.writeUI8(version);
sos.writeUI32(fileSize);
InflaterInputStream iis = new InflaterInputStream(fis);
int i;
while ((i = iis.read()) != -1) {
fos.write(i);
}
fis.close();
fos.close();
break;
}
case "ZWS":
{
int version = fis.read();
SWFInputStream sis = new SWFInputStream(fis, version, 4);
long fileSize = sis.readUI32();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
sis.readUI32();
int propertiesSize = 5;
byte[] lzmaProperties = new byte[propertiesSize];
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
throw new IOException("LZMA:input .lzma file is too short");
}
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
if (!decoder.SetDecoderProperties(lzmaProperties)) {
throw new IOException("LZMA:Incorrect stream properties");
}
if (!decoder.Code(sis, baos, fileSize - 8)) {
throw new IOException("LZMA:Error in data stream");
}
try (SWFOutputStream sos = new SWFOutputStream(fos, version)) {
sos.write("FWS".getBytes("utf-8"));
sos.write(version);
sos.writeUI32(fileSize);
sos.write(baos.toByteArray());
}
fis.close();
fos.close();
break;
}
default:
return false;
}
} catch (FileNotFoundException ex) {
return false;
@@ -842,7 +846,7 @@ public class SWF {
expName = "";
}
if (expName.contains(".")) {
expName = expName.substring(expName.lastIndexOf(".") + 1);
expName = expName.substring(expName.lastIndexOf('.') + 1);
}
if ((ct.getClass().getName() + "_" + expName).compareTo(addNode.tag.getClass().getName() + "_" + pathParts[pos]) > 0) {
break;
@@ -1023,7 +1027,7 @@ public class SWF {
private static void writeLE(OutputStream os, long val, int size) throws IOException {
for (int i = 0; i < size; i++) {
os.write((int) (val & 0xff));
val = val >> 8;
val >>= 8;
}
}
@@ -1528,17 +1532,17 @@ public class SWF {
}
if (allVariableNamesStr.contains(ret)) {
exists = true;
rndSize = rndSize + 1;
rndSize += 1;
continue loopfoo;
}
if (isReserved(ret)) {
exists = true;
rndSize = rndSize + 1;
rndSize += 1;
continue;
}
if (deobfuscated.containsValue(ret)) {
exists = true;
rndSize = rndSize + 1;
rndSize += 1;
continue;
}
} while (exists);
@@ -1856,13 +1860,13 @@ public class SWF {
String pkg = null;
String name = "";
if (n.contains(".")) {
pkg = n.substring(0, n.lastIndexOf("."));
name = n.substring(n.lastIndexOf(".") + 1);
pkg = n.substring(0, n.lastIndexOf('.'));
name = n.substring(n.lastIndexOf('.') + 1);
} else {
name = n;
}
boolean changed = false;
if ((pkg != null) && (!pkg.equals(""))) {
if ((pkg != null) && (!pkg.isEmpty())) {
String changedPkg = deobfuscatePackage(pkg, renameType, selected);
if (changedPkg != null) {
changed = true;
@@ -1913,7 +1917,7 @@ public class SWF {
}
HashMap<String, Integer> typeCounts = new HashMap<>();
public int deobfuscateIdentifiers(RenameType renameType) {
public int deobfuscateIdentifiers(RenameType renameType) throws InterruptedException {
findFileAttributes();
if (fileAttributes == null) {
int cnt = 0;
@@ -1929,17 +1933,17 @@ public class SWF {
}
}
public void renameAS2Identifier(String identifier, String newname) {
public void renameAS2Identifier(String identifier, String newname) throws InterruptedException {
Map<String, String> selected = new HashMap<>();
selected.put(identifier, newname);
renameAS2Identifiers(null, selected);
}
public int deobfuscateAS2Identifiers(RenameType renameType) {
public int deobfuscateAS2Identifiers(RenameType renameType) throws InterruptedException {
return renameAS2Identifiers(renameType, null);
}
private int renameAS2Identifiers(RenameType renameType, Map<String, String> selected) {
private int renameAS2Identifiers(RenameType renameType, Map<String, String> selected) throws InterruptedException {
actionsMap = new HashMap<>();
allFunctions = new ArrayList<>();
allVariableNames = new ArrayList<>();
@@ -2092,7 +2096,7 @@ public class SWF {
informListeners("rename", "function " + fc + "/" + allFunctions.size());
if (fun instanceof ActionDefineFunction) {
ActionDefineFunction f = (ActionDefineFunction) fun;
if (f.functionName.equals("")) { //anonymous function, leave as is
if (f.functionName.isEmpty()) { //anonymous function, leave as is
continue;
}
String changed = deobfuscateName(f.functionName, false, "function", renameType, selected);
@@ -2103,7 +2107,7 @@ public class SWF {
}
if (fun instanceof ActionDefineFunction2) {
ActionDefineFunction2 f = (ActionDefineFunction2) fun;
if (f.functionName.equals("")) { //anonymous function, leave as is
if (f.functionName.isEmpty()) { //anonymous function, leave as is
continue;
}
String changed = deobfuscateName(f.functionName, false, "function", renameType, selected);
@@ -2524,7 +2528,6 @@ public class SWF {
f++;
}
}
return;
}
public void removeTagFromTimeline(Tag toRemove, List<Tag> timeline) {
@@ -471,7 +471,7 @@ public class SWFInputStream extends InputStream {
}
for (int bit = 0; bit < nBits; bit++) {
int nb = (tempByte >> (7 - bitPos)) & 1;
ret = ret + (nb << (nBits - 1 - bit));
ret += (nb << (nBits - 1 - bit));
bitPos++;
if (bitPos == 8) {
bitPos = 0;
@@ -236,7 +236,7 @@ public class SWFOutputStream extends OutputStream {
int sign = bits >> 31;
int exponent = (bits >> 22) & 0xff;
int mantisa = bits & 0x3FFFFF;
mantisa = mantisa >> 13;
mantisa >>= 13;
writeUI16((sign << 15) + (exponent << 10) + mantisa);
}
@@ -248,7 +248,7 @@ public class SWFOutputStream extends OutputStream {
*/
public void writeEncodedU32(long value) throws IOException {
boolean loop = true;
value = value & 0xFFFFFFFF;
value &= 0xFFFFFFFF;
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
@@ -258,7 +258,7 @@ public class SWFOutputStream extends OutputStream {
ret += 0x80;
}
write(ret);
value = value >> 7;
value >>= 7;
} while (loop);
}
@@ -277,7 +277,7 @@ public class TagNode {
File dir = new File(outdir);
List<File> ret = new ArrayList<>();
if (!outdir.endsWith(File.separator)) {
outdir = outdir + File.separator;
outdir += File.separator;
}
List<String> existingNames = new ArrayList<>();
for (TagNode node : nodeList) {
@@ -99,7 +99,7 @@ public class ABC {
}
}
public int removeTraps() {
public int removeTraps() throws InterruptedException {
int rem = 0;
for (int s = 0; s < script_info.length; s++) {
rem += script_info[s].removeTraps(s, this, "");
@@ -274,10 +274,10 @@ public class ABC {
String pkg = "";
String name = fullname;
if (fullname.contains(".")) {
pkg = fullname.substring(0, fullname.lastIndexOf("."));
name = fullname.substring(fullname.lastIndexOf(".") + 1);
pkg = fullname.substring(0, fullname.lastIndexOf('.'));
name = fullname.substring(fullname.lastIndexOf('.') + 1);
}
if (!pkg.equals("")) {
if (!pkg.isEmpty()) {
int pkgStrIndex = constants.getStringId(pkg, true);
pkgStrIndex = deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, pkgStrIndex, renameType);
pkg = constants.constant_string[pkgStrIndex];
@@ -286,7 +286,7 @@ public class ABC {
nameStrIndex = deobfuscateName(stringUsageTypes, stringUsages, namespaceUsages, namesMap, nameStrIndex, true, renameType);
name = constants.constant_string[nameStrIndex];
String fullChanged = "";
if (!pkg.equals("")) {
if (!pkg.isEmpty()) {
fullChanged = pkg + ".";
}
fullChanged += name;
@@ -823,18 +823,18 @@ public class ABC {
for (int i = 1; i < constants.constant_string.length; i++) {
if (constants.constant_string[i].equals(ret)) {
exists = true;
rndSize = rndSize + 1;
rndSize += 1;
continue loopfoo;
}
}
if (isReserved(ret)) {
exists = true;
rndSize = rndSize + 1;
rndSize += 1;
continue;
}
if (deobfuscated.containsValue(ret)) {
exists = true;
rndSize = rndSize + 1;
rndSize += 1;
continue;
}
} while (exists);
@@ -109,8 +109,8 @@ public class ABCInputStream extends InputStream {
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
i &= 0x7f;
ret += (i << bytePos);
byteCount++;
bytePos += 7;
} while (nextByte);
@@ -125,7 +125,7 @@ public class ABCInputStream extends InputStream {
int ret = (read()) + (read() << 8) + (read() << 16);
if ((ret >> 23) == 1) {
ret = ret | 0xff000000;
ret |= 0xff000000;
}
return ret;
@@ -144,8 +144,8 @@ public class ABCInputStream extends InputStream {
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
i &= 0x7f;
ret += (i << bytePos);
byteCount++;
bytePos += 7;
if (bytePos == 35) {
@@ -60,7 +60,7 @@ public class ABCOutputStream extends OutputStream {
public void writeU32(long value) throws IOException {
boolean loop = true;
value = value & 0xFFFFFFFF;
value &= 0xFFFFFFFF;
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
@@ -70,17 +70,17 @@ public class ABCOutputStream extends OutputStream {
ret += 0x80;
}
write(ret);
value = value >> 7;
value >>= 7;
} while (loop);
}
public void writeS24(long value) throws IOException {
int ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
value >>= 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
value >>= 8;
ret = (int) (value & 0xff);
write(ret);
}
@@ -107,13 +107,13 @@ public class ABCOutputStream extends OutputStream {
}
if (bitcount == 35) {
ret = ret & 0xf;
ret &= 0xf;
}
write(ret);
if (bitcount == 35) {
break;
}
value = value >> 7;
value >>= 7;
} while (loop);
}
@@ -34,7 +34,7 @@ public class ClassPath {
@Override
public String toString() {
return (packageStr == null || packageStr.equals("")) ? className : packageStr + "." + className;
return (packageStr == null || packageStr.isEmpty()) ? className : packageStr + "." + className;
}
@Override
@@ -99,7 +99,7 @@ public class ScriptPack {
return packageName.equals("") ? scriptName : packageName + "." + scriptName;
}*/
private static String makeDirPath(String packageName) {
if (packageName.equals("")) {
if (packageName.isEmpty()) {
return "";
}
String[] pathParts;
@@ -1405,7 +1405,7 @@ public class AVM2Code implements Serializable {
ignoredIns = new ArrayList<>();
}
public List<GraphTargetItem> toGraphTargetItems(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo[] method_info, MethodBody body, HashMap<Integer, String> localRegNames, Stack<GraphTargetItem> scopeStack, boolean isStaticInitializer, List<String> fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) {
public List<GraphTargetItem> toGraphTargetItems(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo[] method_info, MethodBody body, HashMap<Integer, String> localRegNames, Stack<GraphTargetItem> scopeStack, boolean isStaticInitializer, List<String> fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) throws InterruptedException {
initToSource();
List<GraphTargetItem> list;
HashMap<Integer, GraphTargetItem> localRegs = new HashMap<>();
@@ -1654,7 +1654,7 @@ public class AVM2Code implements Serializable {
return ret;
}
public int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) {
public int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException {
removeDeadCode(constants, trait, info, body);
List<Object> localData = new ArrayList<>();
localData.add((Boolean) isStatic); //isStatic
@@ -2360,7 +2360,7 @@ public class AVM2Code implements Serializable {
}
@SuppressWarnings("unchecked")
private static int removeTraps(HashMap<Integer, List<Integer>> refs, boolean secondPass, boolean indeterminate, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, HashMap<Integer, Integer> visited, HashMap<Integer, HashMap<Integer, GraphTargetItem>> visitedStates, HashMap<GraphSourceItem, Decision> decisions, String path) {
private static int removeTraps(HashMap<Integer, List<Integer>> refs, boolean secondPass, boolean indeterminate, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, AVM2GraphSource code, int ip, HashMap<Integer, Integer> visited, HashMap<Integer, HashMap<Integer, GraphTargetItem>> visitedStates, HashMap<GraphSourceItem, Decision> decisions, String path) throws InterruptedException {
boolean debugMode = false;
int ret = 0;
iploop:
@@ -2615,7 +2615,7 @@ public class AVM2Code implements Serializable {
return ret;
}
public static int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List<Object> localData, AVM2GraphSource code, int addr, String path, HashMap<Integer, List<Integer>> refs) {
public static int removeTraps(ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List<Object> localData, AVM2GraphSource code, int addr, String path, HashMap<Integer, List<Integer>> refs) throws InterruptedException {
HashMap<GraphSourceItem, AVM2Code.Decision> decisions = new HashMap<>();
removeTraps(refs, false, false, localData, new Stack<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions, path);
int cnt = 0;
@@ -113,7 +113,7 @@ public class AVM2Graph extends Graph {
public static final int DATA_FINALLYJUMPS = 11;
public static final int DATA_IGNOREDSWITCHES = 12;
public static List<GraphTargetItem> translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> scopeStack, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, int staticOperation, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) {
public static List<GraphTargetItem> translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, Stack<GraphTargetItem> scopeStack, HashMap<Integer, String> localRegNames, List<String> fullyQualifiedNames, int staticOperation, HashMap<Integer, Integer> localRegAssigmentIps, HashMap<Integer, List<Integer>> refs) throws InterruptedException {
AVM2Graph g = new AVM2Graph(code, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames, localRegAssigmentIps, refs);
List<Object> localData = new ArrayList<>();
@@ -186,7 +186,7 @@ public class AVM2Graph extends Graph {
}
@Override
protected List<GraphTargetItem> check(GraphSource code, List<Object> localData, List<GraphPart> allParts, Stack<GraphTargetItem> stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) {
protected List<GraphTargetItem> check(GraphSource code, List<Object> localData, List<GraphPart> allParts, Stack<GraphTargetItem> stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) throws InterruptedException {
List<GraphTargetItem> ret = null;
@SuppressWarnings("unchecked")
@@ -254,7 +254,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
if (ignored) {
return " ;ignored";
}
if ((comment == null) || comment.equals("")) {
if ((comment == null) || comment.isEmpty()) {
return "";
}
return " ;" + comment;
@@ -123,7 +123,7 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns
int multinameIndex = ins.operands[0];
String multiname = resolveMultinameNoPop(0, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames);
GraphTargetItem obj = stack.get(1 + resolvedCount(abc.constants, multinameIndex)); //pod vrcholem
if ((!obj.toString().equals(""))) {
if ((!obj.toString().isEmpty())) {
multiname = "." + multiname;
}
return obj + multiname;
@@ -45,7 +45,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
} else if (value instanceof Long) {
bval = ((Long) value).longValue() != 0;
} else if (value instanceof String) {
bval = !((String) value).equals("");
bval = !((String) value).isEmpty();
} else {
bval = true;
}
@@ -72,7 +72,7 @@ public class FullMultinameAVM2Item extends AVM2Item {
cns = ns.getName(constants);
}
}
return cname.equals("XML") && cns.equals("");
return cname.equals("XML") && cns.isEmpty();
}
@Override
@@ -62,7 +62,7 @@ public class NewFunctionAVM2Item extends AVM2Item {
@Override
protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
MethodBody body = abc.findBody(methodIndex);
writer.append("function" + (!functionName.equals("") ? " " + functionName : ""));
writer.append("function" + (!functionName.isEmpty() ? " " + functionName : ""));
writer.startMethod(methodIndex);
writer.appendNoHilight("(");
methodInfo[methodIndex].getParamStr(writer, constants, body, abc, fullyQualifiedNames);
@@ -56,7 +56,7 @@ public class MethodInfoParser {
nstype = nstype + symbValue.type + ":";
}
} while (symbValue.type >= 8 && symbValue.type <= 13);
if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
throw new ParseException("Namespace expected", lexer.yyline());
}
int id = 0;
@@ -95,7 +95,7 @@ public class MethodInfoParser {
value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs);
} else if (nstype.equals("8:")) {
value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs);
} else if (nstype.equals("")) {
} else if (nstype.isEmpty()) {
value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace);
} else {
throw new ParseException("Invalid type of namespace", lexer.yyline());
@@ -194,7 +194,7 @@ public class MethodInfoParser {
nstype = nstype + symbValue.type + ":";
}
} while (symbValue.type >= 8 && symbValue.type <= 13);
if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
throw new ParseException("Namespace expected", lexer.yyline());
}
int id = 0;
@@ -233,7 +233,7 @@ public class MethodInfoParser {
optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs));
} else if (nstype.equals("8:")) {
optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs));
} else if (nstype.equals("")) {
} else if (nstype.isEmpty()) {
optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace));
} else {
throw new ParseException("Invalid type of namespace", lexer.yyline());
@@ -72,7 +72,7 @@ public class InstanceInfo {
String modifiers;
Namespace ns = abc.constants.constant_multiname[name_index].getNamespace(abc.constants);
modifiers = ns.getPrefix(abc);
if (!modifiers.equals("")) {
if (!modifiers.isEmpty()) {
modifiers += " ";
}
@@ -80,7 +80,7 @@ public class InstanceInfo {
modifiers += "final ";
}
if (isDynamic()) {
modifiers = modifiers + "dynamic ";
modifiers += "dynamic ";
}
String objType = "class ";
if (isInterface()) {
@@ -84,7 +84,7 @@ public class MethodBody implements Cloneable, Serializable {
code.restoreControlFlow(constants, trait, info, this);
}
public int removeTraps(ConstantPool constants, ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) {
public int removeTraps(ConstantPool constants, ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException {
return code.removeTraps(constants, trait, abc.method_info[method_info], this, abc, scriptIndex, classIndex, isStatic, path);
}
@@ -130,7 +130,7 @@ public class MethodBody implements Cloneable, Serializable {
try {
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() {
public Void call() throws InterruptedException {
MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits);
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
convertedItems = converted.code.toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<Integer, Integer>(), converted.code.visitCode(converted));
@@ -257,7 +257,7 @@ public class Multiname {
Namespace ns = getNamespace(constants);
if (ns != null) {
String nsname = ns.getName(constants);
if (!nsname.equals("")) {
if (!nsname.isEmpty()) {
ret += nsname + ".";
}
}
@@ -81,7 +81,7 @@ public class Namespace {
public String getNameWithKind(ConstantPool constants) {
String kindStr = getKindStr();
String nameStr = constants.constant_string[name_index];
return kindStr + (nameStr.equals("") ? "" : " " + nameStr);
return kindStr + (nameStr.isEmpty() ? "" : " " + nameStr);
}
public String getPrefix(ABC abc) {
@@ -65,7 +65,7 @@ public class ScriptInfo {
return ret;
}
public int removeTraps(int scriptIndex, ABC abc, String path) {
public int removeTraps(int scriptIndex, ABC abc, String path) throws InterruptedException {
return traits.removeTraps(scriptIndex, -1, true, abc, path);
}
@@ -63,9 +63,9 @@ public abstract class Trait implements Serializable {
break;
}
if (nsname.contains(".")) {
nsname = nsname.substring(nsname.lastIndexOf(".") + 1);
nsname = nsname.substring(nsname.lastIndexOf('.') + 1);
}
if (!nsname.equals("")) {
if (!nsname.isEmpty()) {
break;
}
}
@@ -77,7 +77,7 @@ public abstract class Trait implements Serializable {
}
if ((!nsname.equals("")) && (!nsname.equals("-"))) {
if ((!nsname.isEmpty()) && (!nsname.equals("-"))) {
} else {
if (ns != null) {
if (ns.kind == Namespace.KIND_NAMESPACE) {
@@ -86,7 +86,7 @@ public abstract class Trait implements Serializable {
}
}
if ((!nsname.contains(":")) && (!nsname.equals(""))) {
if ((!nsname.contains(":")) && (!nsname.isEmpty())) {
ret += " " + nsname;
}
if (ns != null) {
@@ -161,7 +161,7 @@ public abstract class Trait implements Serializable {
}
}
public abstract int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path);
public abstract int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException;
public String getPath(ABC abc) {
Multiname name = getName(abc);
@@ -70,7 +70,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
private boolean parseUsagesFromNS(List<ABCContainerTag> abcTags, ABC abc, List<String> imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
Namespace ns = abc.constants.constant_namespace[namespace_index];
if (name.equals("")) {
if (name.isEmpty()) {
name = "*";
}
String newimport = ns.getName(abc.constants);
@@ -87,7 +87,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
if (newname.equals("-")) {
return true;
}
if (!newname.equals("")) {
if (!newname.isEmpty()) {
newimport = newname;
break;
}
@@ -96,7 +96,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
newimport = oldimport;
newimport += "." + name;
}
if (newimport.equals("")) {
if (newimport.isEmpty()) {
newimport = null;
}
if (newimport != null) {
@@ -110,11 +110,11 @@ public class TraitClass extends Trait implements TraitWithSlot {
}
String pkg = "";
if (newimport.contains(".")) {
pkg = newimport.substring(0, newimport.lastIndexOf("."));
pkg = newimport.substring(0, newimport.lastIndexOf('.'));
}
String usname = newimport;
if (usname.contains(".")) {
usname = usname.substring(usname.lastIndexOf(".") + 1);
usname = usname.substring(usname.lastIndexOf('.') + 1);
}
if (ns.kind == Namespace.KIND_PACKAGE) {
if (!pkg.equals(ignorePackage)) {
@@ -140,7 +140,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
private void parseImportsUsagesFromNS(List<ABCContainerTag> abcTags, ABC abc, List<String> imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
Namespace ns = abc.constants.constant_namespace[namespace_index];
if (name.equals("")) {
if (name.isEmpty()) {
name = "*";
}
String newimport = ns.getName(abc.constants);
@@ -158,7 +158,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
return;
}
if (!imports.contains(newimport)) {
String pkg = newimport.substring(0, newimport.lastIndexOf("."));
String pkg = newimport.substring(0, newimport.lastIndexOf('.'));
if (!pkg.equals(ignorePackage)) {
imports.add(newimport);
}
@@ -348,8 +348,8 @@ public class TraitClass extends Trait implements TraitWithSlot {
String pkg = "";
String name = spath;
if (spath.contains(".")) {
pkg = spath.substring(0, spath.lastIndexOf("."));
name = spath.substring(spath.lastIndexOf(".") + 1);
pkg = spath.substring(0, spath.lastIndexOf('.'));
name = spath.substring(spath.lastIndexOf('.') + 1);
}
if (pkg.equals(packageName)) {
namesInThisPackage.add(name);
@@ -371,10 +371,10 @@ public class TraitClass extends Trait implements TraitWithSlot {
String name = ipath;
String pkg = "";
if (name.contains(".")) {
pkg = name.substring(0, name.lastIndexOf("."));
name = name.substring(name.lastIndexOf(".") + 1);
pkg = name.substring(0, name.lastIndexOf('.'));
name = name.substring(name.lastIndexOf('.') + 1);
}
if (importnames.contains(name) || ((!pkg.equals("")) && isBuiltInClass(name))) {
if (importnames.contains(name) || ((!pkg.isEmpty()) && isBuiltInClass(name))) {
fullyQualifiedNames.add(name);
} else {
importnames.add(name);
@@ -397,8 +397,8 @@ public class TraitClass extends Trait implements TraitWithSlot {
for (int i = 0; i < imports.size(); i++) {
String imp = imports.get(i);
String pkg = imp.substring(0, imp.lastIndexOf("."));
String name = imp.substring(imp.lastIndexOf(".") + 1);
String pkg = imp.substring(0, imp.lastIndexOf('.'));
String name = imp.substring(imp.lastIndexOf('.') + 1);
if (name.equals("*")) {
continue;
}
@@ -529,7 +529,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
}
@Override
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) {
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException {
int iInitializer = abc.findBodyIndex(abc.instance_info[class_info].iinit_index);
int ret = 0;
if (iInitializer != -1) {
@@ -96,7 +96,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
}
@Override
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) {
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException {
int bodyIndex = abc.findBodyIndex(method_info);
if (bodyIndex != -1) {
return abc.bodies[bodyIndex].removeTraps(abc.constants, abc, this, scriptIndex, classIndex, isStatic, path);
@@ -101,7 +101,7 @@ public class TraitMethodGetterSetter extends Trait {
}
@Override
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) {
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException {
int bodyIndex = abc.findBodyIndex(method_info);
if (bodyIndex != -1) {
return abc.bodies[bodyIndex].removeTraps(abc.constants, abc, this, scriptIndex, classIndex, isStatic, path);
@@ -43,7 +43,7 @@ public class Traits implements Serializable {
return traits.length - 1;
}
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) {
public int removeTraps(int scriptIndex, int classIndex, boolean isStatic, ABC abc, String path) throws InterruptedException {
int ret = 0;
for (Trait t : traits) {
ret += t.removeTraps(scriptIndex, classIndex, isStatic, abc, path);
@@ -128,7 +128,7 @@ public class Traits implements Serializable {
int h = t;
if (classIndex != -1) {
if (!isStatic) {
h = h + abc.class_info[classIndex].static_traits.traits.length;
h += abc.class_info[classIndex].static_traits.traits.length;
}
}
if (trait instanceof TraitClass) {
@@ -123,7 +123,7 @@ public class Action implements GraphSourceItem {
"_ymouse"
};
public static final List<String> propertyNamesList = Arrays.asList(propertyNames);
private static Logger logger = Logger.getLogger(Action.class.getName());
private static final Logger logger = Logger.getLogger(Action.class.getName());
/**
* Constructor
@@ -386,7 +386,7 @@ public class Action implements GraphSourceItem {
* @param list List of actions
* @param importantOffsets List of important offsets to mark as labels
* @param version SWF version
* @param hex Add hexadecimal?
* @param exportMode PCode or hex?
* @param swfPos
* @param path
* @return HilightedTextWriter
@@ -599,7 +599,7 @@ public class Action implements GraphSourceItem {
* @param knownAddreses List of important offsets to mark as labels
* @param constantPool Constant pool
* @param version SWF version
* @param hex Add hexadecimal
* @param exportMode PCode or hex?
* @return String of P-code source
*/
public String getASMSource(List<? extends GraphSourceItem> container, List<Long> knownAddreses, List<String> constantPool, int version, ExportMode exportMode) {
@@ -617,7 +617,7 @@ public class Action implements GraphSourceItem {
* @param staticOperation the value of staticOperation
* @param path the value of path
*/
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
}
/**
@@ -686,7 +686,7 @@ public class Action implements GraphSourceItem {
return -1;
}
public static List<GraphTargetItem> actionsToTree(List<Action> actions, int version, int staticOperation, String path) {
public static List<GraphTargetItem> actionsToTree(List<Action> actions, int version, int staticOperation, String path) throws InterruptedException {
return actionsToTree(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), actions, version, staticOperation, path);
}
@@ -696,7 +696,6 @@ public class Action implements GraphSourceItem {
* @param actions List of actions
* @param version SWF version
* @param path
* @return String with Source code
*/
public static void actionsToSource(ASMSource asm, final List<Action> actions, final int version, final String path, GraphTextWriter writer) {
writer.suspendMeasure();
@@ -756,7 +755,7 @@ public class Action implements GraphSourceItem {
* @param path
* @return List of treeItems
*/
public static List<GraphTargetItem> actionsToTree(HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> actions, int version, int staticOperation, String path) {
public static List<GraphTargetItem> actionsToTree(HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> actions, int version, int staticOperation, String path) throws InterruptedException {
//Stack<ActionItem> stack = new Stack<ActionItem>();
return ActionGraph.translateViaGraph(regNames, variables, functions, actions, version, staticOperation, path);
//return actionsToTree(regNames, stack, actions, 0, actions.size() - 1, version);
@@ -764,7 +763,7 @@ public class Action implements GraphSourceItem {
@Override
@SuppressWarnings("unchecked")
public void translate(List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, int staticOperation, String path) {
public void translate(List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, int staticOperation, String path) throws InterruptedException {
translate(stack, output, (HashMap<Integer, String>) localData.get(0), (HashMap<String, GraphTargetItem>) localData.get(1), (HashMap<String, GraphTargetItem>) localData.get(2), staticOperation, path);
}
@@ -825,7 +824,7 @@ public class Action implements GraphSourceItem {
logger.fine(s);
}
public static List<GraphTargetItem> actionsPartToTree(HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, Stack<GraphTargetItem> stack, List<Action> actions, int start, int end, int version, int staticOperation, String path) {
public static List<GraphTargetItem> actionsPartToTree(HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, Stack<GraphTargetItem> stack, List<Action> actions, int start, int end, int version, int staticOperation, String path) throws InterruptedException {
if (start < actions.size() && (end > 0) && (start > 0)) {
log("Entering " + start + "-" + end + (actions.size() > 0 ? (" (" + actions.get(start).toString() + " - " + actions.get(end == actions.size() ? end - 1 : end) + ")") : ""));
}
@@ -69,7 +69,7 @@ public class ActionGraph extends Graph {
}*/
}
public static List<GraphTargetItem> translateViaGraph(HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> code, int version, int staticOperation, String path) {
public static List<GraphTargetItem> translateViaGraph(HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> code, int version, int staticOperation, String path) throws InterruptedException {
ActionGraph g = new ActionGraph(code, registerNames, variables, functions, version);
List<Object> localData = new ArrayList<>();
@@ -120,7 +120,7 @@ public class ActionGraph extends Graph {
GraphTargetItem it = list.get(t);
if (it instanceof SetTargetActionItem) {
SetTargetActionItem st = (SetTargetActionItem) it;
if (st.target.equals("")) {
if (st.target.isEmpty()) {
if (targetStart > -1) {
targetEnd = t;
break;
@@ -253,7 +253,7 @@ public class ActionGraph extends Graph {
}
@Override
protected List<GraphTargetItem> check(GraphSource code, List<Object> localData, List<GraphPart> allParts, Stack<GraphTargetItem> stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) {
protected List<GraphTargetItem> check(GraphSource code, List<Object> localData, List<GraphPart> allParts, Stack<GraphTargetItem> stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) throws InterruptedException {
if (!output.isEmpty()) {
if (output.get(output.size() - 1) instanceof StoreRegisterActionItem) {
StoreRegisterActionItem str = (StoreRegisterActionItem) output.get(output.size() - 1);
@@ -56,7 +56,7 @@ public class ActionGraphSource extends GraphSource {
}
@Override
public List<GraphTargetItem> translatePart(GraphPart part, List<Object> localData, Stack<GraphTargetItem> stack, int start, int end, int staticOperation, String path) {
public List<GraphTargetItem> translatePart(GraphPart part, List<Object> localData, Stack<GraphTargetItem> stack, int start, int end, int staticOperation, String path) throws InterruptedException {
return (Action.actionsPartToTree(registerNames, variables, functions, stack, actions, start, end, version, staticOperation, path));
}
private List<Long> posCache = null;
@@ -150,7 +150,11 @@ public class ActionListReader {
updateActionLengths(actions, version);
if (deobfuscate) {
actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path);
try {
actions = deobfuscateActionList(listeners, containerSWFOffset, actions, version, ip, path);
} catch (InterruptedException ex) {
Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, ex);
}
updateActionLengths(actions, version);
removeZeroJumps(actions, version);
}
@@ -171,7 +175,7 @@ public class ActionListReader {
* @return List of actions
* @throws IOException
*/
public static List<Action> deobfuscateActionList(List<DisassemblyListener> listeners, long containerSWFOffset, List<Action> actions, int version, int ip, String path) throws IOException {
public static List<Action> deobfuscateActionList(List<DisassemblyListener> listeners, long containerSWFOffset, List<Action> actions, int version, int ip, String path) throws IOException, InterruptedException {
if (actions.isEmpty()) {
return actions;
}
@@ -623,7 +627,7 @@ public class ActionListReader {
}
}
ip = ip + actionLengthWithHeader;
ip += actionLengthWithHeader;
if (a.isExit()) {
break;
@@ -645,7 +649,7 @@ public class ActionListReader {
}
@SuppressWarnings("unchecked")
private static void deobfustaceActionListAtPosRecursive(List<DisassemblyListener> listeners, List<GraphTargetItem> output, HashMap<Long, List<GraphSourceItemContainer>> containers, long containerSWFOffset, List<Object> localData, Stack<GraphTargetItem> stack, ConstantPool cpool, List<Action> actions, int pos, int ip, List<Action> ret, int startIp, int endip, String path, Map<Integer, Integer> visited, boolean indeterminate, Map<Integer, HashMap<String, GraphTargetItem>> decisionStates, int version) throws IOException {
private static void deobfustaceActionListAtPosRecursive(List<DisassemblyListener> listeners, List<GraphTargetItem> output, HashMap<Long, List<GraphSourceItemContainer>> containers, long containerSWFOffset, List<Object> localData, Stack<GraphTargetItem> stack, ConstantPool cpool, List<Action> actions, int pos, int ip, List<Action> ret, int startIp, int endip, String path, Map<Integer, Integer> visited, boolean indeterminate, Map<Integer, HashMap<String, GraphTargetItem>> decisionStates, int version) throws IOException, InterruptedException {
boolean debugMode = false;
boolean decideBranch = false;
@@ -727,13 +731,16 @@ public class ActionListReader {
System.out.print("newip " + nip + ", ");
System.out.print("Action: jump(j),ignore(i),compute(c)?");
String next = sc.next();
if (next.equals("j")) {
newip = pos + aif.getJumpOffset();
pos = newip;
} else if (next.equals("i")) {
} else if (next.equals("c")) {
goaif = true;
switch (next) {
case "j":
newip = pos + aif.getJumpOffset();
pos = newip;
break;
case "i":
break;
case "c":
goaif = true;
break;
}
} else if (top.isCompileTime() && (!top.hasSideEffect())) {
((ActionIf) a).compileTime = true;
@@ -839,7 +846,7 @@ public class ActionListReader {
if (newip > -1) {
ip = newip;
} else {
ip = ip + info;
ip += info;
}
pos = ip;
if (goaif) {
@@ -81,7 +81,7 @@ public class FunctionActionItem extends ActionItem {
if (calculatedFunctionName != null) {
writer.append(" ");
calculatedFunctionName.toStringNoQuotes(writer, localData);
} else if (!functionName.equals("")) {
} else if (!functionName.isEmpty()) {
writer.append(" ");
writer.append(functionName);
}
@@ -91,7 +91,7 @@ public class FunctionActionItem extends ActionItem {
writer.append(", ");
}
String pname = paramNames.get(p);
if (pname == null || pname.equals("")) {
if (pname == null || pname.isEmpty()) {
pname = new RegisterNumber(regStart + p).translate();
}
writer.append(pname);
@@ -1413,7 +1413,7 @@ public final class ActionScriptLexer {
String s = yytext();
s = s.substring(1, s.length() - 1);
if (s.contains(" ")) {
s = s.substring(0, s.indexOf(" "));
s = s.substring(0, s.indexOf(' '));
}
xmlTagName = s;
string.append(yytext());
@@ -82,7 +82,7 @@ public class ActionGetURL extends Action {
@Override
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
String fsCommandPrefix = "FSCommand:";
if (urlString.startsWith(fsCommandPrefix) && targetString.equals("")) {
if (urlString.startsWith(fsCommandPrefix) && targetString.isEmpty()) {
String command = urlString.substring(fsCommandPrefix.length());
output.add(new FSCommandActionItem(this, command));
return;
@@ -91,7 +91,7 @@ public class ActionGetURL extends Action {
if (targetString.startsWith(levelPrefix)) {
try {
int num = Integer.valueOf(targetString.substring(levelPrefix.length()));
if (urlString.equals("")) {
if (urlString.isEmpty()) {
output.add(new UnLoadMovieNumActionItem(this, new DirectValueActionItem((Long) (long) (int) num)));
} else {
DirectValueActionItem urlStringDi = new DirectValueActionItem(null, 0, urlString, new ArrayList<String>());
@@ -103,7 +103,7 @@ public class ActionGetURL extends Action {
}
if (urlString.equals("")) {
if (urlString.isEmpty()) {
DirectValueActionItem targetStringDi = new DirectValueActionItem(null, 0, targetString, new ArrayList<String>());
output.add(new UnLoadMovieActionItem(this, targetStringDi));
} else {
@@ -125,7 +125,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
}
@Override
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
GraphTargetItem frameTi = new DirectValueActionItem(null, 0, new Long(frame), new ArrayList<String>());
List<GraphTargetItem> body = ActionGraph.translateViaGraph(regNames, variables, functions, skipped, SWF.DEFAULT_VERSION, staticOperation, path);
output.add(new IfFrameLoadedActionItem(frameTi, body, this));
@@ -129,7 +129,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
}
@Override
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
GraphTargetItem frame = stack.pop();
List<GraphTargetItem> body = ActionGraph.translateViaGraph(regNames, variables, functions, skipped, SWF.DEFAULT_VERSION, staticOperation, path);
output.add(new IfFrameLoadedActionItem(frame, body, this));
@@ -51,7 +51,7 @@ public class RegisterNumber implements Serializable {
@Override
public String toString() {
if (name == null || name.trim().equals("")) {
if (name == null || name.trim().isEmpty()) {
return toStringNoName();
}
return name;
@@ -62,7 +62,7 @@ public class RegisterNumber implements Serializable {
}
public String translate() {
if (name == null || name.trim().equals("")) {
if (name == null || name.trim().isEmpty()) {
return "_loc" + number + "_";
}
return name;
@@ -0,0 +1,583 @@
/*
* Copyright (C) 2010-2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.console;
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.ApplicationInfo;
import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.ConsoleAbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.EventListener;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame;
import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.Helper;
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Kernel32;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author JPEXS
*/
public class CommandLineArgumentParser {
private static boolean commandLineMode = false;
private static String[] commandlineConfigBoolean = new String[]{
"decompile",
"parallelSpeedUp",
"internalFlashViewer",
"autoDeobfuscate",
"cacheOnDisk"};
public static boolean isCommandLineMode() {
return commandLineMode;
}
public static void printCmdLineUsage() {
System.out.println("Commandline arguments:");
System.out.println(" 1) -help | --help | /?");
System.out.println(" ...shows commandline arguments (this help)");
System.out.println(" 2) infile");
System.out.println(" ...opens SWF file with the decompiler GUI");
System.out.println(" 3) -proxy (-PXXX)");
System.out.println(" ...auto start proxy in the tray. Optional parameter -P specifies port for proxy. Defaults to 55555. ");
System.out.println(" 4) -export (as|pcode|pcodehex|hex|image|shape|movie|sound|binaryData|text|textplain|all|all_as|all_pcode|all_pcodehex|all_hex) outdirectory infile [-selectas3class class1 class2 ...]");
System.out.println(" ...export infile sources to outdirectory as AsctionScript code (\"as\" argument) or as PCode (\"pcode\" argument), images, shapes, movies, binaryData, text with formatting, plain text or all.");
System.out.println(" When \"as\" or \"pcode\" type specified, optional \"-selectas3class\" parameter can be passed to export only selected classes (ActionScript 3 only)");
System.out.println(" 5) -dumpSWF infile");
System.out.println(" ...dumps list of SWF tags to console");
System.out.println(" 6) -compress infile outfile");
System.out.println(" ...Compress SWF infile and save it to outfile");
System.out.println(" 7) -decompress infile outfile");
System.out.println(" ...Decompress infile and save it to outfile");
System.out.println(" 8) -config key=value[,key2=value2][,key3=value3...] [other parameters]");
System.out.print(" ...Sets configuration values. Available keys[current setting]:");
for (String key : commandlineConfigBoolean) {
System.out.print(" " + key + "[" + Configuration.getConfig(key) + "]");
}
System.out.println("");
System.out.println(" Values are boolean, you can use 0/1, true/false, on/off or yes/no.");
System.out.println(" If no other parameters passed, configuration is saved. Otherwise it is used only once.");
System.out.println(" DO NOT PUT space between comma (,) and next value.");
System.out.println(" 9) -onerror (abort|retryN|ignore)");
System.out.println(" ...error handling mode. \"abort\" stops the exporting, \"retry\" tries the exporting N times, \"ignore\" ignores the current file");
System.out.println(" 10) -timeout N");
System.out.println(" ...decompilation timeout for a single method in AS3 or single action in AS1/2 in seconds");
System.out.println();
System.out.println("Examples:");
System.out.println("java -jar ffdec.jar myfile.swf");
System.out.println("java -jar ffdec.jar -proxy");
System.out.println("java -jar ffdec.jar -proxy -P1234");
System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf -selectas3class com.example.MyClass com.example.SecondClass");
System.out.println("java -jar ffdec.jar -export pcode \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -dumpSWF myfile.swf");
System.out.println("java -jar ffdec.jar -compress myfile.swf myfiledec.swf");
System.out.println("java -jar ffdec.jar -decompress myfiledec.swf myfile.swf");
System.out.println("java -jar ffdec.jar -onerror ignore -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -onerror retry 5 -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -config autoDeobfuscate=1,parallelSpeedUp=0 -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("");
System.out.println("Instead of \"java -jar ffdec.jar\" you can use ffdec.bat on Windows, ffdec.sh on Linux/MacOs");
}
/**
* Parses the console arguments
* @return path to the file which should be opened or null
*/
public static String parseArguments(String[] arguments) throws IOException {
Level traceLevel = Level.WARNING;
Queue<String> args = new LinkedList<>(Arrays.asList(arguments));
AbortRetryIgnoreHandler handler = null;
String nextParam;
OUTER:
while (true) {
nextParam = args.remove();
switch (nextParam) {
case "-config":
parseConfig(args);
if (args.isEmpty()) {
Configuration.saveConfig();
System.out.println("Configuration saved");
return null;
}
break;
case "-onerror":
handler = parseOnError(args);
break;
case "-timeout":
parseTimeout(args);
break;
case "-affinity":
parseAffinity(args);
break;
case "-priority":
parsePriority(args);
break;
case "-verbose":
traceLevel = Level.FINE;
break;
case "-debug":
Configuration.debugMode = true;
break;
default:
break OUTER;
}
if (args.isEmpty()) {
return null;
}
}
if (nextParam.equals("-removefromcontextmenu")) {
Main.addToContextMenu(false);
System.exit(0);
} else if (nextParam.equals("-addtocontextmenu")) {
Main.addToContextMenu(true);
System.exit(0);
} else if (nextParam.equals("-proxy")) {
parseProxy(args);
} else if (nextParam.equals("-export")) {
parseExport(args, handler, traceLevel);
} else if (nextParam.equals("-compress")) {
parseCompress(args);
} else if (nextParam.equals("-decompress")) {
parseDecompress(args);
} else if (nextParam.equals("-dumpSWF")) {
parseDumpSwf(args);
} else if (nextParam.equals("-help") || nextParam.equals("--help") || nextParam.equals("/?")) {
printHeader();
printCmdLineUsage();
System.exit(0);
} else if (args.size() == 1) {
return args.remove();
} else {
badArguments();
}
return null;
}
public static void printHeader() {
System.out.println(ApplicationInfo.applicationVerName);
for (int i = 0; i < ApplicationInfo.applicationVerName.length(); i++) {
System.out.print("-");
}
System.out.println();
}
public static void badArguments() {
System.err.println("Error: Bad Commandline Arguments!");
printCmdLineUsage();
System.exit(1);
}
private static void setConfigurations(String cfgStr) {
String[] cfgs;
if (cfgStr.contains(",")) {
cfgs = cfgStr.split(",");
} else {
cfgs = new String[]{cfgStr};
}
for (String c : cfgs) {
String[] cp;
if (c.contains("=")) {
cp = c.split("=");
} else {
cp = new String[]{c, "1"};
}
String key = cp[0];
String value = cp[1];
if (key.toLowerCase().equals("paralelSpeedUp".toLowerCase())) {
key = "parallelSpeedUp";
}
for (String bk : commandlineConfigBoolean) {
if (key.toLowerCase().equals(bk.toLowerCase())) {
Boolean bValue = parseBooleanConfigValue(value);
if (bValue != null) {
System.out.println("Config " + bk + " set to " + bValue);
Configuration.setConfig(bk, bValue);
}
}
}
}
}
private static Boolean parseBooleanConfigValue(String value) {
if (value == null) {
return null;
}
Boolean bValue = null;
value = value.toLowerCase();
if (value.equals("0") || value.equals("false") || value.equals("no") || value.equals("off")) {
bValue = false;
}
if (value.equals("1") || value.equals("true") || value.equals("yes") || value.equals("on")) {
bValue = true;
}
return bValue;
}
private static ExportMode strToExportFormat(String exportFormatStr) {
switch (exportFormatStr) {
case "pcode":
return ExportMode.PCODE;
case "pcodehex":
return ExportMode.PCODEWITHHEX;
case "hex":
return ExportMode.HEX;
default:
return ExportMode.SOURCE;
}
}
private static void parseConfig(Queue<String> args) {
if (args.isEmpty()) {
System.err.println("Config values expected");
badArguments();
}
setConfigurations(args.remove());
}
private static AbortRetryIgnoreHandler parseOnError(Queue<String> args) {
int errorMode = AbortRetryIgnoreHandler.UNDEFINED;
int retryCount = 0;
if (args.isEmpty()) {
System.err.println("onerror parameter expected");
badArguments();
}
String errorModeParameter = args.remove();
switch (errorModeParameter) {
case "abort":
errorMode = AbortRetryIgnoreHandler.ABORT;
break;
case "retry":
errorMode = AbortRetryIgnoreHandler.RETRY;
if (args.isEmpty()) {
System.err.println("onerror retry count parameter expected");
badArguments();
}
try {
retryCount = Integer.parseInt(args.remove());
} catch (NumberFormatException nex) {
System.err.println("Bad retry count number");
}
break;
case "ignore":
errorMode = AbortRetryIgnoreHandler.IGNORE;
break;
}
return new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount);
}
private static void parseTimeout(Queue<String> args) {
if (args.isEmpty()) {
System.err.println("timeout parameter expected");
badArguments();
}
try {
int timeout = Integer.parseInt(args.remove());
Configuration.setConfig("decompilationTimeoutSingleMethod", timeout);
} catch (NumberFormatException nex) {
System.err.println("Bad timeout value");
}
}
private static void parseAffinity(Queue<String> args) {
if (Platform.isWindows()) {
if (args.isEmpty()) {
System.err.println("affinity parameter expected");
badArguments();
}
try {
int affinityMask = Integer.parseInt(args.remove());
Kernel32.INSTANCE.SetProcessAffinityMask(Kernel32.INSTANCE.GetCurrentProcess(), affinityMask);
} catch (NumberFormatException nex) {
System.err.println("Bad affinityMask value");
}
} else {
System.err.println("Process affinity setting is only available on Windows platform.");
}
}
private static void parsePriority(Queue<String> args) {
if (Platform.isWindows()) {
if (args.isEmpty()) {
System.err.println("priority parameter expected");
badArguments();
}
String priority = args.remove();
int priorityClass = 0;
switch (priority) {
case "low":
priorityClass = Kernel32.IDLE_PRIORITY_CLASS;
break;
case "belownormal":
priorityClass = Kernel32.BELOW_NORMAL_PRIORITY_CLASS;
break;
case "normal":
priorityClass = Kernel32.NORMAL_PRIORITY_CLASS;
break;
case "abovenormal":
priorityClass = Kernel32.ABOVE_NORMAL_PRIORITY_CLASS;
break;
case "high":
priorityClass = Kernel32.HIGH_PRIORITY_CLASS;
break;
case "realtime":
priorityClass = Kernel32.REALTIME_PRIORITY_CLASS;
break;
default:
System.err.println("Bad affinityMask value");
}
if (priorityClass != 0) {
Kernel32.INSTANCE.SetPriorityClass(Kernel32.INSTANCE.GetCurrentProcess(), priorityClass);
}
} else {
System.err.println("Process priority setting is only available on Windows platform.");
}
}
private static void parseProxy(Queue<String> args) {
int port = 55555;
String portStr = args.peek();
if (portStr != null && portStr.startsWith("-P")) {
args.remove();
try {
port = Integer.parseInt(portStr.substring(2));
} catch (NumberFormatException nex) {
System.err.println("Bad port number");
}
}
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
if (Main.proxyFrame == null) {
Main.proxyFrame = new ProxyFrame();
}
}
});
Main.proxyFrame.setPort(port);
Main.addTrayIcon();
Main.switchProxy();
}
private static void parseExport(Queue<String> args, AbortRetryIgnoreHandler handler, Level traceLevel) {
if (args.size() < 3) {
badArguments();
}
String[] validExportFormats = new String[]{
"as",
"pcode",
"image",
"shape",
"movie",
"sound",
"binarydata",
"text",
"textplain",
"all",
"fla",
"xfl"
};
if (handler == null) {
handler = new ConsoleAbortRetryIgnoreHandler(AbortRetryIgnoreHandler.UNDEFINED, 0);
}
String exportFormat = args.remove().toLowerCase();
if (!Arrays.asList(validExportFormats).contains(exportFormat)) {
System.err.println("Invalid export format:" + exportFormat);
badArguments();
}
File outDir = new File(args.remove());
File inFile = new File(args.remove());
if (!inFile.exists()) {
System.err.println("Input SWF file does not exist!");
badArguments();
}
commandLineMode = true;
long startTime = System.currentTimeMillis();
boolean exportOK;
try {
printHeader();
SWF exfile = new SWF(new FileInputStream(inFile), Configuration.getConfig("parallelSpeedUp", true));
final Level level = traceLevel;
exfile.addEventListener(new EventListener() {
@Override
public void handleEvent(String event, Object data) {
if (level.intValue() <= Level.FINE.intValue() && event.equals("exporting")) {
System.out.println((String) data);
}
if (event.equals("exported")) {
System.out.println((String) data);
}
}
});
switch (exportFormat) {
case "all":
case "all_as":
case "all_pcode":
case "all_pcodehex":
case "all_hex":
ExportMode allExportMode = strToExportFormat(exportFormat.substring(3));
System.out.println("Exporting images...");
exfile.exportImages(handler, outDir.getAbsolutePath() + File.separator + "images");
System.out.println("Exporting shapes...");
exfile.exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes");
System.out.println("Exporting scripts...");
exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", allExportMode, Configuration.getConfig("parallelSpeedUp", true));
System.out.println("Exporting movies...");
exfile.exportMovies(handler, outDir.getAbsolutePath() + File.separator + "movies");
System.out.println("Exporting sounds...");
exfile.exportSounds(handler, outDir.getAbsolutePath() + File.separator + "sounds", true, true);
System.out.println("Exporting binaryData...");
exfile.exportBinaryData(handler, outDir.getAbsolutePath() + File.separator + "binaryData");
System.out.println("Exporting texts...");
exfile.exportTexts(handler, outDir.getAbsolutePath() + File.separator + "texts", true);
exportOK = true;
break;
case "image":
exfile.exportImages(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "shape":
exfile.exportShapes(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "as":
case "pcode":
case "pcodehex":
case "hex":
ExportMode exportMode = strToExportFormat(exportFormat);
boolean parallel = Configuration.getConfig("parallelSpeedUp", true);
if (!args.isEmpty() && args.peek().equals("-selectas3class")) {
args.remove();
exportOK = true;
while (!args.isEmpty()) {
exportOK = exportOK && exfile.exportAS3Class(args.remove(), outDir.getAbsolutePath(), exportMode, parallel);
}
} else {
exportOK = exfile.exportActionScript(handler, outDir.getAbsolutePath(), exportMode, parallel) != null;
}
break;
case "movie":
exfile.exportMovies(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "sound":
exfile.exportSounds(handler, outDir.getAbsolutePath(), true, true);
exportOK = true;
break;
case "binarydata":
exfile.exportBinaryData(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "text":
exfile.exportTexts(handler, outDir.getAbsolutePath(), true);
exportOK = true;
break;
case "textplain":
exfile.exportTexts(handler, outDir.getAbsolutePath(), false);
exportOK = true;
break;
case "fla":
exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true));
exportOK = true;
break;
case "xfl":
exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true));
exportOK = true;
break;
default:
exportOK = false;
}
} catch (OutOfMemoryError | Exception ex) {
exportOK = false;
System.err.print("FAIL: Exporting Failed on Exception - ");
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
System.exit(1);
}
long stopTime = System.currentTimeMillis();
long time = stopTime - startTime;
System.out.println("Export finished. Total export time: " + Helper.formatTimeSec(time));
if (exportOK) {
System.out.println("OK");
System.exit(0);
} else {
System.err.println("FAIL");
System.exit(1);
}
}
private static void parseCompress(Queue<String> args) throws FileNotFoundException {
if (args.size() < 2) {
badArguments();
}
if (SWF.fws2cws(new FileInputStream(args.remove()), new FileOutputStream(args.remove()))) {
System.out.println("OK");
} else {
System.err.println("FAIL");
}
}
private static void parseDecompress(Queue<String> args) throws FileNotFoundException {
if (args.size() < 2) {
badArguments();
}
if (SWF.decompress(new FileInputStream(args.remove()), new FileOutputStream(args.remove()))) {
System.out.println("OK");
System.exit(0);
} else {
System.err.println("FAIL");
System.exit(1);
}
}
private static void parseDumpSwf(Queue<String> args) {
if (args.isEmpty()) {
badArguments();
}
try {
Configuration.dump_tags = true;
Configuration.setConfig("parallelSpeedUp", false);
SWF swf = Main.parseSWF(args.remove());
} catch (Exception ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
System.exit(1);
}
System.exit(0);
}
}
@@ -269,7 +269,7 @@ public class EcmaScript {
}
if (o instanceof String) {
String s = (String) o;
return !s.equals("");
return !s.isEmpty();
}
return true; //other Object
}
@@ -289,7 +289,7 @@ public class EcmaScript {
return 0L;
}
Long posInt = (long) (double) (Math.signum(n) * Math.floor(Math.abs(n)));
posInt = posInt % (1 << 32);
posInt %= (1 << 32);
return posInt;
}
}
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.ApplicationInfo;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -77,7 +78,7 @@ public class AboutDialog extends AppDialog {
appNamePanel.setAlignmentX(0.5f);
cp.add(appNamePanel);
JLabel verLabel = new JLabel(translate("version") + " " + Main.version);
JLabel verLabel = new JLabel(translate("version") + " " + ApplicationInfo.version);
verLabel.setAlignmentX(0.5f);
//verLabel.setPreferredSize(new Dimension(300, 15));
verLabel.setFont(new Font("Tahoma", Font.BOLD, 15));
@@ -137,7 +138,7 @@ public class AboutDialog extends AppDialog {
cp.add(Box.createVerticalStrut(10));
LinkLabel wwwLabel = new LinkLabel(Main.projectPage);
LinkLabel wwwLabel = new LinkLabel(ApplicationInfo.projectPage);
wwwLabel.setAlignmentX(0.5f);
wwwLabel.setForeground(Color.blue);
//wwwLabel.setPreferredSize(new Dimension(300, 25));
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2013 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui;
/**
*
* @author JPEXS
*/
public class AdvancedSettingsDialog extends AppDialog {
/**
* Creates new form AdvancedSettingsDialog
*/
public AdvancedSettingsDialog() {
initComponents();
View.centerScreen(this);
View.setWindowIcon(this);
pack();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
@@ -47,7 +47,7 @@ public class GraphFrame extends AppFrame {
private int backLinksRight = 0;
private GraphPart head;
public GraphPanel(Graph graph) {
public GraphPanel(Graph graph) throws InterruptedException {
graph.init(new ArrayList<>());
size = getPartPositions(head = graph.heads.get(0), SPACE_VERTICAL + SPACE_VERTICAL + BLOCK_HEIGHT / 2, getPartWidth(graph.heads.get(0), new HashSet<GraphPart>()) * (BLOCK_WIDTH + SPACE_HORIZONTAL) / 2 - SPACE_HORIZONTAL, partPos, true);
backLinksLeft = 1;
@@ -240,7 +240,7 @@ public class GraphFrame extends AppFrame {
int frameWidthDiff;
int frameHeightDiff;
public GraphFrame(Graph graph, String name) {
public GraphFrame(Graph graph, String name) throws InterruptedException {
setSize(500, 500);
Container cnt = getContentPane();
cnt.setLayout(new BorderLayout());
@@ -36,7 +36,7 @@ import javax.swing.JColorChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
public final class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
public JLabel label = new JLabel();
public DrawableTag drawable;
@@ -197,7 +197,7 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener {
String search = searchField.getText();
List<CacheEntry> filtered = new ArrayList<>();
for (CacheEntry en : entries) {
if (search.equals("") || en.getRequestURL().contains(search)) {
if (search.isEmpty() || en.getRequestURL().contains(search)) {
filtered.add(en);
}
}
@@ -208,11 +208,11 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener {
String ret = en.getRequestURL();
//Strip parameters
if (ret.contains("?")) {
ret = ret.substring(0, ret.indexOf("?"));
ret = ret.substring(0, ret.indexOf('?'));
}
//Strip path
if (ret.contains("/")) {
ret = ret.substring(ret.lastIndexOf("/") + 1);
ret = ret.substring(ret.lastIndexOf('/') + 1);
}
return ret;
}
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.ApplicationInfo;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
@@ -65,7 +66,7 @@ public class LoadingDialog extends AppDialog implements ImageObserver {
*/
public LoadingDialog() {
setResizable(false);
setTitle(Main.shortApplicationVerName);
setTitle(ApplicationInfo.shortApplicationVerName);
Container cntp = getContentPane();
JPanel cnt = new JPanel();
cntp.setLayout(new BorderLayout());
@@ -16,16 +16,15 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.ApplicationInfo;
import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.ConsoleAbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.EventListener;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.Version;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.console.CommandLineArgumentParser;
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame;
import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.helpers.Cache;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.ProgressListener;
@@ -48,10 +47,7 @@ import java.awt.event.MouseEvent;
import java.io.*;
import java.net.Socket;
import java.net.URLDecoder;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Locale;
import java.util.Properties;
@@ -83,21 +79,11 @@ public class Main {
public static InputStream inputStream;
public static String fileTitle;
public static SWF swf;
public static String version = "";
public static final String applicationName = "JPEXS Free Flash Decompiler";
public static String applicationVerName;
public static final String shortApplicationName = "FFDec";
public static String shortApplicationVerName;
public static final String projectPage = "http://www.free-decompiler.com/flash";
public static String updatePageStub = "http://www.free-decompiler.com/flash/update.html?currentVersion=";
public static String updatePage;
public static final String vendor = "JPEXS";
public static LoadingDialog loadingDialog;
public static ModeFrame modeFrame;
private static boolean working = false;
private static TrayIcon trayIcon;
private static MenuItem stopMenuItem;
private static boolean commandLineMode = false;
public static MainFrame mainFrame;
private static final int UPDATE_SYSTEM_MAJOR = 1;
private static final int UPDATE_SYSTEM_MINOR = 0;
@@ -119,30 +105,6 @@ public class Main {
}
loadFromMemoryFrame.setVisible(true);
}
private static String[] commandlineConfigBoolean = new String[]{
"decompile",
"parallelSpeedUp",
"internalFlashViewer",
"autoDeobfuscate",
"cacheOnDisk"};
private static void loadProperties() {
Properties prop = new Properties();
try {
prop.load(Main.class.getResourceAsStream("/project.properties"));
version = prop.getProperty("version");
applicationVerName = applicationName + " v." + version;
updatePage = updatePageStub + version;
shortApplicationVerName = shortApplicationName + " v." + version;
} catch (IOException ex) {
//ignore
version = "unknown";
}
}
public static boolean isCommandLineMode() {
return commandLineMode;
}
/**
* Get title of the file
@@ -209,7 +171,7 @@ public class Main {
loadingDialog.setPercent(percent);
}
}
if (Main.isCommandLineMode()) {
if (CommandLineArgumentParser.isCommandLineMode()) {
System.out.println(name);
}
}
@@ -694,68 +656,6 @@ public class Main {
}
public static void badArguments() {
System.err.println("Error: Bad Commandline Arguments!");
printCmdLineUsage();
System.exit(1);
}
public static void printHeader() {
System.out.println(applicationVerName);
for (int i = 0; i < applicationVerName.length(); i++) {
System.out.print("-");
}
System.out.println();
}
public static void printCmdLineUsage() {
System.out.println("Commandline arguments:");
System.out.println(" 1) -help | --help | /?");
System.out.println(" ...shows commandline arguments (this help)");
System.out.println(" 2) infile");
System.out.println(" ...opens SWF file with the decompiler GUI");
System.out.println(" 3) -proxy (-PXXX)");
System.out.println(" ...auto start proxy in the tray. Optional parameter -P specifies port for proxy. Defaults to 55555. ");
System.out.println(" 4) -export (as|pcode|pcodehex|hex|image|shape|movie|sound|binaryData|text|textplain|all|all_as|all_pcode|all_pcodehex|all_hex) outdirectory infile [-selectas3class class1 class2 ...]");
System.out.println(" ...export infile sources to outdirectory as AsctionScript code (\"as\" argument) or as PCode (\"pcode\" argument), images, shapes, movies, binaryData, text with formatting, plain text or all.");
System.out.println(" When \"as\" or \"pcode\" type specified, optional \"-selectas3class\" parameter can be passed to export only selected classes (ActionScript 3 only)");
System.out.println(" 5) -dumpSWF infile");
System.out.println(" ...dumps list of SWF tags to console");
System.out.println(" 6) -compress infile outfile");
System.out.println(" ...Compress SWF infile and save it to outfile");
System.out.println(" 7) -decompress infile outfile");
System.out.println(" ...Decompress infile and save it to outfile");
System.out.println(" 8) -config key=value[,key2=value2][,key3=value3...] [other parameters]");
System.out.print(" ...Sets configuration values. Available keys[current setting]:");
for (String key : commandlineConfigBoolean) {
System.out.print(" " + key + "[" + Configuration.getConfig(key) + "]");
}
System.out.println("");
System.out.println(" Values are boolean, you can use 0/1, true/false, on/off or yes/no.");
System.out.println(" If no other parameters passed, configuration is saved. Otherwise it is used only once.");
System.out.println(" DO NOT PUT space between comma (,) and next value.");
System.out.println(" 9) -onerror (abort|retryN|ignore)");
System.out.println(" ...error handling mode. \"abort\" stops the exporting, \"retry\" tries the exporting N times, \"ignore\" ignores the current file");
System.out.println(" 10) -timeout N");
System.out.println(" ...decompilation timeout for a single method in AS3 or single action in AS1/2 in seconds");
System.out.println();
System.out.println("Examples:");
System.out.println("java -jar ffdec.jar myfile.swf");
System.out.println("java -jar ffdec.jar -proxy");
System.out.println("java -jar ffdec.jar -proxy -P1234");
System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -export as \"C:\\decompiled\\\" myfile.swf -selectas3class com.example.MyClass com.example.SecondClass");
System.out.println("java -jar ffdec.jar -export pcode \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -dumpSWF myfile.swf");
System.out.println("java -jar ffdec.jar -compress myfile.swf myfiledec.swf");
System.out.println("java -jar ffdec.jar -decompress myfiledec.swf myfile.swf");
System.out.println("java -jar ffdec.jar -onerror ignore -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -onerror retry 5 -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("java -jar ffdec.jar -config autoDeobfuscate=1,parallelSpeedUp=0 -export as \"C:\\decompiled\\\" myfile.swf");
System.out.println("");
System.out.println("Instead of \"java -jar ffdec.jar\" you can use ffdec.bat on Windows, ffdec.sh on Linux/MacOs");
}
private static void offerAssociation() {
boolean offered = Configuration.getConfig("offeredAssociation");
if (!offered) {
@@ -769,9 +669,7 @@ public class Main {
}
public static void initLang() {
if (Configuration.containsConfig("locale")) {
Locale.setDefault(Locale.forLanguageTag(Configuration.getConfig("locale", "en")));
}
Locale.setDefault(Locale.forLanguageTag(Configuration.getConfig("locale", "en")));
UIManager.put("OptionPane.okButtonText", AppStrings.translate("button.ok"));
UIManager.put("OptionPane.yesButtonText", AppStrings.translate("button.yes"));
UIManager.put("OptionPane.noButtonText", AppStrings.translate("button.no"));
@@ -889,15 +787,7 @@ public class Main {
*/
public static void main(String[] args) throws IOException {
startFreeMemThread();
loadProperties();
Configuration.loadFromFile(getConfigFile(), getReplacementsFile());
int pos = 0;
if (args.length > 0) {
if (args[0].equals("-debug")) {
Configuration.debugMode = true;
pos++;
}
}
Configuration.loadConfig();
initLogging(Configuration.debugMode);
initLang();
@@ -910,426 +800,20 @@ public class Main {
Cache.setStorageType(Cache.STORAGE_MEMORY);
}
int errorMode = AbortRetryIgnoreHandler.UNDEFINED;
int retryCount = 0;
Level traceLevel = Level.WARNING;
if (args.length < pos + 1) {
if (args.length == 0) {
initGui();
showModeFrame();
} else {
boolean parameterProcessed = true;
while (parameterProcessed) {
parameterProcessed = false;
if (args[pos].equals("-config")) {
parameterProcessed = true;
pos++;
if (args.length <= pos) {
System.err.println("Config values expected");
badArguments();
}
setConfigurations(args[pos]);
pos++;
if (args.length <= pos) {
saveConfig();
System.out.println("Configuration saved");
return;
}
} else if (args[pos].equals("-onerror")) {
parameterProcessed = true;
pos++;
if (args.length <= pos) {
System.err.println("onerror parameter expected");
badArguments();
}
String errorModeParameter = args[pos];
switch (errorModeParameter) {
case "abort":
errorMode = AbortRetryIgnoreHandler.ABORT;
break;
case "retry":
errorMode = AbortRetryIgnoreHandler.RETRY;
pos++;
if (args.length <= pos) {
System.err.println("onerror retry count parameter expected");
badArguments();
}
try {
retryCount = Integer.parseInt(args[pos]);
} catch (NumberFormatException nex) {
System.err.println("Bad retry count number");
}
break;
case "ignore":
errorMode = AbortRetryIgnoreHandler.IGNORE;
break;
}
pos++;
} else if (args[pos].equals("-timeout")) {
parameterProcessed = true;
pos++;
if (args.length <= pos) {
System.err.println("timeout parameter expected");
badArguments();
}
try {
int timeout = Integer.parseInt(args[pos]);
Configuration.setConfig("decompilationTimeoutSingleMethod", timeout);
} catch (NumberFormatException nex) {
System.err.println("Bad timeout value");
}
pos++;
} else if (args[pos].equals("-affinity")) {
parameterProcessed = true;
pos++;
if (Platform.isWindows()) {
if (args.length <= pos) {
System.err.println("affinity parameter expected");
badArguments();
}
try {
int affinityMask = Integer.parseInt(args[pos]);
Kernel32.INSTANCE.SetProcessAffinityMask(Kernel32.INSTANCE.GetCurrentProcess(), affinityMask);
} catch (NumberFormatException nex) {
System.err.println("Bad affinityMask value");
}
pos++;
} else {
System.err.println("Process affinity setting is only available on Windows platform.");
}
} else if (args[pos].equals("-priority")) {
parameterProcessed = true;
pos++;
if (Platform.isWindows()) {
if (args.length <= pos) {
System.err.println("priority parameter expected");
badArguments();
}
String priority = args[pos];
int priorityClass = 0;
switch (priority) {
case "low":
priorityClass = Kernel32.IDLE_PRIORITY_CLASS;
break;
case "belownormal":
priorityClass = Kernel32.BELOW_NORMAL_PRIORITY_CLASS;
break;
case "normal":
priorityClass = Kernel32.NORMAL_PRIORITY_CLASS;
break;
case "abovenormal":
priorityClass = Kernel32.ABOVE_NORMAL_PRIORITY_CLASS;
break;
case "high":
priorityClass = Kernel32.HIGH_PRIORITY_CLASS;
break;
case "realtime":
priorityClass = Kernel32.REALTIME_PRIORITY_CLASS;
break;
default:
System.err.println("Bad affinityMask value");
}
if (priorityClass != 0) {
Kernel32.INSTANCE.SetPriorityClass(Kernel32.INSTANCE.GetCurrentProcess(), priorityClass);
}
pos++;
} else {
System.err.println("Process priority setting is only available on Windows platform.");
}
} else if (args[pos].equals("-verbose")) {
parameterProcessed = true;
pos++;
traceLevel = Level.FINE;
}
}
if (args[pos].equals("-removefromcontextmenu")) {
addToContextMenu(false);
System.exit(0);
} else if (args[pos].equals("-addtocontextmenu")) {
addToContextMenu(true);
System.exit(0);
} else if (args[pos].equals("-proxy")) {
int port = 55555;
for (int i = pos; i < args.length; i++) {
if (args[i].startsWith("-P")) {
try {
port = Integer.parseInt(args[pos].substring(2));
} catch (NumberFormatException nex) {
System.err.println("Bad port number");
}
}
}
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
if (proxyFrame == null) {
proxyFrame = new ProxyFrame();
}
}
});
proxyFrame.setPort(port);
addTrayIcon();
switchProxy();
} else if (args[pos].equals("-export")) {
if (args.length < pos + 4) {
badArguments();
}
String[] validExportFormats = new String[]{
"as",
"pcode",
"image",
"shape",
"movie",
"sound",
"binarydata",
"text",
"textplain",
"all",
"fla",
"xfl"
};
AbortRetryIgnoreHandler handler = new ConsoleAbortRetryIgnoreHandler(errorMode, retryCount);
String exportFormat = args[pos + 1].toLowerCase();
if (!Arrays.asList(validExportFormats).contains(exportFormat)) {
System.err.println("Invalid export format:" + exportFormat);
badArguments();
}
File outDir = new File(args[pos + 2]);
File inFile = new File(args[pos + 3]);
if (!inFile.exists()) {
System.err.println("Input SWF file does not exist!");
badArguments();
}
commandLineMode = true;
long startTime = System.currentTimeMillis();
boolean exportOK;
try {
printHeader();
SWF exfile = new SWF(new FileInputStream(inFile), Configuration.getConfig("parallelSpeedUp", true));
final Level level = traceLevel;
exfile.addEventListener(new EventListener() {
@Override
public void handleEvent(String event, Object data) {
if (level.intValue() <= Level.FINE.intValue() && event.equals("exporting")) {
System.out.println((String) data);
}
if (event.equals("exported")) {
System.out.println((String) data);
}
}
});
switch (exportFormat) {
case "all":
case "all_as":
case "all_pcode":
case "all_pcodehex":
case "all_hex":
ExportMode allExportMode = strToExportFormat(exportFormat.substring(3));
System.out.println("Exporting images...");
exfile.exportImages(handler, outDir.getAbsolutePath() + File.separator + "images");
System.out.println("Exporting shapes...");
exfile.exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes");
System.out.println("Exporting scripts...");
exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", allExportMode, Configuration.getConfig("parallelSpeedUp", true));
System.out.println("Exporting movies...");
exfile.exportMovies(handler, outDir.getAbsolutePath() + File.separator + "movies");
System.out.println("Exporting sounds...");
exfile.exportSounds(handler, outDir.getAbsolutePath() + File.separator + "sounds", true, true);
System.out.println("Exporting binaryData...");
exfile.exportBinaryData(handler, outDir.getAbsolutePath() + File.separator + "binaryData");
System.out.println("Exporting texts...");
exfile.exportTexts(handler, outDir.getAbsolutePath() + File.separator + "texts", true);
exportOK = true;
break;
case "image":
exfile.exportImages(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "shape":
exfile.exportShapes(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "as":
case "pcode":
case "pcodehex":
case "hex":
ExportMode exportMode = strToExportFormat(exportFormat);
boolean parallel = Configuration.getConfig("parallelSpeedUp", true);
if ((pos + 5 < args.length) && (args[pos + 4].equals("-selectas3class"))) {
exportOK = true;
for (int i = pos + 5; i < args.length; i++) {
exportOK = exportOK && exfile.exportAS3Class(args[i], outDir.getAbsolutePath(), exportMode, parallel);
}
} else {
exportOK = exfile.exportActionScript(handler, outDir.getAbsolutePath(), exportMode, parallel) != null;
}
break;
case "movie":
exfile.exportMovies(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "sound":
exfile.exportSounds(handler, outDir.getAbsolutePath(), true, true);
exportOK = true;
break;
case "binarydata":
exfile.exportBinaryData(handler, outDir.getAbsolutePath());
exportOK = true;
break;
case "text":
exfile.exportTexts(handler, outDir.getAbsolutePath(), true);
exportOK = true;
break;
case "textplain":
exfile.exportTexts(handler, outDir.getAbsolutePath(), false);
exportOK = true;
break;
case "fla":
exfile.exportFla(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, Configuration.getConfig("parallelSpeedUp", true));
exportOK = true;
break;
case "xfl":
exfile.exportXfl(handler, outDir.getAbsolutePath(), inFile.getName(), applicationName, applicationVerName, version, Configuration.getConfig("parallelSpeedUp", true));
exportOK = true;
break;
default:
exportOK = false;
}
} catch (OutOfMemoryError | Exception ex) {
exportOK = false;
System.err.print("FAIL: Exporting Failed on Exception - ");
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
System.exit(1);
}
long stopTime = System.currentTimeMillis();
long time = stopTime - startTime;
System.out.println("Export finished. Total export time: " + Helper.formatTimeSec(time));
if (exportOK) {
System.out.println("OK");
System.exit(0);
} else {
System.err.println("FAIL");
System.exit(1);
}
} else if (args[pos].equals("-compress")) {
if (args.length < pos + 3) {
badArguments();
}
if (SWF.fws2cws(new FileInputStream(args[pos + 1]), new FileOutputStream(args[pos + 2]))) {
System.out.println("OK");
} else {
System.err.println("FAIL");
}
} else if (args[pos].equals("-decompress")) {
if (args.length < pos + 3) {
badArguments();
}
if (SWF.decompress(new FileInputStream(args[pos + 1]), new FileOutputStream(args[pos + 2]))) {
System.out.println("OK");
System.exit(0);
} else {
System.err.println("FAIL");
System.exit(1);
}
} else if (args[pos].equals("-dumpSWF")) {
if (args.length < pos + 2) {
badArguments();
}
try {
Configuration.dump_tags = true;
Configuration.setConfig("parallelSpeedUp", false);
SWF swf = parseSWF(args[pos + 1]);
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
System.exit(1);
}
System.exit(0);
} else if (args[pos].equals("-help") || args[pos].equals("--help") || args[pos].equals("/?")) {
printHeader();
printCmdLineUsage();
System.exit(0);
} else if (args.length == pos + 1) {
String fileToOpen = CommandLineArgumentParser.parseArguments(args);
if (fileToOpen != null) {
initGui();
openFile(args[pos]);
} else {
badArguments();
openFile(fileToOpen);
}
}
}
private static ExportMode strToExportFormat(String exportFormatStr) {
if (exportFormatStr.equals("pcode")) {
return ExportMode.PCODE;
} else if (exportFormatStr.equals("pcodehex")) {
return ExportMode.PCODEWITHHEX;
} else if (exportFormatStr.equals("hex")) {
return ExportMode.HEX;
} else {
return ExportMode.SOURCE;
}
}
private static void setConfigurations(String cfgStr) {
String[] cfgs;
if (cfgStr.contains(",")) {
cfgs = cfgStr.split(",");
} else {
cfgs = new String[]{cfgStr};
}
for (String c : cfgs) {
String[] cp;
if (c.contains("=")) {
cp = c.split("=");
} else {
cp = new String[]{c, "1"};
}
String key = cp[0];
String value = cp[1];
if (key.toLowerCase().equals("paralelSpeedUp".toLowerCase())) {
key = "parallelSpeedUp";
}
for (String bk : commandlineConfigBoolean) {
if (key.toLowerCase().equals(bk.toLowerCase())) {
Boolean bValue = parseBooleanConfigValue(value);
if (bValue != null) {
System.out.println("Config " + bk + " set to " + bValue);
Configuration.setConfig(bk, bValue);
}
}
}
}
}
private static Boolean parseBooleanConfigValue(String value) {
if (value == null) {
return null;
}
Boolean bValue = null;
value = value.toLowerCase();
if (value.equals("0") || value.equals("false") || value.equals("no") || value.equals("off")) {
bValue = false;
}
if (value.equals("1") || value.equals("true") || value.equals("yes") || value.equals("on")) {
bValue = true;
}
return bValue;
}
public static String tempFile(String url) throws IOException {
File f = new File(getFFDecHome() + "saved" + File.separator);
File f = new File(Configuration.getFFDecHome() + "saved" + File.separator);
if (!f.exists()) {
if (!f.mkdirs()) {
if (!f.exists()) {
@@ -1337,7 +821,7 @@ public class Main {
}
}
}
return getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
return Configuration.getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
}
@@ -1368,7 +852,7 @@ public class Main {
}
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(View.loadImage("proxy16"), vendor + " " + shortApplicationName + " " + AppStrings.translate("proxy"));
trayIcon = new TrayIcon(View.loadImage("proxy16"), ApplicationInfo.vendor + " " + ApplicationInfo.shortApplicationName + " " + AppStrings.translate("proxy"));
trayIcon.setImageAutoSize(true);
PopupMenu trayPopup = new PopupMenu();
@@ -1425,16 +909,8 @@ public class Main {
}
}
public static void saveConfig() {
try {
Configuration.saveToFile(getConfigFile(), getReplacementsFile());
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void exit() {
saveConfig();
Configuration.saveConfig();
FlashPlayerPanel.unload();
System.exit(0);
}
@@ -1443,6 +919,10 @@ public class Main {
(new AboutDialog()).setVisible(true);
}
public static void advancedSettings() {
(new AdvancedSettingsDialog()).setVisible(true);
}
public static void autoCheckForUpdates() {
Calendar lastUpdatesCheckDate = Configuration.getConfig("lastUpdatesCheckDate", null);
if ((lastUpdatesCheckDate == null) || (lastUpdatesCheckDate.getTime().getTime() < Calendar.getInstance().getTime().getTime() - 1000 * 60 * 60 * 24)) {
@@ -1454,7 +934,7 @@ public class Main {
try {
Socket sock = new Socket("www.free-decompiler.com", 80);
OutputStream os = sock.getOutputStream();
os.write(("GET /flash/update.html?action=check&currentVersion=" + version + " HTTP/1.1\r\nHost: www.free-decompiler.com\r\nUser-Agent: " + shortApplicationVerName + "\r\nConnection: close\r\n\r\n").getBytes());
os.write(("GET /flash/update.html?action=check&currentVersion=" + ApplicationInfo.version + " HTTP/1.1\r\nHost: www.free-decompiler.com\r\nUser-Agent: " + ApplicationInfo.shortApplicationVerName + "\r\nConnection: close\r\n\r\n").getBytes());
BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String s;
boolean start = false;
@@ -1478,8 +958,8 @@ public class Main {
}
} else {
if (s.contains("=")) {
String key = s.substring(0, s.indexOf("="));
String val = s.substring(s.indexOf("=") + 1);
String key = s.substring(0, s.indexOf('='));
String val = s.substring(s.indexOf('=') + 1);
if ("updateSystem".equals(header)) {
if (key.equals("majorVersion")) {
updateMajor = Integer.parseInt(val);
@@ -1514,8 +994,8 @@ public class Main {
ver.updateLink = val;
}
if (key.equals("change[]")) {
String changeType = val.substring(0, val.indexOf("|"));
String change = val.substring(val.indexOf("|") + 1);
String changeType = val.substring(0, val.indexOf('|'));
String change = val.substring(val.indexOf('|') + 1);
if (!ver.changes.containsKey(changeType)) {
ver.changes.put(changeType, new ArrayList<String>());
}
@@ -1526,7 +1006,7 @@ public class Main {
}
}
}
if (s.equals("")) {
if (s.isEmpty()) {
start = true;
}
}
@@ -1553,13 +1033,13 @@ public class Main {
logger.removeHandler(fileTxt);
}
try {
File f = new File(getFFDecHome() + File.separator + "log.txt");
File f = new File(Configuration.getFFDecHome() + File.separator + "log.txt");
FileOutputStream fos = new FileOutputStream(f);
fos.close();
} catch (IOException ex) {
}
try {
fileTxt = new FileHandler(getFFDecHome() + File.separator + "log.txt");
fileTxt = new FileHandler(Configuration.getFFDecHome() + File.separator + "log.txt");
} catch (IOException | SecurityException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -1590,97 +1070,6 @@ public class Main {
throw new RuntimeException("Problems with creating the log files");
}
}
private static final String CONFIG_NAME = "config.bin";
private static final String REPLACEMENTS_NAME = "replacements.cfg";
private static final File unspecifiedFile = new File("unspecified");
private static File directory = unspecifiedFile;
private enum OSId {
WINDOWS, OSX, UNIX
}
private static OSId getOSId() {
PrivilegedAction<String> doGetOSName = new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("os.name");
}
};
OSId id = OSId.UNIX;
String osName = AccessController.doPrivileged(doGetOSName);
if (osName != null) {
if (osName.toLowerCase().startsWith("mac os x")) {
id = OSId.OSX;
} else if (osName.contains("Windows")) {
id = OSId.WINDOWS;
}
}
return id;
}
public static String getFFDecHome() throws IOException {
if (directory == unspecifiedFile) {
directory = null;
String userHome = null;
try {
userHome = System.getProperty("user.home");
} catch (SecurityException ignore) {
}
if (userHome != null) {
String applicationId = Main.shortApplicationName;
OSId osId = getOSId();
if (osId == OSId.WINDOWS) {
File appDataDir = null;
try {
String appDataEV = System.getenv("APPDATA");
if ((appDataEV != null) && (appDataEV.length() > 0)) {
appDataDir = new File(appDataEV);
}
} catch (SecurityException ignore) {
}
String vendorId = Main.vendor;
if ((appDataDir != null) && appDataDir.isDirectory()) {
// ${APPDATA}\{vendorId}\${applicationId}
String path = vendorId + "\\" + applicationId + "\\";
directory = new File(appDataDir, path);
} else {
// ${userHome}\Application Data\${vendorId}\${applicationId}
String path = "Application Data\\" + vendorId + "\\" + applicationId + "\\";
directory = new File(userHome, path);
}
} else if (osId == OSId.OSX) {
// ${userHome}/Library/Application Support/${applicationId}
String path = "Library/Application Support/" + applicationId + "/";
directory = new File(userHome, path);
} else {
// ${userHome}/.${applicationId}/
String path = "." + applicationId + "/";
directory = new File(userHome, path);
}
}
}
if (!directory.exists()) {
if (!directory.mkdirs()) {
if (!directory.exists()) {
throw new IOException("cannot create directory " + directory);
}
}
}
String ret = directory.getAbsolutePath();
if (!ret.endsWith(File.separator)) {
ret += File.separator;
}
return ret;
}
private static String getReplacementsFile() throws IOException {
return getFFDecHome() + REPLACEMENTS_NAME;
}
private static String getConfigFile() throws IOException {
return getFFDecHome() + CONFIG_NAME;
}
public static boolean isAddedToContextMenu() {
if (!Platform.isWindows()) {
@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.ApplicationInfo;
import com.jpexs.decompiler.flash.Configuration;
import com.jpexs.decompiler.flash.FrameNode;
import com.jpexs.decompiler.flash.PackageNode;
@@ -231,7 +232,7 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationM
*
* @author Jindra
*/
public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed {
public final class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed {
private SWF swf;
public ABCPanel abcPanel;
@@ -340,7 +341,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
}
public void setWorkStatus(String s, Runnable cancelCallback) {
if (s.equals("")) {
if (s.isEmpty()) {
loadingPanel.setVisible(false);
} else {
loadingPanel.setVisible(true);
@@ -391,7 +392,6 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
JCommandButton reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16"));
assignListener(reloadCommandButton, "RELOAD");
editBand.addCommandButton(openCommandButton, RibbonElementPriority.TOP);
editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP);
editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.MEDIUM);
@@ -477,7 +477,6 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
miGotoMainClassOnStartup = new JCheckBox(translate("menu.settings.gotoMainClassOnStartup"));
//assignListener(miGotoMainClassOnStartup,"GOTODOCUMENTCLASSONSTARTUP");
settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation));
settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer));
settingsBand.addRibbonComponent(new JRibbonComponent(miParallelSpeedUp));
@@ -500,8 +499,15 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
JCommandButton setLanguageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.settings.language")), View.getResizableIcon("setlanguage32"));
assignListener(setLanguageCommandButton, "SETLANGUAGE");
languageBand.addCommandButton(setLanguageCommandButton, RibbonElementPriority.TOP);
RibbonTask settingsTask = new RibbonTask(translate("menu.settings"), settingsBand, languageBand);
JRibbonBand advancedSettingsBand = new JRibbonBand(translate("menu.advancedsettings.advancedsettings"), null);
advancedSettingsBand.setResizePolicies((List) Arrays.asList(new CoreRibbonResizePolicies.Mirror(advancedSettingsBand.getControlPanel()), new IconRibbonBandResizePolicy(advancedSettingsBand.getControlPanel())));
JCommandButton advancedSettingsCommandButton = new JCommandButton(fixCommandTitle(translate("menu.advancedsettings.advancedsettings")), View.getResizableIcon("settings16"));
assignListener(advancedSettingsCommandButton, "ADVANCEDSETTINGS");
advancedSettingsBand.addCommandButton(advancedSettingsCommandButton, RibbonElementPriority.MEDIUM);
RibbonTask settingsTask = new RibbonTask(translate("menu.settings"), settingsBand, languageBand, advancedSettingsBand);
//----------------------------------------- HELP -----------------------------------
@@ -568,10 +574,10 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
int state = 0;
if (maximizedHorizontal) {
state = state | JFrame.MAXIMIZED_HORIZ;
state |= JFrame.MAXIMIZED_HORIZ;
}
if (maximizedVertical) {
state = state | JFrame.MAXIMIZED_VERT;
state |= JFrame.MAXIMIZED_VERT;
}
setExtendedState(state);
@@ -617,7 +623,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
Main.exit();
}
});
setTitle(Main.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : ""));
setTitle(ApplicationInfo.applicationVerName + ((swf != null && Configuration.DISPLAY_FILENAME) ? " - " + Main.getFileTitle() : ""));
JMenuBar menuBar = new JMenuBar();
@@ -909,9 +915,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
files.clear();
File[] fs = ftemp.listFiles();
for (File f : fs) {
files.add(f);
}
files.addAll(Arrays.asList(fs));
Main.stopWork();
} catch (IOException ex) {
@@ -1873,7 +1877,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
return ret;
}
public void renameIdentifier(String identifier) {
public void renameIdentifier(String identifier) throws InterruptedException {
String oldName = identifier;
String newName = View.showInputDialog(translate("rename.enternew"), oldName);
if (newName != null) {
@@ -2183,7 +2187,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
ret.addAll(swf.exportTexts(handler, selFile + File.separator + "texts", texts, isFormatted));
ret.addAll(swf.exportMovies(handler, selFile + File.separator + "movies", movies));
ret.addAll(swf.exportSounds(handler, selFile + File.separator + "sounds", sounds, isMp3OrWav, isMp3OrWav));
ret.addAll(swf.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData));
ret.addAll(SWF.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData));
if (abcPanel != null) {
for (int i = 0; i < tlsList.size(); i++) {
ScriptPack tls = tlsList.get(i);
@@ -2313,6 +2317,9 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
Main.reloadSWF();
}
break;
case "ADVANCEDSETTINGS":
Main.advancedSettings();
break;
case "LOADMEMORY":
Main.loadFromMemory();
break;
@@ -2398,7 +2405,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
searchDialog.setVisible(true);
if (searchDialog.result) {
final String txt = searchDialog.searchField.getText();
if (!txt.equals("")) {
if (!txt.isEmpty()) {
if (abcPanel != null) {
(new Thread() {
@Override
@@ -2602,7 +2609,11 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
@Override
public void run() {
Main.startWork(translate("work.renaming") + "...");
renameIdentifier(identifier);
try {
renameIdentifier(identifier);
} catch (InterruptedException ex) {
Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
}
Main.stopWork();
}
}).start();
@@ -2636,7 +2647,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
break;
case "SAVEAS":
if (Main.saveFileDialog()) {
setTitle(Main.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
setTitle(ApplicationInfo.applicationVerName + (Configuration.DISPLAY_FILENAME ? " - " + Main.getFileTitle() : ""));
saveCommandButton.setEnabled(!Main.readOnly);
}
break;
@@ -2699,9 +2710,9 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
Helper.freeMem();
try {
if (compressed) {
swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true));
swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true));
} else {
swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, Configuration.getConfig("parallelSpeedUp", true));
swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(Main.file).getName(), ApplicationInfo.applicationName, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.getConfig("parallelSpeedUp", true));
}
} catch (IOException ex) {
View.showMessageDialog(null, translate("error.export") + ": " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
@@ -2718,11 +2729,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
export.setVisible(true);
if (!export.cancelled) {
JFileChooser chooser = new JFileChooser();
if (Configuration.containsConfig("lastExportDir")) {
chooser.setCurrentDirectory(new java.io.File(Configuration.getConfig("lastExportDir", ".")));
} else {
chooser.setCurrentDirectory(new File("."));
}
chooser.setCurrentDirectory(new File(Configuration.getConfig("lastExportDir", ".")));
chooser.setDialogTitle(translate("export.select.directory"));
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
@@ -2773,7 +2780,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
break;
case "HELPUS":
String helpUsURL = Main.projectPage + "/help_us.html";
String helpUsURL = ApplicationInfo.projectPage + "/help_us.html";
if (java.awt.Desktop.isDesktopSupported()) {
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
try {
@@ -2787,7 +2794,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
break;
case "HOMEPAGE":
String homePageURL = Main.projectPage;
String homePageURL = ApplicationInfo.projectPage;
if (java.awt.Desktop.isDesktopSupported()) {
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
try {
@@ -3229,8 +3236,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2;
mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2;
} else {
mat.translateX = mat.translateX + width / 2;
mat.translateY = mat.translateY + height / 2;
mat.translateX += width / 2;
mat.translateY += height / 2;
}
sos2.writeTag(new PlaceObject2Tag(null, false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null));
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.ApplicationInfo;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
@@ -61,7 +62,7 @@ public class ModeFrame extends AppFrame implements ActionListener {
cont.add(exitButton);
View.centerScreen(this);
View.setWindowIcon(this);
setTitle(Main.shortApplicationVerName);
setTitle(ApplicationInfo.shortApplicationVerName);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.ApplicationInfo;
import com.jpexs.decompiler.flash.Version;
import java.awt.Container;
import java.awt.Dimension;
@@ -115,7 +116,7 @@ public class NewVersionDialog extends AppDialog implements ActionListener {
java.net.URI uri = new java.net.URI(latestVersion.updateLink);
desktop.browse(uri);
} else {
java.net.URI uri = new java.net.URI(Main.updatePage);
java.net.URI uri = new java.net.URI(ApplicationInfo.updatePage);
desktop.browse(uri);
}
Main.exit();
@@ -126,7 +127,7 @@ public class NewVersionDialog extends AppDialog implements ActionListener {
}
}
if (desktop == null) {
View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", Main.shortApplicationName).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", Main.projectPage), translate("newversion"), JOptionPane.INFORMATION_MESSAGE);
View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.shortApplicationName).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", ApplicationInfo.projectPage), translate("newversion"), JOptionPane.INFORMATION_MESSAGE);
}
}
setVisible(false);
@@ -109,7 +109,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
public JLabel scriptNameLabel;
public boolean search(String txt, boolean ignoreCase, boolean regexp) {
if ((txt != null) && (!txt.equals(""))) {
if ((txt != null) && (!txt.isEmpty())) {
searchIgnoreCase = ignoreCase;
searchRegexp = regexp;
ClassesListTreeModel clModel = (ClassesListTreeModel) classTree.getModel();
@@ -19,10 +19,12 @@ package com.jpexs.decompiler.flash.gui.abc;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.UnknownInstructionCode;
import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph;
import com.jpexs.decompiler.flash.abc.avm2.parser.ASM3Parser;
import com.jpexs.decompiler.flash.abc.avm2.parser.MissingSymbolHandler;
import com.jpexs.decompiler.flash.abc.avm2.parser.ParseException;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.gui.GraphFrame;
import com.jpexs.decompiler.flash.gui.View;
@@ -38,6 +40,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
@@ -84,9 +88,11 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
setText(textWithHex);
} else {
if (textHexOnly == null) {
textHexOnly = new HilightedText(Helper.byteArrToString(abc.bodies[bodyIndex].code.getBytes()));
HilightedTextWriter writer = new HilightedTextWriter(true);
Helper.byteArrayToHex(writer, abc.bodies[bodyIndex].code.getBytes());
textHexOnly = new HilightedText(writer);
}
setText(textWithHex);
setText(textHexOnly);
}
hilighOffset(oldOffset);
}
@@ -156,8 +162,12 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
}
public void graph() {
AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, -1, -1, new HashMap<Integer, GraphTargetItem>(), new Stack<GraphTargetItem>(), new HashMap<Integer, String>(), new ArrayList<String>(), new HashMap<Integer, Integer>(), abc.bodies[bodyIndex].code.visitCode(abc.bodies[bodyIndex]));
(new GraphFrame(gr, name)).setVisible(true);
try {
AVM2Graph gr = new AVM2Graph(abc.bodies[bodyIndex].code, abc, abc.bodies[bodyIndex], false, -1, -1, new HashMap<Integer, GraphTargetItem>(), new Stack<GraphTargetItem>(), new HashMap<Integer, String>(), new ArrayList<String>(), new HashMap<Integer, Integer>(), abc.bodies[bodyIndex].code.visitCode(abc.bodies[bodyIndex]));
(new GraphFrame(gr, name)).setVisible(true);
} catch (InterruptedException ex) {
Logger.getLogger(ASMSourceEditorPane.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void exec() {
@@ -170,30 +180,44 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
public boolean save(ConstantPool constants) {
try {
AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(getText().getBytes("UTF-8")), constants, trait, new MissingSymbolHandler() {
//no longer ask for adding new constants
@Override
public boolean missingString(String value) {
return true;
String text = getText();
if (text.trim().startsWith("#hexdata")) {
byte[] data = Helper.getBytesFromHexaText(text);
MethodBody mb = abc.bodies[bodyIndex];
mb.codeBytes = data;
try {
mb.code = new AVM2Code(new ByteArrayInputStream(mb.codeBytes));
} catch (UnknownInstructionCode re) {
mb.code = new AVM2Code();
Logger.getLogger(ABC.class.getName()).log(Level.SEVERE, null, re);
}
mb.code.compact();
} else {
AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(text.getBytes("UTF-8")), constants, trait, new MissingSymbolHandler() {
//no longer ask for adding new constants
@Override
public boolean missingString(String value) {
return true;
}
@Override
public boolean missingInt(long value) {
return true;
}
@Override
public boolean missingInt(long value) {
return true;
}
@Override
public boolean missingUInt(long value) {
return true;
}
@Override
public boolean missingUInt(long value) {
return true;
}
@Override
public boolean missingDouble(double value) {
return true;
}
}, abc.bodies[bodyIndex], abc.method_info[abc.bodies[bodyIndex].method_info]);
acode.getBytes(abc.bodies[bodyIndex].codeBytes);
abc.bodies[bodyIndex].code = acode;
@Override
public boolean missingDouble(double value) {
return true;
}
}, abc.bodies[bodyIndex], abc.method_info[abc.bodies[bodyIndex].method_info]);
acode.getBytes(abc.bodies[bodyIndex].codeBytes);
abc.bodies[bodyIndex].code = acode;
}
} catch (IOException ex) {
} catch (ParseException ex) {
View.showMessageDialog(this, (ex.text + " on line " + ex.line));
@@ -35,7 +35,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
public class ClassesListTree extends JTree implements TreeSelectionListener {
public final class ClassesListTree extends JTree implements TreeSelectionListener {
private List<ABCContainerTag> abcList;
public List<MyEntry<ClassPath, ScriptPack>> treeList;
@@ -91,7 +91,7 @@ public class ClassesListTreeModel implements TreeModel {
public ClassesListTreeModel(List<MyEntry<ClassPath, ScriptPack>> list, String filter) {
for (MyEntry<ClassPath, ScriptPack> item : list) {
if (filter != null) {
if (!filter.equals("")) {
if (!filter.isEmpty()) {
if (!item.key.toString().contains(filter)) {
continue;
}
@@ -108,14 +108,12 @@ public class MethodCodePanel extends JPanel implements ActionListener {
hexButton.setToolTipText(AppStrings.translate("button.viewhex"));
hexButton.setMargin(new Insets(3, 3, 3, 3));
// todo: find icon, and set visible
// todo: find icon
hexOnlyButton = new JToggleButton(View.getIcon("hex16"));
hexOnlyButton.setActionCommand("HEXONLY");
hexOnlyButton.addActionListener(this);
hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex"));
hexOnlyButton.setMargin(new Insets(3, 3, 3, 3));
hexOnlyButton.setVisible(false);
buttonsPanel.add(graphButton);
buttonsPanel.add(hexButton);
@@ -137,6 +135,11 @@ public class MethodCodePanel extends JPanel implements ActionListener {
}
if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) {
if (e.getActionCommand().equals("HEX")) {
hexOnlyButton.setSelected(false);
} else {
hexButton.setSelected(false);
}
sourceTextArea.setHex(getExportMode(), false);
}
}
@@ -148,10 +151,10 @@ public class MethodCodePanel extends JPanel implements ActionListener {
}
public void setEditMode(boolean val) {
ExportMode exportMode = getExportMode();
if (val) {
sourceTextArea.setHex(ExportMode.PCODE, false);
sourceTextArea.setHex(exportMode == ExportMode.HEX ? ExportMode.HEX : ExportMode.PCODE, false);
} else {
ExportMode exportMode = getExportMode();
if (exportMode != ExportMode.PCODE) {
sourceTextArea.setHex(exportMode, false);
}
@@ -101,7 +101,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener {
for (int i = 0; i < accessStrings.length; i++) {
String pref = Namespace.kindToPrefix(modifiers[i]);
String name = Namespace.kindToStr(modifiers[i]);
accessStrings[i] = (pref.equals("") ? "" : pref + " ") + "(" + name + ")";
accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")";
}
@@ -162,7 +162,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener {
public void actionPerformed(ActionEvent e) {
switch (e.getActionCommand()) {
case "OK":
if (nameField.getText().trim().equals("")) {
if (nameField.getText().trim().isEmpty()) {
View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
return;
}
@@ -25,7 +25,7 @@ import java.util.List;
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
public class TraitsListModel implements ListModel {
public final class TraitsListModel implements ListModel {
private List<TraitsListItem> items;
private List<ABCContainerTag> abcTags;
@@ -53,14 +53,12 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.logging.Level;
@@ -208,10 +206,10 @@ public class ActionPanel extends JPanel implements ActionListener {
}
public boolean search(String txt, boolean ignoreCase, boolean regexp) {
if ((txt != null) && (!txt.equals(""))) {
if ((txt != null) && (!txt.isEmpty())) {
searchIgnoreCase = ignoreCase;
searchRegexp = regexp;
List<TagNode> list = Main.swf.createASTagList(Main.swf.tags, null);
List<TagNode> list = SWF.createASTagList(Main.swf.tags, null);
Map<String, ASMSource> asms = getASMs("", list);
found = new ArrayList<>();
Pattern pat = null;
@@ -293,7 +291,7 @@ public class ActionPanel extends JPanel implements ActionListener {
public void setHex(ExportMode exportMode) {
if (exportMode != ExportMode.HEX) {
if (exportMode == exportMode.PCODE) {
if (exportMode == ExportMode.PCODE) {
if (srcNoHex == null) {
srcNoHex = getHilightedText(exportMode);
}
@@ -306,7 +304,9 @@ public class ActionPanel extends JPanel implements ActionListener {
}
} else {
if (srcHexOnly == null) {
srcHexOnly = new HilightedText(Helper.byteArrToString(src.getActionBytes()));
HilightedTextWriter writer = new HilightedTextWriter(true);
Helper.byteArrayToHex(writer, src.getActionBytes());
srcHexOnly = new HilightedText(writer);
}
setText(srcHexOnly);
}
@@ -443,13 +443,12 @@ public class ActionPanel extends JPanel implements ActionListener {
hexButton.setToolTipText(AppStrings.translate("button.viewhex"));
hexButton.setMargin(new Insets(3, 3, 3, 3));
// todo: find icon, and set visible
// todo: find icon
hexOnlyButton = new JToggleButton(View.getIcon("hex16"));
hexOnlyButton.setActionCommand("HEXONLY");
hexOnlyButton.addActionListener(this);
hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex"));
hexOnlyButton.setMargin(new Insets(3, 3, 3, 3));
//hexOnlyButton.setVisible(false);
topButtonsPan = new JPanel();
topButtonsPan.setLayout(new BoxLayout(topButtonsPan, BoxLayout.X_AXIS));
@@ -618,8 +617,7 @@ public class ActionPanel extends JPanel implements ActionListener {
}
public void setEditMode(boolean val) {
// todo: create UI for editing raw data
final boolean rawEdit = false;
boolean rawEdit = hexOnlyButton.isSelected();
if (val) {
setText(rawEdit ? srcHexOnly : srcNoHex);
@@ -630,7 +628,7 @@ public class ActionPanel extends JPanel implements ActionListener {
editor.getCaret().setVisible(true);
asmLabel.setIcon(View.getIcon("editing16"));
} else {
setText(hexButton.isSelected() ? srcWithHex : srcNoHex);
setHex(getExportMode());
editor.setEditable(false);
saveButton.setVisible(false);
editButton.setVisible(true);
@@ -702,54 +700,73 @@ public class ActionPanel extends JPanel implements ActionListener {
foundPos = (foundPos + 1) % found.size();
updateSearchPos();
}
if (e.getActionCommand().equals("GRAPH")) {
if (lastCode != null) {
GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), SWF.DEFAULT_VERSION), "");
gf.setVisible(true);
}
} else if (e.getActionCommand().equals("EDITACTION")) {
setEditMode(true);
} else if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) {
setHex(getExportMode());
} else if (e.getActionCommand().equals("CANCELACTION")) {
setEditMode(false);
setHex(getExportMode());
} else if (e.getActionCommand().equals("SAVEACTION")) {
try {
String text = editor.getText();
if (text.trim().startsWith("#hexdata")) {
src.setActionBytes(getBytesFromHexaText(text));
} else {
src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION);
switch (e.getActionCommand()) {
case "GRAPH":
if (lastCode != null) {
try {
GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), SWF.DEFAULT_VERSION), "");
gf.setVisible(true);
} catch (InterruptedException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
setSource(this.src, false);
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
editor.setEditable(false);
editMode = false;
} catch (IOException ex) {
} catch (ParseException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
} else if (e.getActionCommand().equals("EDITDECOMPILED")) {
setDecompiledEditMode(true);
} else if (e.getActionCommand().equals("CANCELDECOMPILED")) {
setDecompiledEditMode(false);
} else if (e.getActionCommand().equals("SAVEDECOMPILED")) {
try {
ActionScriptParser par = new ActionScriptParser();
src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION);
setSource(this.src, false);
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
break;
case "EDITACTION":
setEditMode(true);
break;
case "HEX":
case "HEXONLY":
if (e.getActionCommand().equals("HEX")) {
hexOnlyButton.setSelected(false);
} else {
hexButton.setSelected(false);
}
setHex(getExportMode());
break;
case "CANCELACTION":
setEditMode(false);
setHex(getExportMode());
break;
case "SAVEACTION":
try {
String text = editor.getText();
if (text.trim().startsWith("#hexdata")) {
src.setActionBytes(Helper.getBytesFromHexaText(text));
} else {
src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION);
}
setSource(this.src, false);
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
editor.setEditable(false);
editMode = false;
} catch (IOException ex) {
} catch (ParseException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
break;
case "EDITDECOMPILED":
setDecompiledEditMode(true);
break;
case "CANCELDECOMPILED":
setDecompiledEditMode(false);
} catch (IOException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex);
} catch (ParseException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
break;
case "SAVEDECOMPILED":
try {
ActionScriptParser par = new ActionScriptParser();
src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION);
setSource(this.src, false);
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
setDecompiledEditMode(false);
} catch (IOException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex);
} catch (ParseException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
break;
}
}
@@ -759,26 +776,6 @@ public class ActionPanel extends JPanel implements ActionListener {
return exportMode;
}
public byte[] getBytesFromHexaText(String text) {
Scanner scanner = new Scanner(text);
scanner.nextLine(); // ignore first line
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
if (line.startsWith(";")) {
continue;
}
line = line.replace(" ", "");
for (int i = 0; i < line.length() / 2; i++) {
String hexStr = line.substring(i * 2, (i + 1) * 2);
byte b = (byte) Integer.parseInt(hexStr, 16);
baos.write(b);
}
}
byte[] data = baos.toByteArray();
return data;
}
public void updateSearchPos() {
searchPos.setText((foundPos + 1) + "/" + found.size());
setSource(found.get(foundPos), true);
Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

@@ -0,0 +1,15 @@
# Copyright (C) 2013 JPEXS
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -31,7 +31,9 @@ sounds.flv = FLV (Solo audio)
actionscript = ActionScript
actionscript.as = AS
actionscript.pcode = PCODE
actionscript.pcode = P-code
actionscript.pcodehex = P-code con Hexadecimal
actionscript.hex = Hexadecimal
dialog.title = Exportar...
@@ -279,6 +279,7 @@ FileChooser.updateButtonText = Update
FileChooser.updateButtonToolTipText = Update directory listing
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = Details
FileChooser.detailsViewButtonToolTip.textAndMnemonic = Details
FileChooser.fileAttrHeader.textAndMnemonic = Attributes
@@ -320,6 +321,7 @@ button.ignore = Ignore
font.source = Source Font:
#after version 1.6.7:
menu.export = Export
menu.general = General
menu.language = Language
@@ -332,6 +334,7 @@ error.font.nocharacter = Selected source font does not contain character "%char%
warning.initializers = Static fields and consts are often initialized in initializers.\nEditing value here is usually not enough!
#after version 1.7.0u1:
menu.tools.searchmemory = Search SWFs in memory
menu.file.reload = Reload
message.confirm.reload = This action cancels all unsaved changes and reloads the SWF file again.\nDo you want to continue?
@@ -348,6 +351,7 @@ ColorChooser.swatchesRecentText = Recent:
ColorChooser.sampleText=Sample Text Sample Text
#after version 1.7.1:
preview.play = Play
preview.pause = Pause
preview.stop = Stop
@@ -357,6 +361,7 @@ message.confirm.removemultiple = Are you sure you want to remove %count% items\n
menu.tools.searchcache = Search browsers cache
#after version 1.7.2u2
error.trait.exists = Trait with name "%name%" already exists.
button.addtrait = Add trait
button.font.embed = Embed...
@@ -368,3 +373,4 @@ filter.gfx = ScaleForm GFx files (*.gfx)
filter.supported = All supported filetypes (*.swf, *.gfx)
work.canceled = Canceled
work.restoringControlFlow = Restoring control flow
menu.advancedsettings.advancedsettings = Advanced Settings
@@ -22,7 +22,6 @@ menu.file.export.all = Exportovat v\u0161e
menu.file.export.selection = Exportovat vybran\u00e9
menu.file.exit = Ukon\u010dit
menu.tools = N\u00e1stroje
menu.tools.searchas = Prohledat ActionScript...
menu.tools.proxy = Proxy
@@ -32,7 +31,6 @@ menu.tools.deobfuscation.globalrename = Glob\u00e1ln\u011b p\u0159ejmenovat iden
menu.tools.deobfuscation.renameinvalid = P\u0159ejmenovat neplatn\u00e9 identifik\u00e1tory
menu.tools.gotodocumentclass = P\u0159ej\u00edt na hlavn\u00ed t\u0159\u00eddu dokumentu
menu.settings = Nastaven\u00ed
menu.settings.autodeobfuscation = Automatick\u00e1 deobfuskace
menu.settings.internalflashviewer = Pou\u017e\u00edvat vlastn\u00ed prohl\u00ed\u017ee\u010d Flashe
@@ -93,7 +91,6 @@ message.confirm.autodeobfuscate = Automatick\u00e1 deobfuskace je zp\u016fsob ja
message.parallel = parallelismus
message.trait.saved = Vlastnost \u00fasp\u011b\u0161n\u011b ulo\u017eena
message.constant.new.string = \u0158et\u011bzec "%value%" neexistuje v tabulce konstant. Chcete ho p\u0159idat?
message.constant.new.string.title = P\u0159idat \u0158et\u011bzec
message.constant.new.integer = Cel\u00e9 \u010d\u00edslo "%value%" neexistuje v tabulce konstant. Chcete ho p\u0159idat?
@@ -121,7 +118,6 @@ work.buildingscripttree = Vytv\u00e1\u0159en\u00ed stromu skript\u016f
work.deobfuscating.complete = Deobfuskace kompletn\u00ed
message.search.notfound = \u0158et\u011bzec "%searchtext%" nenalezen.
message.search.notfound.title = Nenalezeno
@@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = Typ a Hodnota:
error.slotconst.typevalue = Chyba typu a hodnoty SlotConst
message.autofill.failed = Nelze z\u00edskat statistiky k\u00f3du pro automatick\u00e9 parametry body.\r\nOd\u0161krtn\u011bte automatick\u00e9 vypl\u0148ov\u00e1n\u00ed pro zamezen\u00ed t\u00e9to zpr\u00e1vy.
info.selecttrait = Vyberte t\u0159\u00eddu a klikn\u011bte na vlastnost v zdrojov\u00e9m ActionScriptu pro \u00fapravy.
@@ -284,6 +279,7 @@ FileChooser.updateButtonText = Obnoven\u00ed
FileChooser.updateButtonToolTipText = Obnoven\u00ed v\u00fdpisu adres\u00e1\u0159e
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = Detaily
FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detaily
FileChooser.fileAttrHeader.textAndMnemonic = Vlastnosti
@@ -325,6 +321,7 @@ button.ignore = Ignorovat
font.source = Zdrojov\u00e9 p\u00edsmo:
#after version 1.6.7:
menu.export = Export
menu.general = Hlavn\u00ed
menu.language = Jazyk
@@ -337,6 +334,7 @@ error.font.nocharacter = Vybran\u00e9 zdrojov\u00e9 p\u00edsmo neobsahuje znak "
warning.initializers = Statick\u00e9 atributy a konstanty jsou \u010dasto inicializov\u00e1ny pomoc\u00ed inicializ\u00e1tor\u016f.\nPokud to uprav\u00edte zde, obvykle to nesta\u010d\u00ed!
#after version 1.7.0u1:
menu.tools.searchmemory = Hledat SWF v pam\u011bti
menu.file.reload = Znovu na\u010d\u00edst
message.confirm.reload = Tato akce zru\u0161\u00ed v\u0161echny neulo\u017een\u00e9 zm\u011bny a znovu na\u010dte SWF soubor.\nChcete pokra\u010dovat?
@@ -353,6 +351,7 @@ ColorChooser.swatchesRecentText = Ned\u00e1vn\u00e9:
ColorChooser.sampleText=Vzorov\u00fd Text Vzorov\u00fd Text
#after version 1.7.1:
preview.play = P\u0159ehr\u00e1t
preview.pause = Pauza
preview.stop = Zastavit
@@ -362,6 +361,7 @@ message.confirm.removemultiple = Opravdu chcete odebrat %count% polo\u017eek\n a
menu.tools.searchcache = Prohledat cache prohl\u00ed\u017ee\u010d\u016f
#after version 1.7.2u2
error.trait.exists = Vlastnost s n\u00e1zvem "%name%" ji\u017e existuje.
button.addtrait = P\u0159idat vlastnost
button.font.embed = Vlo\u017eit...
@@ -280,6 +280,7 @@ FileChooser.updateButtonText = Aktualisieren
FileChooser.updateButtonToolTipText = Ordner Aktualisieren
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = Details
FileChooser.detailsViewButtonToolTip.textAndMnemonic = Details
FileChooser.fileAttrHeader.textAndMnemonic = Attribute
@@ -321,6 +322,7 @@ button.ignore = Ignorieren
font.source = Quellschriftart:
#after version 1.6.7:
menu.export = Export
menu.general = Generell
menu.language = Sprache
@@ -333,6 +335,7 @@ error.font.nocharacter = Die ausgew\u00e4hlte Quellschriftart beinhaltet den Buc
warning.initializers = Statische Felder und Konstanten sind h\u00e4uftig in Initializer initailisiert.\nDen Wert hier zu bearbeiten ist meistens nicht genug!
#after version 1.7.0u1:
menu.tools.searchmemory = SWFs Dateien im Speicher suchen
menu.file.reload = Erneut laden
message.confirm.reload = Diese Aktion bricht alle nicht gespeicherten \u00c4nderungen ab und l\u00e4dt die Datei erneut.\nWollen Sie fortfahren?
@@ -349,6 +352,7 @@ ColorChooser.swatchesRecentText = Letzte:
ColorChooser.sampleText=Beispieltext Beispieltext
#after version 1.7.1:
preview.play = Start
preview.pause = Pause
preview.stop = Stopp
@@ -358,6 +362,7 @@ message.confirm.removemultiple = Wollen sie wirklich %count% Elemente entfernen\
menu.tools.searchcache = Browsercache suchen
#after version 1.7.2u2
error.trait.exists = Eigenschaft mit dem Namen "%name%" existiert bereits.
button.addtrait = Eigenschaft hinzuf\u00fcgen
button.font.embed = Eingebettet...
@@ -22,7 +22,6 @@ menu.file.export.all = Exportar todas las partes
menu.file.export.selection = Exportar selecci\u00f3n
menu.file.exit = Salir
menu.tools = Herramientas
menu.tools.searchas = Buscar todo el ActionScript...
menu.tools.proxy = Proxy
@@ -92,7 +91,6 @@ message.confirm.autodeobfuscate = La desofuscaci\u00f3n autom\u00e1tica es una m
message.parallel = Paralelismo
message.trait.saved = Rasgo guardado existosamente
message.constant.new.string = La cadena "%value%" no est\u00e1 presente en la tabla de constantes. Desea agregarla?
message.constant.new.string.title = Agregar cadena
message.constant.new.integer = El entero "%value%" no est\u00e1 presente en la tabla de constantes. Desea agregarlo?
@@ -120,7 +118,6 @@ work.buildingscripttree = Generando \u00e1rbol de script Building script tree
work.deobfuscating.complete = Desofuscaci\u00f3n completada
message.search.notfound = Cadena "%searchtext%" no encontrada.
message.search.notfound.title = No encontrado
@@ -187,7 +184,6 @@ abc.detail.methodinfo.returnvalue = Tipo de valor de retorno:
error.methodinfo.params = Error de pa\u0155ametro MethodInfo
error.methodinfo.returnvalue = Error de retorno de tipo MethodInfo
abc.detail.methodinfo = MethodInfo
abc.detail.body.code = C\u00f3digo de MethodBody
abc.detail.body.params = Par\u00e1metros de MethodBody
@@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = Tipo y valor:
error.slotconst.typevalue = Error de valor de tipo SlotConst
message.autofill.failed = No se puede obtener las estad\u00edsticas de c\u00f3digo para los par\u00e1metros de cuerpo autom\u00e1ticos.\r\nDestilde auto-llenado para evitar este mensaje.
info.selecttrait = Seleccione la clase y clickee un atributo en el c\u00f3digo Actionscript para editarlo.
@@ -248,7 +243,7 @@ FileChooser.openButtonToolTipText = Abrir
FileChooser.lookInLabelText = Mirar en:
FileChooser.acceptAllFileFilterText = Todos los archivos
FileChooser.filesOfTypeLabelText = Archivos de tipo:
FileChooser.fileNameLabelText = Nombre del archivo:
FileChooser.fileNameLabelText = Nombre de archivo:
FileChooser.listViewButtonToolTipText = Lista
FileChooser.listViewButtonAccessibleName = Lista
FileChooser.detailsViewButtonToolTipText = Detales
@@ -267,7 +262,6 @@ FileChooser.directoryDescriptionText = Directorio
FileChooser.directoryOpenButtonText = Abrir
FileChooser.directoryOpenButtonToolTipText = Abrir el directorio seleccionado
FileChooser.fileDescriptionText = Archivo gen\u00e9rico
FileChooser.fileNameLabelText = Nombre de archivo:
FileChooser.helpButtonText = Ayuda
FileChooser.helpButtonToolTipText = Ayuda de FileChooser
FileChooser.newFolderAccessibleName = Nueva carpeta
@@ -285,6 +279,7 @@ FileChooser.updateButtonText = Actualizar
FileChooser.updateButtonToolTipText = Actualizar listado de directorio
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = Detalles
FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detalles
FileChooser.fileAttrHeader.textAndMnemonic = Atributos
@@ -318,7 +313,6 @@ FileChooser.fileSizeMegaBytes = {0} MB
FileChooser.fileSizeGigaBytes = {0} GB
FileChooser.folderNameLabelText = Nombre de carpeta:
error.occured = Ocurri\u00f3 un error : %error%
button.abort = Abortar
button.retry = Reintentar
@@ -327,6 +321,7 @@ button.ignore = Ignorar
font.source = Origen de la fuente:
#after version 1.6.7:
menu.export = Exportar
menu.general = General
menu.language = Lenguaje
@@ -345,7 +340,8 @@ message.confirm.reload = Esta acci\u00f3n eliminar\u00e1 todos lo cambios no gua
dialog.selectcolor.title = Seleccionar color de fondo para la visualizaci\u00f3n del SWF
button.selectcolor.hint = Seleccionar color de fondo
ColorChooser.okText = OK
ColorChooser.okText = OK
ColorChooser.cancelText = Cancelar
ColorChooser.resetText = Reiniciar
ColorChooser.previewText = Vista previa
@@ -353,15 +349,18 @@ ColorChooser.swatchesNameText = Muestras
ColorChooser.swatchesRecentText = Reciente:
ColorChooser.sampleText=Texto de muestra Texto de muestra
#after version 1.7.1:
#after version 1.7.1:
preview.play = Reproducir
preview.pause = Pausar
preview.stop = Detener
message.confirm.removemultiple = Est\u00e1 seguro que desea eliminar %count% art\u00edculos\n y todos los objetos que dependen de el?
menu.tools.searchcache = Buscar cache del navegador
#after version 1.7.2u2
error.trait.exists = La caracter\u00edstica con nombre "%name%" ya existe.
button.addtrait = Agregar caracter\u00edstica
button.font.embed = Incrustar...
@@ -371,8 +370,6 @@ message.font.add.exists = El caracter %char% ya existe en la etiqueta de la fuen
filter.gfx = Archivos ScaleForm GFx (*.gfx)
filter.supported = Todos los tipos de archivo soportados (*.swf, *.gfx)
actionscript.pcode = P-code
actionscript.pcodehex = P-code con Hexadecimal
actionscript.hex = Hexadecimal
work.canceled = Cancelado
work.restoringControlFlow = Restaurando control de flujo
@@ -22,7 +22,6 @@ menu.file.export.all = Minden r\u00e9sz export\u00e1l\u00e1sa
menu.file.export.selection = Kijel\u00f6ltek export\u00e1l\u00e1sa
menu.file.exit = Kil\u00e9p\u00e9s
menu.tools = Eszk\u00f6z\u00f6k
menu.tools.searchas = Keres\u00e9s az \u00f6sszes ActionScriptben...
menu.tools.proxy = Proxy
@@ -92,7 +91,6 @@ message.confirm.autodeobfuscate = Automatikus deobfuszk\u00e1l\u00e1s egy m\u00f
message.parallel = P\u00e1rhuzamos\u00edt\u00e1s
message.trait.saved = Jellemz\u0151 sikeresen lementve
message.constant.new.string = Karakterl\u00e1nc "%value%" nem tal\u00e1lhat\u00f3 a konstans t\u00e1bl\u00e1ban. Szeretn\u00e9 hozz\u00e1adni?
message.constant.new.string.title = Karakterl\u00e1nc hozz\u00e1ad\u00e1sa
message.constant.new.integer = Eg\u00e9sz \u00e9rt\u00e9k "%value%" nem tal\u00e1lhat\u00f3 a konstans t\u00e1bl\u00e1ban. Szeretn\u00e9 hozz\u00e1adni?
@@ -120,7 +118,6 @@ work.buildingscripttree = Szkript fa \u00e9p\u00edt\u00e9se
work.deobfuscating.complete = Deobfuszk\u00e1l\u00e1s k\u00e9sz
message.search.notfound = Karakterl\u00e1nc "%searchtext%" nem tal\u00e1lhat\u00f3.
message.search.notfound.title = Nem tal\u00e1lhat\u00f3
@@ -187,7 +184,6 @@ abc.detail.methodinfo.returnvalue = Visszat\u00e9r\u00e9si \u00e9rt\u00e9k t\u00
error.methodinfo.params = MethodInfo Param\u00e9ter Hiba
error.methodinfo.returnvalue = MethodInfo Visszat\u00e9r\u00e9si \u00e9rt\u00e9k Hiba
abc.detail.methodinfo = MethodInfo
abc.detail.body.code = MethodBody K\u00f3d
abc.detail.body.params = MethodBody param\u00e9terek
@@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = T\u00edpus \u00e9s \u00c9rt\u00e9k:
error.slotconst.typevalue = SlotConst t\u00edpus\u00e9rt\u00e9k Hiba
message.autofill.failed = K\u00f3d statisztika nem el\u00e9rhet\u0151 az automatikus t\u00f6rzs param\u00e9terekhez.\r\nVegye ki a pip\u00e1t az az automatikus kit\u00f6lt\u00e9s mell\u0151l ennek az \u00fczenetnek az elket\u00fcl\u00e9s\u00e9hez.
info.selecttrait = V\u00e1lasszon ki egy oszt\u00e1lyt \u00e9s kattintson egy jellemz\u0151re az ActionScript forr\u00e1sban a szerkeszt\u00e9shez.
@@ -228,6 +223,7 @@ font.leading = Sork\u00f6z:
font.characters = Karakterek:
font.characters.add = Karakter hozz\u00e1ad\u00e1sa:
value.unknown = ?
yes = igen
no = nem
@@ -266,7 +262,6 @@ FileChooser.directoryDescriptionText = K\u00f6nyvt\u00e1r
FileChooser.directoryOpenButtonText = Megnyit\u00e1s
FileChooser.directoryOpenButtonToolTipText = A kiv\u00e1lasztott k\u00f6nyvt\u00e1r megnyit\u00e1sa
FileChooser.fileDescriptionText = \u00c1ltal\u00e1nos f\u00e1jl
FileChooser.fileNameLabelText = F\u00e1jln\u00e9v:
FileChooser.helpButtonText = S\u00fag\u00f3
FileChooser.helpButtonToolTipText = FileChooser s\u00fag\u00f3
FileChooser.newFolderAccessibleName = \u00daj mappa
@@ -284,6 +279,7 @@ FileChooser.updateButtonText = Friss\u00edt\u00e9s
FileChooser.updateButtonToolTipText = K\u00f6nyvt\u00e1r lista friss\u00edt\u00e9se
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = R\u00e9szletek
FileChooser.detailsViewButtonToolTip.textAndMnemonic = R\u00e9szletek
FileChooser.fileAttrHeader.textAndMnemonic = Attrib\u00fatumok
@@ -325,6 +321,7 @@ button.ignore = Mell\u0151z
font.source = Forr\u00e1s bet\u0171t\u00edpus:
#after version 1.6.7:
menu.export = Export\u00e1l\u00e1s
menu.general = \u00c1ltal\u00e1nos
menu.language = Nyelv
@@ -337,6 +334,7 @@ error.font.nocharacter = A kiv\u00e1lasztott forr\u00e1s bet\u0171t\u00edpus nem
warning.initializers = A statikus mez\u0151k \u00e9s konstansok gyakram az initializerekben vannak inicializ\u00e1lva.\nAz \u00e9rt\u00e9k szerkeszt\u00e9se csak itt \u00e1ltal\u00e1ban nem elegend\u0151!
#after version 1.7.0u1:
menu.tools.searchmemory = SWF-ek keres\u00e9se a mem\u00f3ri\u00e1ban
menu.file.reload = \u00dajrat\u00f6lt\u00e9s
message.confirm.reload = Ez a m\u0171velet visszavonja az \u00f6sszes nem mentett v\u00e1ltoz\u00e1st, \u00e9s \u00fajrat\u00f6lti az SWF f\u00e1jlt.\nSzeretn\u00e9 folytatni?
@@ -353,14 +351,17 @@ ColorChooser.swatchesRecentText = El\u0151zm\u00e9nyek:
ColorChooser.sampleText=Minta Sz\u00f6veg Minta Sz\u00f6veg
#after version 1.7.1:
preview.play = Lej\u00e1tsz\u00e1s
preview.pause = Sz\u00fcnet
preview.stop = Meg\u00e1ll\u00edt\u00e1s
message.confirm.removemultiple = Biztos benne, hogy t\u00f6r\u00f6lni k\u00edv\u00e1nja a %count% elemet\n \u00e9s az \u00f6sszes t\u0151le f\u00fcgg\u0151 objektumot ?
menu.tools.searchcache = Keres\u00e9s a b\u00f6ng\u00e9sz\u0151 gyors\u00edt\u00f3t\u00e1r\u00e1ban
#after version 1.7.2u2
error.trait.exists = "%name%" nev\u0171 jellemz\u0151 m\u00e1r l\u00e9tezik.
button.addtrait = Jellemz\u0151 hozz\u00e1ad\u00e1sa
button.font.embed = Be\u00e1gyaz...
@@ -372,3 +373,4 @@ filter.gfx = ScaleForm GFx f\u00e1jlok (*.gfx)
filter.supported = Minden t\u00e1mogatott f\u00e1jlt\u00edpus (*.swf, *.gfx)
work.canceled = Megszak\u00edtva
work.restoringControlFlow = Vez\u00e9rl\u00e9si-folyam helyre\u00e1ll\u00edt\u00e1s
menu.advancedsettings.advancedsettings = Halad\u00f3 be\u00e1ll\u00edt\u00e1sok
@@ -279,6 +279,7 @@ FileChooser.updateButtonText = Actualizar
FileChooser.updateButtonToolTipText = Actualizar listagem do directorio
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = Detalhes
FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detalhes
FileChooser.fileAttrHeader.textAndMnemonic = Atributos
@@ -320,6 +321,7 @@ button.ignore = Ignorar
font.source = Fonte inicial:
#after version 1.6.7:
menu.export = Exportar
menu.general = Geral
menu.language = Lingua
@@ -332,6 +334,7 @@ error.font.nocharacter = A fonte seleccionada n\u00e3o contem o caracter "%char%
warning.initializers = Campos est\u00e1ticos e constantes regularmente sao inicializades em inicializadores.\nEditar valores aqui pode n\u00e3o ser o suficiente!
#after version 1.7.0u1:
menu.tools.searchmemory = Procurar SWFs em mem\u00f3ria
menu.file.reload = Carregar de novo
message.confirm.reload = Esta acc\u00e7\u00e3o cancela todas as altera\u00e7\u00f5es N\u00c3O salvas e carrega de novo o ficheiro swf.\nDeseja continuar?
@@ -220,6 +220,7 @@ font.leading = \u0418\u043d\u0442\u0435\u0440\u043b\u0438\u043d\u044c\u044f\u043
font.characters = \u0421\u0438\u043c\u0432\u043e\u043b\u044b:
font.characters.add = \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b\u044b:
value.unknown = ?
yes = \u0434\u0430
no = \u043d\u0435\u0442
@@ -258,7 +259,6 @@ FileChooser.directoryDescriptionText = \u041f\u0430\u043f\u043a\u0430
FileChooser.directoryOpenButtonText = \u041e\u0442\u043a\u0440\u044b\u0442\u044c
FileChooser.directoryOpenButtonToolTipText = \u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443
FileChooser.fileDescriptionText = \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b
FileChooser.fileNameLabelText = \u0418\u043c\u044f \u0444\u0430\u0439\u043b\u0430:
FileChooser.helpButtonText = \u041f\u043e\u043c\u043e\u0449\u044c
FileChooser.helpButtonToolTipText = \u041f\u043e\u043c\u043e\u0449\u044c \u043f\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0443 \u0432\u044b\u0431\u043e\u0440\u0430 \u0444\u0430\u0439\u043b\u043e\u0432
FileChooser.newFolderAccessibleName = \u041d\u043e\u0432\u0430\u044f \u043f\u0430\u043f\u043a\u0430
@@ -331,6 +331,7 @@ error.font.nocharacter = \u0421\u0438\u043c\u0432\u043e\u043b "%char%" \u043e\u0
warning.initializers = \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445.\n\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0445 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0434\u0435\u0441\u044c, \u043d\u043e \u0438 \u0442\u0430\u043c!
#after version 1.7.0u1:
menu.tools.searchmemory = \u0418\u0441\u043a\u0430\u0442\u044c SWF \u0432 \u043f\u0430\u043c\u044f\u0442\u0438
menu.file.reload = \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c
message.confirm.reload = \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u043d\u0435\u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 SWF \u0444\u0430\u0439\u043b.\n \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c?
@@ -347,14 +348,17 @@ ColorChooser.swatchesRecentText = \u041d\u0435\u0434\u0430\u0432\u043d\u0435\u04
ColorChooser.sampleText = \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0434\u043f\u0438\u0441\u0438
#after version 1.7.1:
preview.play = \u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438
preview.pause = \u041f\u0430\u0443\u0437\u0430
preview.stop = \u0421\u0442\u043e\u043f
message.confirm.removemultiple = \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435:%count%\n \u0438 \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u043e\u0442 \u043d\u0438\u0445?
menu.tools.searchcache = \u041f\u043e\u0438\u0441\u043a \u0432 \u043a\u044d\u0448\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432
#after version 1.7.2u2
error.trait.exists = Trait \u0441 \u0438\u043c\u0435\u043d\u0435\u043c "%name%" \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.
button.addtrait = \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c trait
button.font.embed = \u0412\u0441\u0442\u0440\u043e\u0438\u0442\u044c...
@@ -22,7 +22,6 @@ menu.file.export.all = Exportera alla delar
menu.file.export.selection = Exportera markering
menu.file.exit = St\u00e4ng
menu.tools = Verktyg
menu.tools.searchas = S\u00f6k igenom alla ActionSkript...
menu.tools.proxy = Proxy
@@ -92,7 +91,6 @@ message.confirm.autodeobfuscate = Automatiskt avl\u00e4gsning av obfuskering \u0
message.parallel = parallellitet
message.trait.saved = Egenskap har sparats
message.constant.new.string = Str\u00e4ng "%value%" finns inte i konstant tabellen. Vill du l\u00e4gga till det?
message.constant.new.string.title = L\u00e4gg till Str\u00e4ng
message.constant.new.integer = Heltal v\u00e4rde "%value%" finns inte i konstant tabellen. Vill du l\u00e4gga till det?
@@ -120,7 +118,6 @@ work.buildingscripttree = Bygger skript tr\u00e4
work.deobfuscating.complete = Avl\u00e4gsning utav obfuskering \u00e4r nu f\u00e4rdig
message.search.notfound = Str\u00e4ng "%searchtext%" hittades inte.
message.search.notfound.title = Hittades inte
@@ -187,7 +184,6 @@ abc.detail.methodinfo.returnvalue = \u00c5terl\u00e4mna v\u00e4rde:
error.methodinfo.params = MetodInfo Parameter fel
error.methodinfo.returnvalue = MetodInfo \u00e5terl\u00e4mmnings typ Fel
abc.detail.methodinfo = MetodInfo
abc.detail.body.code = MetodInfo Kod
abc.detail.body.params = MetodKropp parametrar
@@ -196,7 +192,6 @@ abc.detail.slotconst.typevalue = Typ och V\u00e4rde:
error.slotconst.typevalue = SlotConst typv\u00e4rde felaktighet
message.autofill.failed = Kan inte f\u00e5 statistik koden f\u00f6r automatisk kropps-parametrar.\r\nAvmarkera automatisk ifyllnad f\u00f6r att undvika det h\u00e4r meddelandet.
info.selecttrait = V\u00e4lj klass och klicka p\u00e5 en egenskap i Actionskript k\u00e4llan f\u00f6r att redigera den.
@@ -214,9 +209,7 @@ error.action.save = %error% p\u00e5 rad %line%
message.confirm.remove = \u00c4r du s\u00e4ker p\u00e5 att du vill ta bort %item% \n och alla objekt som \u00e4r beroende av den?
#since version 1.6.6:
#after version 1.6.5u1:
button.ok = Godk\u00e4nn
button.cancel = Avbryt
@@ -269,7 +262,6 @@ FileChooser.directoryDescriptionText = Katalog
FileChooser.directoryOpenButtonText = \u00d6ppna
FileChooser.directoryOpenButtonToolTipText = \u00d6ppna vald katalog
FileChooser.fileDescriptionText = Generic File
FileChooser.fileNameLabelText = Filnamn:
FileChooser.helpButtonText = Hj\u00e4lp
FileChooser.helpButtonToolTipText = FileChooser help
FileChooser.newFolderAccessibleName = Ny mapp
@@ -287,6 +279,7 @@ FileChooser.updateButtonText = Uppdatera
FileChooser.updateButtonToolTipText = Uppdatera kataloglistning
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = Detaljer
FileChooser.detailsViewButtonToolTip.textAndMnemonic = Detaljer
FileChooser.fileAttrHeader.textAndMnemonic = Egenskaper
@@ -328,6 +321,7 @@ button.ignore = Ignorera
font.source = Typsnitts k\u00e4lla:
#after version 1.6.7:
menu.export = Exportera
menu.general = Allm\u00e4nt
menu.language = Spr\u00e5k start.
@@ -340,12 +334,14 @@ error.font.nocharacter = Vald teckensnitt-k\u00e4lla inneh\u00e5ller inte boksta
warning.initializers = Statiska f\u00e4lt och consts initieras i initierare ofta.\nRedigera v\u00e4rdet h\u00e4r \u00e4r oftast inte tillr\u00e4ckligt!
#after version 1.7.0u1:
menu.tools.searchmemory = S\u00f6k efter SWFs i minnet
menu.file.reload = Ladda om
message.confirm.reload = Denna \u00e5tg\u00e4rd avbryter alla \u00e4ndringar som inte sparats och laddar om SWF filen igen.\nVill du forts\u00e4tta?
dialog.selectcolor.title = V\u00e4lj bakgrundsf\u00e4rg f\u00f6r SWF display
button.selectcolor.hint = V\u00e4lj bakgrundsf\u00e4rg
ColorChooser.okText = Acceptera
ColorChooser.cancelText = Avbryt
ColorChooser.resetText = \u00c5terst\u00e4ll
@@ -354,15 +350,18 @@ ColorChooser.swatchesNameText = F\u00e4rgrutor
ColorChooser.swatchesRecentText = Nyligen:
ColorChooser.sampleText=Exempel Text Exempel Text
#after version 1.7.1:
#after version 1.7.1:
preview.play = Spela
preview.pause = Pausa
preview.stop = Stoppa
message.confirm.removemultiple = \u00c4r du s\u00e4ker p\u00e5 att du vill ta bort %count% objekt\noch alla andra objekt som \u00e4r beroende av objektet?
menu.tools.searchcache = S\u00f6k i webbl\u00e4sarens cache
#after version 1.7.2u2
#after version 1.7.2u2
error.trait.exists = Egenskap med namnet "%name%" finns redan.
button.addtrait = L\u00e4gg till egenskap
button.font.embed = Inb\u00e4dda...
@@ -22,7 +22,6 @@ menu.file.export.all = \u5bfc\u51fa\u6240\u6709
menu.file.export.selection = \u5bfc\u51fa\u6240\u9009
menu.file.exit = \u9000\u51fa
menu.tools = \u5de5\u5177
menu.tools.searchas = \u5728\u6240\u6709AS\u4ee3\u7801\u4e2d\u641c\u7d22...
menu.tools.proxy = \u4ee3\u7406
@@ -187,7 +186,6 @@ abc.detail.methodinfo.returnvalue = \u8fd4\u56de\u503c\u7c7b\u578b:
error.methodinfo.params = \u65b9\u6cd5\u4fe1\u606f\u7684\u53c2\u6570\u9519\u8bef
error.methodinfo.returnvalue = \u65b9\u6cd5\u4fe1\u606f\u7684\u8fd4\u56de\u503c\u7c7b\u578b\u9519\u8bef
abc.detail.methodinfo = \u65b9\u6cd5\u4fe1\u606f
abc.detail.body.code = \u65b9\u6cd5\u4e3b\u4f53\u4ee3\u7801
abc.detail.body.params = \u65b9\u6cd5\u4e3b\u4f53\u53c2\u6570
@@ -196,7 +194,6 @@ abc.detail.slotconst.typevalue = \u7c7b\u578b\u548c\u503c:
error.slotconst.typevalue = SlotConst\u7c7b\u578b\u503c\u9519\u8bef
message.autofill.failed = \u65e0\u6cd5\u81ea\u52a8\u83b7\u5f97\u4e3b\u4f53\u53c2\u6570\u72b6\u6001\u4ee3\u7801\u3002\r\n\u8bf7\u5173\u95ed\u81ea\u52a8\u586b\u5145\u529f\u80fd\u540e\u518d\u8bd5\u4e00\u6b21.
info.selecttrait = \u8bf7\u9009\u62e9\u7c7b\uff0c\u7136\u540e\u70b9\u51fb\u8fdb\u884cActionScript\u6e90\u7684\u7f16\u8f91.
@@ -285,6 +282,7 @@ FileChooser.updateButtonText = \u5237\u65b0
FileChooser.updateButtonToolTipText = \u5237\u65b0\u76ee\u5f55\u5217\u8868
#after version 1.6.6u2:
FileChooser.detailsViewActionLabel.textAndMnemonic = \u8be6\u7ec6\u4fe1\u606f
FileChooser.detailsViewButtonToolTip.textAndMnemonic = \u8be6\u7ec6\u4fe1\u606f
FileChooser.fileAttrHeader.textAndMnemonic = \u5c5e\u6027
@@ -318,7 +316,6 @@ FileChooser.fileSizeMegaBytes = {0} MB
FileChooser.fileSizeGigaBytes = {0} GB
FileChooser.folderNameLabelText = \u76ee\u5f55\u540d:
error.occured = \u53d1\u751f\u9519\u8bef : %error%
button.abort = \u7ec8\u6b62
button.retry = \u91cd\u8bd5
@@ -327,6 +324,7 @@ button.ignore = \u5ffd\u7565
font.source = \u6e90\u5b57\u4f53:
#after version 1.6.7:
menu.export = \u5bfc\u51fa
menu.general = \u901a\u7528
menu.language = \u8bed\u8a00
@@ -339,8 +337,8 @@ error.font.nocharacter = \u9009\u62e9\u7684\u6e90\u5b57\u4f53\u4e0d\u5305\u542b\
warning.initializers = \u9759\u6001\u5b57\u6bb5\u548c\u5e38\u91cf\u901a\u5e38\u5728\u521d\u59cb\u5316\u65f6\u88ab\u521d\u59cb\u5316\uff0c\n\u5728\u6b64\u7f16\u8f91\u901a\u5e38\u662f\u4e0d\u591f\u7684\uff01
#after version 1.7.0u1:
menu.tools.searchmemory = \u641c\u7d22\u5185\u5b58\u4e2d\u7684SWF
menu.tools.searchmemory = \u641c\u7d22\u5185\u5b58\u4e2d\u7684SWF
menu.file.reload = \u91cd\u8f7d
message.confirm.reload = \u8be5\u52a8\u4f5c\u5c06\u4f1a\u4e22\u5931\u6240\u6709\u672a\u4fdd\u5b58\u7684\u6539\u52a8\uff0c\u5e76\u91cd\u65b0\u52a0\u8f7d\u5f53\u524dSWF\u6587\u4ef6\u3002\n\u662f\u5426\u7ee7\u7eed\uff1f
@@ -356,14 +354,17 @@ ColorChooser.swatchesRecentText = \u6700\u8fd1:
ColorChooser.sampleText=\u793a\u4f8b\u6587\u5b57 Sample Text
#after version 1.7.1:
preview.play = \u64ad\u653e
preview.pause = \u6682\u505c
preview.stop = \u505c\u6b62
message.confirm.removemultiple = \u60a8\u786e\u5b9a\u8981\u79fb\u9664 %count% \u4e2a\u9879\u76ee\uff0c\n\u4ee5\u53ca\u5176\u6240\u6709\u7684\u4f9d\u8d56\u5bf9\u8c61\u5417\uff1f
menu.tools.searchcache = \u641c\u7d22\u6d4f\u89c8\u5668\u7f13\u5b58
#after version 1.7.2u2
error.trait.exists = Trait \u6240\u7528\u7684\u540d\u79f0 \u201c%name%\u201d\u5df2\u5b58\u5728\u3002
button.addtrait = \u6dfb\u52a0 Trait
button.font.embed = \u5d4c\u5165...
@@ -102,11 +102,11 @@ public class PlayerControls extends JPanel implements ActionListener {
private String formatMs(long ms) {
long s = ms / 1000;
ms = ms % 1000;
ms %= 1000;
long m = s / 60;
s = s % 60;
s %= 60;
long h = m / 60;
m = m % 60;
m %= 60;
return "" + (h > 0 ? h + ":" : "") + pad(m) + ":" + pad(s) + "." + pad(ms / 10);
}
@@ -330,7 +330,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
public void catched(String contentType, String url, InputStream data) {
boolean swfOnly = false;
if (contentType.contains(";")) {
contentType = contentType.substring(0, contentType.indexOf(";"));
contentType = contentType.substring(0, contentType.indexOf(';'));
}
if ((!sniffSWFCheckBox.isSelected()) && (contentType.equals("application/x-shockwave-flash"))) {
return;
@@ -39,10 +39,10 @@ public class GraphTextWriter {
}
/**
* Highlights specified text as instruction by adding special tags
* Highlights specified text as instruction
*
* @param offset Offset of instruction
* @return HilightedTextWriter
* @param pos Offset of instruction
* @return GraphTextWriter
*/
public GraphTextWriter startOffset(GraphSourceItem src, int pos) {
return this;
@@ -53,10 +53,10 @@ public class GraphTextWriter {
}
/**
* Highlights specified text as method by adding special tags
* Highlights specified text as method
*
* @param index MethodInfo index
* @return HilightedTextWriter
* @return GraphTextWriter
*/
public GraphTextWriter startMethod(long index) {
return this;
@@ -67,10 +67,10 @@ public class GraphTextWriter {
}
/**
* Highlights specified text as class by adding special tags
* Highlights specified text as class
*
* @param index Class index
* @return HilightedTextWriter
* @return GraphTextWriter
*/
public GraphTextWriter startClass(long index) {
return this;
@@ -81,10 +81,10 @@ public class GraphTextWriter {
}
/**
* Highlights specified text as trait by adding special tags
* Highlights specified text as trait
*
* @param index Trait index
* @return HilightedTextWriter
* @return GraphTextWriter
*/
public GraphTextWriter startTrait(long index) {
return this;
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.helpers;
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@@ -61,5 +62,10 @@ public class HilightedText implements Serializable {
public HilightedText(String text) {
this.text = text;
this.traitHilights = new ArrayList<>();
this.classHilights = new ArrayList<>();
this.methodHilights = new ArrayList<>();
this.instructionHilights = new ArrayList<>();
this.specialHilights = new ArrayList<>();
}
}
@@ -65,7 +65,7 @@ public class HilightedTextWriter extends GraphTextWriter {
/**
* Highlights specified text as instruction by adding special tags
*
* @param offset Offset of instruction
* @param pos Offset of instruction
* @return HilightedTextWriter
*/
@Override
@@ -126,7 +126,6 @@ public class Highlighting implements Serializable {
/**
*
* @param startPos Starting position
* @param len Length of highlighted text
* @param data Highlighting data
* @param type Highlighting type
*/
@@ -66,7 +66,7 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag {
int a = (argb >> 24) & 0xff;
int r = (argb >> 16) & 0xff;
int g = (argb >> 8) & 0xff;
int b = (argb >> 0) & 0xff;
int b = (argb) & 0xff;
r = r * a / 255;
g = g * a / 255;
@@ -66,7 +66,7 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag {
//int a = (argb >> 24) & 0xff;
int r = (argb >> 16) & 0xff;
int g = (argb >> 8) & 0xff;
int b = (argb >> 0) & 0xff;
int b = (argb) & 0xff;
bitmapData.bitmapPixelDataPix24[pos] = new PIX24();
bitmapData.bitmapPixelDataPix24[pos].red = r;
bitmapData.bitmapPixelDataPix24[pos].green = g;
@@ -112,7 +112,7 @@ public class DefineEditTextTag extends TextTag {
continue;
}
if (!intag) {
outp = outp + inp.charAt(i);
outp += inp.charAt(i);
}
}
return outp;
@@ -154,8 +154,8 @@ public class DefineEditTextTag extends TextTag {
+ (hasFontClass ? "fontclass " + fontClass + "\r\n" : "") + (hasMaxLength ? "maxlength " + maxLength + "\r\n" : "")
+ "align " + alignValues[align] + "\r\n"
+ (hasLayout ? "leftmargin " + leftMargin + "\r\nrightmargin " + rightMargin + "\r\nindent " + indent + "\r\nleading " + leading + "\r\n" : "")
+ (!variableName.equals("") ? "variablename " + variableName + "\r\n" : "");
ret = ret + "]";
+ (!variableName.isEmpty() ? "variablename " + variableName + "\r\n" : "");
ret += "]";
if (hasText) {
ret += initialText.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]");
}
@@ -196,140 +196,170 @@ public class DefineEditTextTag extends TextTag {
case PARAMETER:
String paramName = (String) s.values[0];
String paramValue = (String) s.values[1];
if (paramName.equals("xmin")) {
try {
bounds.Xmin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("ymin")) {
try {
bounds.Ymin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("xmax")) {
try {
bounds.Xmax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("ymax")) {
try {
bounds.Ymax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("wordwrap")) {
if (paramValue.equals("1")) {
wordWrap = true;
}
} else if (paramName.equals("multiline")) {
if (paramValue.equals("1")) {
multiline = true;
}
} else if (paramName.equals("password")) {
if (paramValue.equals("1")) {
password = true;
}
} else if (paramName.equals("readonly")) {
if (paramValue.equals("1")) {
readOnly = true;
}
} else if (paramName.equals("autosize")) {
if (paramValue.equals("1")) {
autoSize = true;
}
} else if (paramName.equals("noselect")) {
if (paramValue.equals("1")) {
noSelect = true;
}
} else if (paramName.equals("border")) {
if (paramValue.equals("1")) {
border = true;
}
} else if (paramName.equals("wasstatic")) {
if (paramValue.equals("1")) {
wasStatic = true;
}
} else if (paramName.equals("html")) {
if (paramValue.equals("1")) {
html = true;
}
} else if (paramName.equals("useoutlines")) {
if (paramValue.equals("1")) {
useOutlines = true;
}
} else if (paramName.equals("font")) {
try {
fontId = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid font value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("fontclass")) {
fontClass = paramValue;
} else if (paramName.equals("height")) {
try {
fontHeight = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid height value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("color")) {
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
if (m.matches()) {
textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16));
} else {
throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline());
}
} else if (paramName.equals("maxlength")) {
try {
maxLength = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("align")) {
if (paramValue.equals("left")) {
align = 0;
} else if (paramValue.equals("right")) {
align = 1;
} else if (paramValue.equals("center")) {
align = 2;
} else if (paramValue.equals("justify")) {
align = 3;
} else {
throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline());
}
} else if (paramName.equals("leftmargin")) {
try {
leftMargin = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("rightmargin")) {
try {
rightMargin = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("indent")) {
try {
indent = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid indent value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("leading")) {
try {
leading = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid leading value. Number expected.", lexer.yyline());
}
} else if (paramName.equals("variablename")) {
variableName = paramValue;
} else {
throw new ParseException("Unrecognized parameter name", lexer.yyline());
switch (paramName) {
case "xmin":
try {
bounds.Xmin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline());
}
break;
case "ymin":
try {
bounds.Ymin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline());
}
break;
case "xmax":
try {
bounds.Xmax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline());
}
break;
case "ymax":
try {
bounds.Ymax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline());
}
break;
case "wordwrap":
if (paramValue.equals("1")) {
wordWrap = true;
}
break;
case "multiline":
if (paramValue.equals("1")) {
multiline = true;
}
break;
case "password":
if (paramValue.equals("1")) {
password = true;
}
break;
case "readonly":
if (paramValue.equals("1")) {
readOnly = true;
}
break;
case "autosize":
if (paramValue.equals("1")) {
autoSize = true;
}
break;
case "noselect":
if (paramValue.equals("1")) {
noSelect = true;
}
break;
case "border":
if (paramValue.equals("1")) {
border = true;
}
break;
case "wasstatic":
if (paramValue.equals("1")) {
wasStatic = true;
}
break;
case "html":
if (paramValue.equals("1")) {
html = true;
}
break;
case "useoutlines":
if (paramValue.equals("1")) {
useOutlines = true;
}
break;
case "font":
try {
fontId = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid font value. Number expected.", lexer.yyline());
}
break;
case "fontclass":
fontClass = paramValue;
break;
case "height":
try {
fontHeight = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid height value. Number expected.", lexer.yyline());
}
break;
case "color":
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
if (m.matches()) {
textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16));
} else {
throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline());
}
break;
case "maxlength":
try {
maxLength = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline());
}
break;
case "align":
switch (paramValue) {
case "left":
align = 0;
break;
case "right":
align = 1;
break;
case "center":
align = 2;
break;
case "justify":
align = 3;
break;
default:
throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline());
}
break;
case "leftmargin":
try {
leftMargin = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline());
}
break;
case "rightmargin":
try {
rightMargin = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline());
}
break;
case "indent":
try {
indent = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid indent value. Number expected.", lexer.yyline());
}
break;
case "leading":
try {
leading = Integer.parseInt(paramValue);
} catch (NumberFormatException ne) {
throw new ParseException("Invalid leading value. Number expected.", lexer.yyline());
}
break;
case "variablename":
variableName = paramValue;
break;
default:
throw new ParseException("Unrecognized parameter name", lexer.yyline());
}
break;
case TEXT:
text += (String) s.values[0];
break;
@@ -96,7 +96,7 @@ public class DefineText2Tag extends TextTag implements DrawableTag {
}
}
if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) {
if (!ret.equals("")) {
if (!ret.isEmpty()) {
ret += "\r\n";
}
}
@@ -189,112 +189,125 @@ public class DefineText2Tag extends TextTag implements DrawableTag {
throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline());
}
}
if (paramName.equals("font")) {
try {
fontId = Integer.parseInt(paramValue);
switch (paramName) {
case "font":
try {
fontId = Integer.parseInt(paramValue);
for (Tag t : tags) {
if (t instanceof FontTag) {
if (((FontTag) t).getFontId() == fontId) {
font = (FontTag) t;
break;
}
for (Tag t : tags) {
if (t instanceof FontTag) {
if (((FontTag) t).getFontId() == fontId) {
font = (FontTag) t;
break;
}
}
if (font == null) {
throw new ParseException("Font not found", lexer.yyline());
}
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
}
} else if (paramName.equals("height")) {
try {
textHeight = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
}
} else if (paramName.equals("x")) {
try {
x = Integer.parseInt(paramValue);
currentX = x;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
}
} else if (paramName.equals("y")) {
try {
y = Integer.parseInt(paramValue);
currentY = y;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
}
} else if (paramName.equals("xmin")) {
try {
textBounds.Xmin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
}
} else if (paramName.equals("xmax")) {
try {
textBounds.Xmax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
}
} else if (paramName.equals("ymin")) {
try {
textBounds.Ymin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
}
} else if (paramName.equals("ymax")) {
try {
textBounds.Ymax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
}
} else if (paramName.equals("scalex")) {
try {
textMatrix.scaleX = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
} else if (paramName.equals("scaley")) {
try {
textMatrix.scaleY = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
} else if (paramName.equals("rotateskew0")) {
try {
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
}
} else if (paramName.equals("rotateskew1")) {
try {
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
}
} else if (paramName.equals("translatex")) {
try {
textMatrix.translateX = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
}
} else if (paramName.equals("translatey")) {
try {
textMatrix.translateY = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
if (font == null) {
throw new ParseException("Font not found", lexer.yyline());
}
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
}
break;
case "height":
try {
textHeight = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
}
break;
case "x":
try {
x = Integer.parseInt(paramValue);
currentX = x;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
}
break;
case "y":
try {
y = Integer.parseInt(paramValue);
currentY = y;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
}
break;
case "xmin":
try {
textBounds.Xmin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
}
break;
case "xmax":
try {
textBounds.Xmax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
}
break;
case "ymin":
try {
textBounds.Ymin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
}
break;
case "ymax":
try {
textBounds.Ymax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
}
break;
case "scalex":
try {
textMatrix.scaleX = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
break;
case "scaley":
try {
textMatrix.scaleY = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
break;
case "rotateskew0":
try {
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
}
break;
case "rotateskew1":
try {
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
}
break;
case "translatex":
try {
textMatrix.translateX = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
}
break;
case "translatey":
try {
textMatrix.translateY = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
}
break;
}
break;
case TEXT:
if (font == null) {
throw new ParseException("Font not defined", lexer.yyline());
@@ -96,7 +96,7 @@ public class DefineTextTag extends TextTag implements DrawableTag {
}
}
if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) {
if (!ret.equals("")) {
if (!ret.isEmpty()) {
ret += "\r\n";
}
}
@@ -181,119 +181,133 @@ public class DefineTextTag extends TextTag implements DrawableTag {
case PARAMETER:
String paramName = (String) s.values[0];
String paramValue = (String) s.values[1];
if (paramName.equals("color")) {
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
if (m.matches()) {
color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16));
} else {
throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline());
}
} else if (paramName.equals("font")) {
try {
fontId = Integer.parseInt(paramValue);
switch (paramName) {
case "color":
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
if (m.matches()) {
color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16));
} else {
throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline());
}
break;
case "font":
try {
fontId = Integer.parseInt(paramValue);
for (Tag t : tags) {
if (t instanceof FontTag) {
if (((FontTag) t).getFontId() == fontId) {
font = (FontTag) t;
break;
}
for (Tag t : tags) {
if (t instanceof FontTag) {
if (((FontTag) t).getFontId() == fontId) {
font = (FontTag) t;
break;
}
}
if (font == null) {
throw new ParseException("Font not found", lexer.yyline());
}
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
}
} else if (paramName.equals("height")) {
try {
textHeight = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
}
} else if (paramName.equals("x")) {
try {
x = Integer.parseInt(paramValue);
currentX = x;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
}
} else if (paramName.equals("y")) {
try {
y = Integer.parseInt(paramValue);
currentY = y;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
}
} else if (paramName.equals("xmin")) {
try {
textBounds.Xmin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
}
} else if (paramName.equals("xmax")) {
try {
textBounds.Xmax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
}
} else if (paramName.equals("ymin")) {
try {
textBounds.Ymin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
}
} else if (paramName.equals("ymax")) {
try {
textBounds.Ymax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
}
} else if (paramName.equals("scalex")) {
try {
textMatrix.scaleX = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
} else if (paramName.equals("scaley")) {
try {
textMatrix.scaleY = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
} else if (paramName.equals("rotateskew0")) {
try {
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
}
} else if (paramName.equals("rotateskew1")) {
try {
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
}
} else if (paramName.equals("translatex")) {
try {
textMatrix.translateX = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
}
} else if (paramName.equals("translatey")) {
try {
textMatrix.translateY = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
if (font == null) {
throw new ParseException("Font not found", lexer.yyline());
}
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
}
break;
case "height":
try {
textHeight = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
}
break;
case "x":
try {
x = Integer.parseInt(paramValue);
currentX = x;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
}
break;
case "y":
try {
y = Integer.parseInt(paramValue);
currentY = y;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
}
break;
case "xmin":
try {
textBounds.Xmin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
}
break;
case "xmax":
try {
textBounds.Xmax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
}
break;
case "ymin":
try {
textBounds.Ymin = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
}
break;
case "ymax":
try {
textBounds.Ymax = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
}
break;
case "scalex":
try {
textMatrix.scaleX = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
break;
case "scaley":
try {
textMatrix.scaleY = Integer.parseInt(paramValue);
textMatrix.hasScale = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
}
break;
case "rotateskew0":
try {
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
}
break;
case "rotateskew1":
try {
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
textMatrix.hasRotate = true;
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
}
break;
case "translatex":
try {
textMatrix.translateX = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
}
break;
case "translatey":
try {
textMatrix.translateY = Integer.parseInt(paramValue);
} catch (NumberFormatException nfe) {
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
}
break;
}
break;
case TEXT:
if (font == null) {
throw new ParseException("Font not defined", lexer.yyline());
@@ -176,7 +176,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
@Override
public String getExportFileName(List<Tag> tags) {
String expName = getExportName();
if ((expName == null) || expName.equals("")) {
if ((expName == null) || expName.isEmpty()) {
return super.toString();
}
String[] pathParts;
@@ -191,7 +191,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
@Override
public String toString() {
String expName = getExportName();
if ((expName == null) || expName.equals("")) {
if ((expName == null) || expName.isEmpty()) {
return super.toString();
}
String[] pathParts;
@@ -33,7 +33,7 @@ public interface ASMSource {
* Converts actions to ASM source
*
* @param version SWF version
* @param hex Add hexadecimal?
* @param exportMode PCode or hex?
* @return ASM source
*/
public GraphTextWriter getASMSource(int version, ExportMode exportMode, GraphTextWriter writer, List<Action> actions);
@@ -66,11 +66,11 @@ public abstract class CharacterIdTag extends Tag {
@Override
public String getExportFileName(List<Tag> tags) {
return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : "");
return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : "");
}
public String getCharacterExportFileName() {
return getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : "");
return getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : "");
}
public String getExportName() {
@@ -163,7 +163,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
return fontName;
}
if (fontName.contains("_")) {
String beforeUnderscore = fontName.substring(0, fontName.indexOf("_"));
String beforeUnderscore = fontName.substring(0, fontName.indexOf('_'));
if (fontNames.contains(beforeUnderscore)) {
return beforeUnderscore;
}
@@ -176,7 +176,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
return fontName;
}
if (fontName.contains("_")) {
String beforeUnderscore = fontName.substring(0, fontName.indexOf("_"));
String beforeUnderscore = fontName.substring(0, fontName.indexOf('_'));
if (fontNames.contains(beforeUnderscore)) {
return beforeUnderscore;
}
@@ -65,7 +65,7 @@ import javax.swing.JPanel;
*
* @author JPEXS
*/
public class DefineCompactedFont extends FontTag implements DrawableTag {
public final class DefineCompactedFont extends FontTag implements DrawableTag {
public static final int ID = 1005;
public int fontId;
@@ -96,10 +96,7 @@ public class Filtering {
}
}
}
for (int x = 0; x < w; x++) {
pixels[index + x] = newColors[x];
}
System.arraycopy(newColors, 0, pixels, index, w);
index += w;
}
@@ -74,12 +74,12 @@ public class ContourType {
moveToY = sis.readSI15();
long numEdgesRef = sis.readUI30();
isReference = (numEdgesRef & 1) == 1;
numEdgesRef = numEdgesRef >> 1;
numEdgesRef >>= 1;
long oldPos = sis.getPos();
if (isReference) {
sis.setPos(numEdgesRef);
numEdgesRef = sis.readUI30();
numEdgesRef = numEdgesRef >> 1;
numEdgesRef >>= 1;
}
edges = new EdgeType[(int) numEdgesRef];
@@ -455,7 +455,6 @@ public class EdgeType {
sos.writeUI8((((ax >> 14) & m5) | (ay << 5)));
sos.writeUI8(((ay >> 3)));
sos.writeUI8(((ay >> 11)));
return;
}
}
}
@@ -88,18 +88,18 @@ public class GFxInputStream extends InputStream {
return v;
case 1:
t = t >> 2;
t >>= 2;
v = t | (readUI8() << 6);
return v;
case 2:
t = t >> 2;
t = t | (readUI8() << 6);
t >>= 2;
t |= (readUI8() << 6);
v = t | (readUI8() << 14);
return v;
}
t = t >> 2;
t = t | (readUI8() << 6);
t = t | (readUI8() << 14);
t >>= 2;
t |= (readUI8() << 6);
t |= (readUI8() << 14);
v = t | (readUI8() << 22);
return v;
}
@@ -857,8 +857,8 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
maxh = r.getHeight();
}
}
maxw = maxw / 20;
maxh = maxh / 20;
maxw /= 20;
maxh /= 20;
int cols = (int) Math.ceil(Math.sqrt(shapes.size()));
@@ -711,7 +711,7 @@ public class XFLConverter {
edges.clear();
fillsStr += "</fills>";
strokesStr += "</strokes>";
if (!currentLayer.equals("")) {
if (!currentLayer.isEmpty()) {
currentLayer += "</edges>";
currentLayer += "</DOMShape>";
currentLayer += "</elements>";
@@ -1301,10 +1301,14 @@ public class XFLConverter {
String symbolFile = "bitmap" + symbol.getCharacterId() + "." + imageTag.getImageFormat();
files.put(symbolFile, baos.toByteArray());
String mediaLinkStr = "<DOMBitmapItem name=\"" + symbolFile + "\" sourceLastImported=\"" + getTimestamp() + "\" externalFileSize=\"" + baos.toByteArray().length + "\"";
if (format.equals("png") || format.equals("gif")) {
mediaLinkStr += " useImportedJPEGData=\"false\" compressionType=\"lossless\" originalCompressionType=\"lossless\"";
} else if (format.equals("jpg")) {
mediaLinkStr += " isJPEG=\"true\"";
switch (format) {
case "png":
case "gif":
mediaLinkStr += " useImportedJPEGData=\"false\" compressionType=\"lossless\" originalCompressionType=\"lossless\"";
break;
case "jpg":
mediaLinkStr += " isJPEG=\"true\"";
break;
}
if (characterClasses.containsKey(symbol.getCharacterId())) {
mediaLinkStr += " linkageExportForAS=\"true\" linkageClassName=\"" + characterClasses.get(symbol.getCharacterId()) + "\"";
@@ -1670,7 +1674,7 @@ public class XFLConverter {
ret += ">";
ret += soundEnvelopeStr;
if (!actionScript.equals("")) {
if (!actionScript.isEmpty()) {
ret += "<Actionscript><script><![CDATA[";
ret += actionScript;
ret += "]]></script></Actionscript>";
@@ -1850,12 +1854,12 @@ public class XFLConverter {
lastElements = elements;
}
}
if (!lastElements.equals("")) {
if (!lastElements.isEmpty()) {
frame++;
ret += convertFrame(lastShapeTween, characters, tags, null, null, (frame - duration < 0 ? 0 : frame - duration), duration, "", lastElements);
}
afterStr = "</frames>" + afterStr;
if (!ret.equals("")) {
if (!ret.isEmpty()) {
ret = prevStr + ret + afterStr;
}
return ret;
@@ -1875,7 +1879,7 @@ public class XFLConverter {
}
}
}
if (!script.equals("")) {
if (!script.isEmpty()) {
script = "#initclip\r\n" + script + "#endinitclip\r\n";
}
for (Tag t : timeLineTags) {
@@ -1885,7 +1889,7 @@ public class XFLConverter {
}
if (t instanceof ShowFrameTag) {
if (script.equals("")) {
if (script.isEmpty()) {
duration++;
} else {
if (duration > 0) {
@@ -1912,7 +1916,7 @@ public class XFLConverter {
frame++;
}
}
if (!ret.equals("")) {
if (!ret.isEmpty()) {
ret = "<DOMLayer name=\"Script Layer\" color=\"" + randomOutlineColor() + "\">"
+ "<frames>"
+ ret
@@ -1936,7 +1940,7 @@ public class XFLConverter {
}
if (t instanceof ShowFrameTag) {
if (frameLabel.equals("")) {
if (frameLabel.isEmpty()) {
duration++;
} else {
if (duration > 0) {
@@ -1967,7 +1971,7 @@ public class XFLConverter {
frame++;
}
}
if (!ret.equals("")) {
if (!ret.isEmpty()) {
ret = "<DOMLayer name=\"Labels Layer\" color=\"" + randomOutlineColor() + "\">"
+ "<frames>"
+ ret
@@ -2015,7 +2019,7 @@ public class XFLConverter {
}
ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, duration, "", "");
}
if (!ret.equals("")) {
if (!ret.isEmpty()) {
ret = "<DOMLayer name=\"Layer " + layerIndex + "\" color=\"" + randomOutlineColor() + "\">"
+ "<frames>" + ret + "</frames>"
+ "</DOMLayer>";
@@ -2100,7 +2104,7 @@ public class XFLConverter {
layerPrev += ">";
String layerAfter = "</DOMLayer>";
String cf = convertFrames(layerPrev, layerAfter, oneInstanceShapes, tags, timelineTags, characters, d);
if (cf.equals("")) {
if (cf.isEmpty()) {
index--;
}
ret += cf;
@@ -2395,7 +2399,7 @@ public class XFLConverter {
if (det.hasMaxLength) {
ret += " maxCharacters=\"" + det.maxLength + "\"";
}
if (!det.variableName.equals("")) {
if (!det.variableName.isEmpty()) {
ret += " variableName=\"" + det.variableName + "\"";
}
ret += ">";
@@ -2520,7 +2524,7 @@ public class XFLConverter {
File f = new File(baseName);
baseName = f.getName();
if (baseName.contains(".")) {
baseName = baseName.substring(0, baseName.lastIndexOf("."));
baseName = baseName.substring(0, baseName.lastIndexOf('.'));
}
final HashMap<String, byte[]> files = new HashMap<>();
final HashMap<String, byte[]> datfiles = new HashMap<>();
@@ -2586,7 +2590,7 @@ public class XFLConverter {
}
String expDir = "";
if (expPath.contains(".")) {
expDir = expPath.substring(0, expPath.lastIndexOf("."));
expDir = expPath.substring(0, expPath.lastIndexOf('.'));
expDir = expDir.replace(".", File.separator);
}
expPath = expPath.replace(".", File.separator);
@@ -3121,75 +3125,82 @@ public class XFLConverter {
@Override
public void startElement(String uri, String localName,
String qName, Attributes attributes) throws SAXException {
if (qName.equals("a")) {
String href = attributes.getValue("href");
if (href != null) {
url = href;
}
String t = attributes.getValue("target");
if (t != null) {
target = t;
}
} else if (qName.equals("b")) {
bold = true;
} else if (qName.equals("i")) {
italic = true;
} else if (qName.equals("u")) {
underline = true;
} else if (qName.equals("li")) {
li = true;
} else if (qName.equals("p")) {
String a = attributes.getValue("align");
if (a != null) {
alignment = a;
}
if (!result.equals("")) {
putText("\r\n");
}
} else if (qName.equals("font")) {
//kerning ?
String ls = attributes.getValue("letterSpacing");
if (ls != null) {
letterSpacing = Double.parseDouble(ls);
}
String s = attributes.getValue("size");
if (s != null) {
size = Integer.parseInt(s);
}
String c = attributes.getValue("color");
if (c != null) {
color = c;
}
String f = attributes.getValue("face");
if (f != null) {
for (Tag t : tags) {
if (t instanceof FontTag) {
FontTag ft = (FontTag) t;
String fontName = null;
if (f.equals(ft.getFontName(tags))) {
for (Tag u : tags) {
if (u instanceof DefineFontNameTag) {
if (((DefineFontNameTag) u).fontId == ft.getFontId()) {
fontName = ((DefineFontNameTag) u).fontName;
switch (qName) {
case "a":
String href = attributes.getValue("href");
if (href != null) {
url = href;
}
String t = attributes.getValue("target");
if (t != null) {
target = t;
}
break;
case "b":
bold = true;
break;
case "i":
italic = true;
break;
case "u":
underline = true;
break;
case "li":
li = true;
break;
case "p":
String a = attributes.getValue("align");
if (a != null) {
alignment = a;
}
if (!result.isEmpty()) {
putText("\r\n");
}
break;
case "font":
//kerning ?
String ls = attributes.getValue("letterSpacing");
if (ls != null) {
letterSpacing = Double.parseDouble(ls);
}
String s = attributes.getValue("size");
if (s != null) {
size = Integer.parseInt(s);
}
String c = attributes.getValue("color");
if (c != null) {
color = c;
}
String f = attributes.getValue("face");
if (f != null) {
for (Tag tag : tags) {
if (tag instanceof FontTag) {
FontTag ft = (FontTag) tag;
String fontName = null;
if (f.equals(ft.getFontName(tags))) {
for (Tag u : tags) {
if (u instanceof DefineFontNameTag) {
if (((DefineFontNameTag) u).fontId == ft.getFontId()) {
fontName = ((DefineFontNameTag) u).fontName;
}
}
}
if (fontName == null) {
fontName = ft.getFontName(tags);
}
String installedFont;
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName();
} else {
fontFace = fontName;
}
break;
}
if (fontName == null) {
fontName = ft.getFontName(tags);
}
String installedFont;
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName();
} else {
fontFace = fontName;
}
break;
}
}
}
}
break;
}
//textformat,tab,br
}
@Override
@@ -3268,7 +3279,7 @@ public class XFLConverter {
@Override
public void endDocument() {
if (this.result.equals("")) {
if (this.result.isEmpty()) {
putText("");
}
}
@@ -32,8 +32,9 @@ public enum ExportMode {
private static final Map<Integer, ExportMode> lookup = new HashMap<>();
static {
for(ExportMode s : EnumSet.allOf(ExportMode.class))
lookup.put(s.getCode(), s);
for(ExportMode s : EnumSet.allOf(ExportMode.class)) {
lookup.put(s.getCode(), s);
}
}
private int code;
+21 -18
View File
@@ -64,7 +64,7 @@ public class Graph {
}
public void init(List<Object> localData) {
public void init(List<Object> localData) throws InterruptedException {
if (heads != null) {
return;
}
@@ -89,17 +89,20 @@ public class Graph {
}
}
private void fixGraph(List<Object> localData, GraphPart part) {
private void fixGraph(List<Object> localData, GraphPart part) throws InterruptedException {
//if(true) return;
try {
while (fixGraphOnce(localData, part, new ArrayList<GraphPart>(), false)) {
}
} catch (InterruptedException ex) {
throw ex;
} catch (Exception | Error ex) {
String s = ex.toString();
//ignore
}
}
private boolean fixGraphOnce(List<Object> localData, GraphPart part, List<GraphPart> visited, boolean doChildren) {
private boolean fixGraphOnce(List<Object> localData, GraphPart part, List<GraphPart> visited, boolean doChildren) throws InterruptedException {
if (visited.contains(part)) {
return false;
}
@@ -371,11 +374,11 @@ public class Graph {
/* public GraphPart getNextCommonPart(GraphPart part, List<Loop> loops) {
return getNextCommonPart(part, new ArrayList<GraphPart>(),loops);
}*/
public GraphPart getNextCommonPart(List<Object> localData, GraphPart part, List<Loop> loops) {
public GraphPart getNextCommonPart(List<Object> localData, GraphPart part, List<Loop> loops) throws InterruptedException {
return getCommonPart(localData, part.nextParts, loops);
}
public GraphPart getCommonPart(List<Object> localData, List<GraphPart> parts, List<Loop> loops) {
public GraphPart getCommonPart(List<Object> localData, List<GraphPart> parts, List<Loop> loops) throws InterruptedException {
if (parts.isEmpty()) {
return null;
}
@@ -435,7 +438,7 @@ public class Graph {
return null;
}
public GraphPart getMostCommonPart(List<Object> localData, List<GraphPart> parts, List<Loop> loops) {
public GraphPart getMostCommonPart(List<Object> localData, List<GraphPart> parts, List<Loop> loops) throws InterruptedException {
if (parts.isEmpty()) {
return null;
}
@@ -576,13 +579,13 @@ public class Graph {
return part;
}
public static List<GraphTargetItem> translateViaGraph(List<Object> localData, String path, GraphSource code, List<Integer> alternateEntries, int staticOperation) {
public static List<GraphTargetItem> translateViaGraph(List<Object> localData, String path, GraphSource code, List<Integer> alternateEntries, int staticOperation) throws InterruptedException {
Graph g = new Graph(code, alternateEntries);
g.init(localData);
return g.translate(localData, staticOperation, path);
}
public List<GraphTargetItem> translate(List<Object> localData, int staticOperation, String path) {
public List<GraphTargetItem> translate(List<Object> localData, int staticOperation, String path) throws InterruptedException {
List<GraphPart> allParts = new ArrayList<>();
for (GraphPart head : heads) {
populateParts(head, allParts);
@@ -778,7 +781,7 @@ public class Graph {
return false;
}
protected List<GraphTargetItem> check(GraphSource code, List<Object> localData, List<GraphPart> allParts, Stack<GraphTargetItem> stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) {
protected List<GraphTargetItem> check(GraphSource code, List<Object> localData, List<GraphPart> allParts, Stack<GraphTargetItem> stack, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> output, Loop currentLoop, int staticOperation, String path) throws InterruptedException {
return null;
}
@@ -787,13 +790,13 @@ public class Graph {
}
@SuppressWarnings("unchecked")
protected GraphTargetItem translatePartGetStack(List<Object> localData, GraphPart part, Stack<GraphTargetItem> stack, int staticOperation) {
protected GraphTargetItem translatePartGetStack(List<Object> localData, GraphPart part, Stack<GraphTargetItem> stack, int staticOperation) throws InterruptedException {
stack = (Stack<GraphTargetItem>) stack.clone();
translatePart(localData, part, stack, staticOperation, null);
return stack.pop();
}
protected List<GraphTargetItem> translatePart(List<Object> localData, GraphPart part, Stack<GraphTargetItem> stack, int staticOperation, String path) {
protected List<GraphTargetItem> translatePart(List<Object> localData, GraphPart part, Stack<GraphTargetItem> stack, int staticOperation, String path) throws InterruptedException {
List<GraphPart> sub = part.getSubParts();
List<GraphTargetItem> ret = new ArrayList<>();
int end;
@@ -854,7 +857,7 @@ public class Graph {
list.remove(list.size() - 1);
}
protected List<GraphTargetItem> printGraph(List<GraphPart> visited, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphPart> allParts, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, int staticOperation, String path) {
protected List<GraphTargetItem> printGraph(List<GraphPart> visited, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphPart> allParts, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, int staticOperation, String path) throws InterruptedException {
return printGraph(visited, localData, stack, allParts, parent, part, stopPart, loops, null, staticOperation, path);
}
@@ -862,7 +865,7 @@ public class Graph {
return loopItem;
}
private void getPrecontinues(List<Object> localData, GraphPart parent, GraphPart part, List<Loop> loops, List<GraphPart> stopPart) {
private void getPrecontinues(List<Object> localData, GraphPart parent, GraphPart part, List<Loop> loops, List<GraphPart> stopPart) throws InterruptedException {
markLevels(localData, part, loops);
//Note: this also marks part as precontinue when there is if
/*
@@ -914,13 +917,13 @@ public class Graph {
clearLoops(loops);*/
}
private void markLevels(List<Object> localData, GraphPart part, List<Loop> loops) {
private void markLevels(List<Object> localData, GraphPart part, List<Loop> loops) throws InterruptedException {
clearLoops(loops);
markLevels(localData, part, loops, new ArrayList<GraphPart>(), 1, new ArrayList<GraphPart>());
clearLoops(loops);
}
private void markLevels(List<Object> localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart, int level, List<GraphPart> visited) {
private void markLevels(List<Object> localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart, int level, List<GraphPart> visited) throws InterruptedException {
boolean debugMode = false;
if (stopPart == null) {
stopPart = new ArrayList<>();
@@ -1062,13 +1065,13 @@ public class Graph {
}
}
private void getLoops(List<Object> localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart) {
private void getLoops(List<Object> localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart) throws InterruptedException {
clearLoops(loops);
getLoops(localData, part, loops, stopPart, true, 1, new ArrayList<GraphPart>());
clearLoops(loops);
}
private void getLoops(List<Object> localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart, boolean first, int level, List<GraphPart> visited) {
private void getLoops(List<Object> localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart, boolean first, int level, List<GraphPart> visited) throws InterruptedException {
boolean debugMode = false;
if (stopPart == null) {
@@ -1349,7 +1352,7 @@ public class Graph {
}
}
protected List<GraphTargetItem> printGraph(List<GraphPart> visited, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphPart> allParts, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> ret, int staticOperation, String path) {
protected List<GraphTargetItem> printGraph(List<GraphPart> visited, List<Object> localData, Stack<GraphTargetItem> stack, List<GraphPart> allParts, GraphPart parent, GraphPart part, List<GraphPart> stopPart, List<Loop> loops, List<GraphTargetItem> ret, int staticOperation, String path) throws InterruptedException {
if (stopPart == null) {
stopPart = new ArrayList<>();
}
@@ -60,7 +60,11 @@ public class GraphPart implements Serializable {
return time;
}
private boolean leadsTo(List<Object> localData, Graph gr, GraphSource code, GraphPart part, List<GraphPart> visited, List<Loop> loops) {
private boolean leadsTo(List<Object> localData, Graph gr, GraphSource code, GraphPart part, List<GraphPart> visited, List<Loop> loops) throws InterruptedException {
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException();
}
GraphPart tpart = gr.checkPart(null, localData, this, null);
if (tpart == null) {
return false;
@@ -121,7 +125,7 @@ public class GraphPart implements Serializable {
return false;
}
public boolean leadsTo(List<Object> localData, Graph gr, GraphSource code, GraphPart part, List<Loop> loops) {
public boolean leadsTo(List<Object> localData, Graph gr, GraphSource code, GraphPart part, List<Loop> loops) throws InterruptedException {
for (Loop l : loops) {
l.leadsToMark = 0;
}
@@ -35,7 +35,7 @@ public abstract class GraphSource implements Serializable {
public abstract boolean isEmpty();
public abstract List<GraphTargetItem> translatePart(GraphPart part, List<Object> localData, Stack<GraphTargetItem> stack, int start, int end, int staticOperation, String path);
public abstract List<GraphTargetItem> translatePart(GraphPart part, List<Object> localData, Stack<GraphTargetItem> stack, int start, int end, int staticOperation, String path) throws InterruptedException;
private void visitCode(int ip, int lastIp, HashMap<Integer, List<Integer>> refs, int endIp) {
boolean debugMode = false;
@@ -26,7 +26,7 @@ import java.util.Stack;
*/
public interface GraphSourceItem extends Serializable {
public void translate(List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, int staticOperation, String path);
public void translate(List<Object> localData, Stack<GraphTargetItem> stack, List<GraphTargetItem> output, int staticOperation, String path) throws InterruptedException;
public boolean isJump();

Some files were not shown because too many files have changed in this diff Show More