mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-03 17:44:24 +00:00
Merge origin/master
This commit is contained in:
@@ -659,6 +659,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
if (hasEndTag) {
|
||||
sos.writeUI16(0);
|
||||
}
|
||||
|
||||
sos.close();
|
||||
os.write(Utf8Helper.getBytes(getHeaderBytes(compression, gfx)));
|
||||
os.write(version);
|
||||
@@ -711,6 +712,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
} else if (compression == SWFCompression.ZLIB) {
|
||||
os = new DeflaterOutputStream(os);
|
||||
}
|
||||
|
||||
os.write(data);
|
||||
} finally {
|
||||
if (os != null) {
|
||||
@@ -2028,11 +2030,13 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
|
||||
for (ASMSource src : actionsMap.keySet()) {
|
||||
actionsMap.get(src).removeNops();
|
||||
src.setActions(actionsMap.get(src));
|
||||
src.setModified();
|
||||
}
|
||||
|
||||
deobfuscation.deobfuscateInstanceNames(false, deobfuscated, renameType, tags, selected);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionEnd;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionNop;
|
||||
import com.jpexs.decompiler.flash.action.swf3.ActionGetURL;
|
||||
@@ -1565,11 +1564,10 @@ public class SWFInputStream implements AutoCloseable {
|
||||
/**
|
||||
* Reads one Action from the stream
|
||||
*
|
||||
* @param cpool
|
||||
* @return Action or null when ActionEndFlag or end of the stream
|
||||
* @throws IOException
|
||||
*/
|
||||
public Action readAction(ConstantPool cpool) throws IOException {
|
||||
public Action readAction() throws IOException {
|
||||
int actionCode = -1;
|
||||
|
||||
try {
|
||||
@@ -1603,7 +1601,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
case 0x09:
|
||||
return new ActionStopSounds();
|
||||
case 0x8A:
|
||||
return new ActionWaitForFrame(actionLength, this, cpool);
|
||||
return new ActionWaitForFrame(actionLength, this);
|
||||
case 0x8B:
|
||||
return new ActionSetTarget(actionLength, this, swf.version);
|
||||
case 0x8C:
|
||||
@@ -1684,7 +1682,7 @@ public class SWFInputStream implements AutoCloseable {
|
||||
case 0x28:
|
||||
return new ActionEndDrag();
|
||||
case 0x8D:
|
||||
return new ActionWaitForFrame2(actionLength, this, cpool);
|
||||
return new ActionWaitForFrame2(actionLength, this);
|
||||
case 0x26:
|
||||
return new ActionTrace();
|
||||
case 0x34:
|
||||
|
||||
@@ -153,11 +153,15 @@ public class SWFOutputStream extends OutputStream {
|
||||
/**
|
||||
* Writes UI8 (Unsigned 8bit integer) value to the stream
|
||||
*
|
||||
* @param val UI8 value to write
|
||||
* @param value UI8 value to write
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeUI8(int val) throws IOException {
|
||||
write(val);
|
||||
public void writeUI8(int value) throws IOException {
|
||||
if (value > 0xff) {
|
||||
throw new Error("Value is too large for UI8: " + value);
|
||||
}
|
||||
|
||||
write(value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +171,14 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeString(String value) throws IOException {
|
||||
write(Utf8Helper.getBytes(value));
|
||||
byte[] data = Utf8Helper.getBytes(value);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (data[i] == 0) {
|
||||
throw new IOException("String should not contain null character.");
|
||||
}
|
||||
}
|
||||
|
||||
write(data);
|
||||
write(0);
|
||||
}
|
||||
|
||||
@@ -178,6 +189,10 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeUI32(long value) throws IOException {
|
||||
if (value > 0xffffffffL) {
|
||||
throw new Error("Value is too large for UI32: " + value);
|
||||
}
|
||||
|
||||
write((int) (value & 0xff));
|
||||
write((int) ((value >> 8) & 0xff));
|
||||
write((int) ((value >> 16) & 0xff));
|
||||
@@ -191,6 +206,10 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeUI16(int value) throws IOException {
|
||||
if (value > 0xffff) {
|
||||
throw new Error("Value is too large for UI16: " + value);
|
||||
}
|
||||
|
||||
write((int) (value & 0xff));
|
||||
write((int) ((value >> 8) & 0xff));
|
||||
}
|
||||
@@ -202,6 +221,10 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeSI32(long value) throws IOException {
|
||||
if (value > 0x7fffffffL) {
|
||||
throw new Error("Value is too large for SI32: " + value);
|
||||
}
|
||||
|
||||
writeUI32(value);
|
||||
}
|
||||
|
||||
@@ -212,6 +235,10 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeSI16(int value) throws IOException {
|
||||
if (value > 0x7fff) {
|
||||
throw new Error("Value is too large for SI16: " + value);
|
||||
}
|
||||
|
||||
writeUI16(value);
|
||||
}
|
||||
|
||||
@@ -222,6 +249,10 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeSI8(int value) throws IOException {
|
||||
if (value > 0x7ff) {
|
||||
throw new Error("Value is too large for SI8: " + value);
|
||||
}
|
||||
|
||||
writeUI8(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
@@ -131,13 +131,11 @@ public class ActionListReader {
|
||||
* @throws java.lang.InterruptedException
|
||||
*/
|
||||
public static ActionList readActionList(List<DisassemblyListener> listeners, SWFInputStream sis, int version, int ip, int endIp, String path, int deobfuscationMode) throws IOException, InterruptedException {
|
||||
ConstantPool cpool = new ConstantPool();
|
||||
|
||||
// Map of the actions. Use TreeMap to sort the keys in ascending order
|
||||
// actionMap and nextOffsets should contain exaclty the same keys
|
||||
Map<Long, Action> actionMap = new TreeMap<>();
|
||||
Map<Long, Long> nextOffsets = new HashMap<>();
|
||||
Action entryAction = readActionListAtPos(listeners, cpool,
|
||||
Action entryAction = readActionListAtPos(listeners, null,
|
||||
sis, actionMap, nextOffsets,
|
||||
ip, 0, endIp, path, false, new ArrayList<Long>());
|
||||
|
||||
@@ -238,12 +236,10 @@ public class ActionListReader {
|
||||
}
|
||||
|
||||
public static List<Action> getOriginalActions(SWFInputStream sis, int startIp, int endIp) throws IOException, InterruptedException {
|
||||
ConstantPool cpool = new ConstantPool();
|
||||
|
||||
// Map of the actions. Use TreeMap to sort the keys in ascending order
|
||||
Map<Long, Action> actionMap = new TreeMap<>();
|
||||
Map<Long, Long> nextOffsets = new HashMap<>();
|
||||
readActionListAtPos(new ArrayList<DisassemblyListener>(), cpool,
|
||||
readActionListAtPos(new ArrayList<DisassemblyListener>(), null,
|
||||
sis, actionMap, nextOffsets,
|
||||
startIp, startIp, endIp + 1, "", false, new ArrayList<Long>());
|
||||
|
||||
@@ -690,7 +686,7 @@ public class ActionListReader {
|
||||
sis.seek((int) ip);
|
||||
|
||||
Action a;
|
||||
if ((a = sis.readAction(cpool)) == null) {
|
||||
if ((a = sis.readAction()) == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -729,10 +725,7 @@ public class ActionListReader {
|
||||
if (a instanceof ActionPush && cpool != null) {
|
||||
((ActionPush) a).constantPool = cpool.constants;
|
||||
} else if (a instanceof ActionConstantPool) {
|
||||
if (cpool == null) {
|
||||
cpool = new ConstantPool();
|
||||
}
|
||||
cpool.setNew(((ActionConstantPool) a).constantPool);
|
||||
cpool = new ConstantPool(((ActionConstantPool) a).constantPool);
|
||||
} else if (a instanceof ActionIf) {
|
||||
ActionIf aIf = (ActionIf) a;
|
||||
long nIp = ip + actionLengthWithHeader + aIf.getJumpOffset();
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.parser.pcode;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
@@ -128,14 +129,16 @@ import com.jpexs.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ASMParser {
|
||||
|
||||
|
||||
public static ActionList parse(boolean ignoreNops, List<Label> labels, Map<Action, Integer> lineMap, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ActionParseException {
|
||||
ActionList list = new ActionList();
|
||||
Stack<GraphSourceItemContainer> containers = new Stack<>();
|
||||
|
||||
@@ -192,6 +195,7 @@ public class ASMParser {
|
||||
}
|
||||
if (a != null) {
|
||||
list.add(a);
|
||||
lineMap.put(a, lexer.yyline());
|
||||
}
|
||||
} else if (symb.type == ASMParsedSymbol.TYPE_EOL) {
|
||||
} else if ((symb.type == ASMParsedSymbol.TYPE_BLOCK_END) || (symb.type == ASMParsedSymbol.TYPE_EOF)) {
|
||||
@@ -464,7 +468,8 @@ public class ASMParser {
|
||||
|
||||
lexer = new FlasmLexer(new StringReader(source));
|
||||
List<Label> labels = new ArrayList<>();
|
||||
List<Label> labels = new ArrayList<>();
|
||||
Map<Action, Integer> lineMap = new HashMap<>();
|
||||
ActionList ret = parse(ignoreNops, labels, lineMap, address, lexer, constantPool, version);
|
||||
//Action.setActionsAddresses(ret, address, version);
|
||||
for (Action link : ret) {
|
||||
if (!(link instanceof ActionIf || link instanceof ActionJump)) {
|
||||
@@ -480,7 +485,22 @@ public class ASMParser {
|
||||
ActionJump actionJump = (ActionJump) link;
|
||||
|
||||
if (actionJump.identifier.equals(label.name)) {
|
||||
if (actionJump.identifier.equals(label.name)) {
|
||||
int offset = (int) (label.address - (actionJump.getAddress() + actionJump.getTotalActionLength()));
|
||||
if (offset < -0x8000 || offset > 0x7fff) {
|
||||
String message = "Jump offset is too large:" + offset + " addr: ofs" + Helper.formatAddress(link.getAddress());
|
||||
if (throwOnError) {
|
||||
Integer line = lineMap.get(link);
|
||||
if (line == null) {
|
||||
line = -1;
|
||||
}
|
||||
|
||||
throw new ActionParseException(message, line);
|
||||
} else {
|
||||
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, message);
|
||||
}
|
||||
}
|
||||
|
||||
actionJump.setJumpOffset(offset);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -491,7 +511,22 @@ public class ASMParser {
|
||||
|
||||
for (Label label : labels) {
|
||||
if (actionIf.identifier.equals(label.name)) {
|
||||
if (actionIf.identifier.equals(label.name)) {
|
||||
int offset = (int) (label.address - (actionIf.getAddress() + actionIf.getTotalActionLength()));
|
||||
if (offset < -0x8000 || offset > 0x7fff) {
|
||||
String message = "If offset is too large:" + offset + " addr: ofs" + Helper.formatAddress(link.getAddress());
|
||||
if (throwOnError) {
|
||||
Integer line = lineMap.get(link);
|
||||
if (line == null) {
|
||||
line = -1;
|
||||
}
|
||||
|
||||
throw new ActionParseException(message, line);
|
||||
} else {
|
||||
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, message);
|
||||
}
|
||||
}
|
||||
|
||||
actionIf.setJumpOffset(offset);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -499,13 +534,20 @@ public class ASMParser {
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
String message = "TARGET NOT FOUND - identifier:" + identifier + " addr: ofs" + Helper.formatAddress(link.getAddress());
|
||||
if (throwOnError) {
|
||||
if (throwOnError) {
|
||||
Integer line = lineMap.get(link);
|
||||
if (line == null) {
|
||||
line = -1;
|
||||
}
|
||||
|
||||
throw new ActionParseException(message, line);
|
||||
} else {
|
||||
} else {
|
||||
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
@@ -46,7 +45,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
|
||||
|
||||
public List<Action> skipped;
|
||||
|
||||
public ActionWaitForFrame(int actionLength, SWFInputStream sis, ConstantPool cpool) throws IOException {
|
||||
public ActionWaitForFrame(int actionLength, SWFInputStream sis) throws IOException {
|
||||
super(0x8A, actionLength);
|
||||
frame = sis.readUI16("frame");
|
||||
skipCount = sis.readUI8("skipCount");
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionGraph;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.model.clauses.IfFrameLoadedActionItem;
|
||||
import com.jpexs.decompiler.flash.action.parser.ActionParseException;
|
||||
import com.jpexs.decompiler.flash.action.parser.pcode.FlasmLexer;
|
||||
@@ -60,7 +59,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
|
||||
skipCount = store.size();
|
||||
}
|
||||
|
||||
public ActionWaitForFrame2(int actionLength, SWFInputStream sis, ConstantPool cpool) throws IOException {
|
||||
public ActionWaitForFrame2(int actionLength, SWFInputStream sis) throws IOException {
|
||||
super(0x8D, actionLength);
|
||||
skipCount = sis.readUI8("skipCount");
|
||||
skipped = new ArrayList<>();
|
||||
|
||||
@@ -46,6 +46,7 @@ public class ConstantIndex implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "constant" + index;
|
||||
}
|
||||
|
||||
@@ -58,6 +59,7 @@ public class ConstantIndex implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "constant" + index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, getVersion(), prevLength, prevLength + actionBytes.getLength(), toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -282,6 +282,14 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
super.setModified(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createOriginalData() {
|
||||
super.createOriginalData();
|
||||
for (Tag subTag : subTags) {
|
||||
subTag.createOriginalData();
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
rectCache.clear();
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ public class DoActionTag extends Tag implements ASMSource {
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, getVersion(), prevLength, prevLength + actionBytes.getLength(), toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -138,6 +138,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, getVersion(), prevLength, prevLength + actionBytes.getLength(), toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -205,6 +205,7 @@ public class BUTTONCONDACTION implements ASMSource, Serializable {
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, swf.version, prevLength, prevLength + actionBytes.getLength(), toString()/*FIXME?*/);
|
||||
return list;
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable {
|
||||
if (prevLength != 0) {
|
||||
rri.seek(prevLength);
|
||||
}
|
||||
|
||||
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, swf.version, prevLength, prevLength + actionBytes.getLength(), toString()/*FIXME?*/);
|
||||
return list;
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -144,6 +144,12 @@
|
||||
<script>nbproject/nbjdk.xml</script>
|
||||
<build-target>build</build-target>
|
||||
</export>
|
||||
<export>
|
||||
<type>folder</type>
|
||||
<location>reports</location>
|
||||
<script>nbproject/nbjdk.xml</script>
|
||||
<build-target>build</build-target>
|
||||
</export>
|
||||
<export>
|
||||
<type>folder</type>
|
||||
<location>build/test</location>
|
||||
@@ -218,6 +224,8 @@
|
||||
<built-to>javadoc</built-to>
|
||||
<built-to>reports</built-to>
|
||||
<built-to>locales</built-to>
|
||||
<built-to>reports</built-to>
|
||||
<javadoc-built-to>javadoc</javadoc-built-to>
|
||||
<source-level>1.8</source-level>
|
||||
</compilation-unit>
|
||||
<compilation-unit>
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ActionRedirector implements ActionListener {
|
||||
|
||||
ActionListener target;
|
||||
|
||||
String actionCommand;
|
||||
|
||||
public ActionRedirector(ActionListener target, String actionCommand) {
|
||||
this.target = target;
|
||||
this.actionCommand = actionCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
e = new ActionEvent(e.getSource(), e.getID(), actionCommand);
|
||||
target.actionPerformed(e);
|
||||
}
|
||||
}
|
||||
@@ -20,98 +20,19 @@ import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.console.ContextMenuTools;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import com.sun.jna.Platform;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MainFrameClassicMenu extends MainFrameMenu implements ActionListener {
|
||||
|
||||
private static final String ACTION_RELOAD = "RELOAD";
|
||||
|
||||
private static final String ACTION_ADVANCED_SETTINGS = "ADVANCEDSETTINGS";
|
||||
|
||||
private static final String ACTION_LOAD_MEMORY = "LOADMEMORY";
|
||||
|
||||
private static final String ACTION_LOAD_CACHE = "LOADCACHE";
|
||||
|
||||
private static final String ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP = "GOTODOCUMENTCLASSONSTARTUP";
|
||||
|
||||
private static final String ACTION_AUTO_RENAME_IDENTIFIERS = "AUTORENAMEIDENTIFIERS";
|
||||
|
||||
private static final String ACTION_CACHE_ON_DISK = "CACHEONDISK";
|
||||
|
||||
private static final String ACTION_SET_LANGUAGE = "SETLANGUAGE";
|
||||
|
||||
private static final String ACTION_DISABLE_DECOMPILATION = "DISABLEDECOMPILATION";
|
||||
|
||||
private static final String ACTION_ASSOCIATE = "ASSOCIATE";
|
||||
|
||||
private static final String ACTION_GOTO_DOCUMENT_CLASS = "GOTODOCUMENTCLASS";
|
||||
|
||||
private static final String ACTION_PARALLEL_SPEED_UP = "PARALLELSPEEDUP";
|
||||
|
||||
private static final String ACTION_INTERNAL_VIEWER_SWITCH = "INTERNALVIEWERSWITCH";
|
||||
|
||||
private static final String ACTION_SEARCH = "SEARCH";
|
||||
|
||||
private static final String ACTION_AUTO_DEOBFUSCATE = "AUTODEOBFUSCATE";
|
||||
|
||||
private static final String ACTION_EXIT = "EXIT";
|
||||
|
||||
private static final String ACTION_RENAME_ONE_IDENTIFIER = "RENAMEONEIDENTIFIER";
|
||||
|
||||
private static final String ACTION_ABOUT = "ABOUT";
|
||||
|
||||
private static final String ACTION_SHOW_PROXY = "SHOWPROXY";
|
||||
|
||||
private static final String ACTION_SUB_LIMITER = "SUBLIMITER";
|
||||
|
||||
private static final String ACTION_SAVE = "SAVE";
|
||||
|
||||
private static final String ACTION_SAVE_AS = "SAVEAS";
|
||||
|
||||
private static final String ACTION_SAVE_AS_EXE = "SAVEASEXE";
|
||||
|
||||
private static final String ACTION_OPEN = "OPEN";
|
||||
|
||||
private static final String ACTION_EXPORT_FLA = "EXPORTFLA";
|
||||
|
||||
private static final String ACTION_EXPORT_SEL = "EXPORTSEL";
|
||||
|
||||
private static final String ACTION_EXPORT = "EXPORT";
|
||||
|
||||
private static final String ACTION_CHECK_UPDATES = "CHECKUPDATES";
|
||||
|
||||
private static final String ACTION_HELP_US = "HELPUS";
|
||||
|
||||
private static final String ACTION_HOMEPAGE = "HOMEPAGE";
|
||||
|
||||
private static final String ACTION_RESTORE_CONTROL_FLOW = "RESTORECONTROLFLOW";
|
||||
|
||||
private static final String ACTION_RESTORE_CONTROL_FLOW_ALL = "RESTORECONTROLFLOWALL";
|
||||
|
||||
private static final String ACTION_RENAME_IDENTIFIERS = "RENAMEIDENTIFIERS";
|
||||
|
||||
private static final String ACTION_DEOBFUSCATE = "DEOBFUSCATE";
|
||||
|
||||
private static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
|
||||
|
||||
private static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS";
|
||||
|
||||
private static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED";
|
||||
public class MainFrameClassicMenu extends MainFrameMenu {
|
||||
|
||||
private final MainFrameClassic mainFrame;
|
||||
|
||||
@@ -131,30 +52,6 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
|
||||
private JCheckBoxMenuItem miAutoRenameIdentifiers;
|
||||
|
||||
private JMenuItem saveCommandButton;
|
||||
|
||||
private JMenuItem saveasCommandButton;
|
||||
|
||||
private JMenuItem saveasexeCommandButton;
|
||||
|
||||
private JMenuItem exportAllCommandButton;
|
||||
|
||||
private JMenuItem exportFlaCommandButton;
|
||||
|
||||
private JMenuItem exportSelectionCommandButton;
|
||||
|
||||
private JMenuItem reloadCommandButton;
|
||||
|
||||
private JMenuItem renameInvalidCommandButton;
|
||||
|
||||
private JMenuItem globalRenameCommandButton;
|
||||
|
||||
private JMenuItem deobfuscationCommandButton;
|
||||
|
||||
private JMenuItem searchCommandButton;
|
||||
|
||||
private JMenuItem gotoDocumentClassCommandButton;
|
||||
|
||||
public MainFrameClassicMenu(MainFrameClassic mainFrame, boolean externalFlashPlayerUnavailable) {
|
||||
super(mainFrame);
|
||||
this.mainFrame = mainFrame;
|
||||
@@ -167,16 +64,6 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
return miInternalViewer.isSelected();
|
||||
}
|
||||
|
||||
private void assignListener(JMenuItem b, final String command) {
|
||||
final MainFrameClassicMenu t = this;
|
||||
b.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
t.actionPerformed(new ActionEvent(e.getSource(), 0, command));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String fixCommandTitle(String title) {
|
||||
if (title.length() > 2) {
|
||||
if (title.charAt(1) == ' ') {
|
||||
@@ -192,32 +79,25 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
JMenu menuFile = new JMenu(translate("menu.file"));
|
||||
JMenuItem miOpen = new JMenuItem(translate("menu.file.open"));
|
||||
miOpen.setIcon(View.getIcon("open16"));
|
||||
miOpen.setActionCommand(ACTION_OPEN);
|
||||
miOpen.addActionListener(this);
|
||||
miOpen.addActionListener(this::open);
|
||||
JMenuItem miSave = new JMenuItem(translate("menu.file.save"));
|
||||
miSave.setIcon(View.getIcon("save16"));
|
||||
miSave.setActionCommand(ACTION_SAVE);
|
||||
miSave.addActionListener(this);
|
||||
miSave.addActionListener(this::save);
|
||||
JMenuItem miSaveAs = new JMenuItem(translate("menu.file.saveas"));
|
||||
miSaveAs.setIcon(View.getIcon("saveas16"));
|
||||
miSaveAs.setActionCommand(ACTION_SAVE_AS);
|
||||
miSaveAs.addActionListener(this);
|
||||
miSaveAs.addActionListener(this::saveAs);
|
||||
JMenuItem miSaveAsExe = new JMenuItem(translate("menu.file.saveasexe"));
|
||||
miSaveAsExe.setIcon(View.getIcon("saveas16"));
|
||||
miSaveAsExe.setActionCommand(ACTION_SAVE_AS_EXE);
|
||||
miSaveAsExe.addActionListener(this);
|
||||
miSaveAsExe.addActionListener(this::saveAsExe);
|
||||
|
||||
JMenuItem menuExportFla = new JMenuItem(translate("menu.file.export.fla"));
|
||||
menuExportFla.setActionCommand(ACTION_EXPORT_FLA);
|
||||
menuExportFla.addActionListener(this);
|
||||
menuExportFla.addActionListener(this::exportFla);
|
||||
menuExportFla.setIcon(View.getIcon("flash16"));
|
||||
|
||||
JMenuItem menuExportAll = new JMenuItem(translate("menu.file.export.all"));
|
||||
menuExportAll.setActionCommand(ACTION_EXPORT);
|
||||
menuExportAll.addActionListener(this);
|
||||
menuExportAll.addActionListener(this::exportAll);
|
||||
JMenuItem menuExportSel = new JMenuItem(translate("menu.file.export.selection"));
|
||||
menuExportSel.setActionCommand(ACTION_EXPORT_SEL);
|
||||
menuExportSel.addActionListener(this);
|
||||
menuExportSel.addActionListener(this::exportSelected);
|
||||
menuExportAll.setIcon(View.getIcon("export16"));
|
||||
menuExportSel.setIcon(View.getIcon("exportsel16"));
|
||||
|
||||
@@ -231,42 +111,37 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
menuFile.addSeparator();
|
||||
JMenuItem miClose = new JMenuItem(translate("menu.file.exit"));
|
||||
miClose.setIcon(View.getIcon("exit16"));
|
||||
miClose.setActionCommand(ACTION_EXIT);
|
||||
miClose.addActionListener(this);
|
||||
miClose.addActionListener(this::exit);
|
||||
menuFile.add(miClose);
|
||||
menuBar.add(menuFile);
|
||||
JMenu menuDeobfuscation = new JMenu(translate("menu.tools.deobfuscation"));
|
||||
menuDeobfuscation.setIcon(View.getIcon("deobfuscate16"));
|
||||
|
||||
JMenuItem miDeobfuscation = new JMenuItem(translate("menu.tools.deobfuscation.pcode"));
|
||||
miDeobfuscation.setActionCommand(ACTION_DEOBFUSCATE);
|
||||
miDeobfuscation.addActionListener(this);
|
||||
miDeobfuscation.addActionListener(this::deobfuscate);
|
||||
|
||||
miAutoDeobfuscation = new JCheckBoxMenuItem(translate("menu.settings.autodeobfuscation"));
|
||||
miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
|
||||
miAutoDeobfuscation.addActionListener(this);
|
||||
miAutoDeobfuscation.setActionCommand(ACTION_AUTO_DEOBFUSCATE);
|
||||
miAutoDeobfuscation.addActionListener(this::autoDeobfuscate);
|
||||
|
||||
JMenuItem miRenameOneIdentifier = new JMenuItem(translate("menu.tools.deobfuscation.globalrename"));
|
||||
miRenameOneIdentifier.setActionCommand(ACTION_RENAME_ONE_IDENTIFIER);
|
||||
miRenameOneIdentifier.addActionListener(this);
|
||||
miRenameOneIdentifier.addActionListener(this::renameOneIdentifier);
|
||||
|
||||
JMenuItem miRenameIdentifiers = new JMenuItem(translate("menu.tools.deobfuscation.renameinvalid"));
|
||||
miRenameIdentifiers.setActionCommand(ACTION_RENAME_IDENTIFIERS);
|
||||
miRenameIdentifiers.addActionListener(this);
|
||||
miRenameIdentifiers.addActionListener(this::renameIdentifiers);
|
||||
|
||||
menuDeobfuscation.add(miRenameOneIdentifier);
|
||||
menuDeobfuscation.add(miRenameIdentifiers);
|
||||
menuDeobfuscation.add(miDeobfuscation);
|
||||
JMenu menuTools = new JMenu(translate("menu.tools"));
|
||||
JMenuItem miProxy = new JMenuItem(translate("menu.tools.proxy"));
|
||||
miProxy.setActionCommand(ACTION_SHOW_PROXY);
|
||||
miProxy.setIcon(View.getIcon("proxy16"));
|
||||
miProxy.addActionListener(this);
|
||||
miProxy.addActionListener(this::showProxy);
|
||||
|
||||
JMenuItem miSearchScript = new JMenuItem(translate("menu.tools.searchas"));
|
||||
miSearchScript.addActionListener(this);
|
||||
miSearchScript.setActionCommand(ACTION_SEARCH);
|
||||
miSearchScript.addActionListener((ActionEvent e) -> {
|
||||
search(e, null);
|
||||
});
|
||||
miSearchScript.setIcon(View.getIcon("search16"));
|
||||
|
||||
menuTools.add(miSearchScript);
|
||||
@@ -276,42 +151,35 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
if (externalFlashPlayerUnavailable) {
|
||||
miInternalViewer.setEnabled(false);
|
||||
}
|
||||
miInternalViewer.setActionCommand(ACTION_INTERNAL_VIEWER_SWITCH);
|
||||
miInternalViewer.addActionListener(this);
|
||||
miInternalViewer.addActionListener(this::internalViewerSwitch);
|
||||
|
||||
miParallelSpeedUp = new JCheckBoxMenuItem(translate("menu.settings.parallelspeedup"));
|
||||
miParallelSpeedUp.setSelected(Configuration.parallelSpeedUp.get());
|
||||
miParallelSpeedUp.setActionCommand(ACTION_PARALLEL_SPEED_UP);
|
||||
miParallelSpeedUp.addActionListener(this);
|
||||
miParallelSpeedUp.addActionListener(this::parallelSpeedUp);
|
||||
|
||||
menuTools.add(miProxy);
|
||||
|
||||
menuTools.add(menuDeobfuscation);
|
||||
|
||||
JMenuItem miGotoDocumentClass = new JMenuItem(translate("menu.tools.gotodocumentclass"));
|
||||
miGotoDocumentClass.setActionCommand(ACTION_GOTO_DOCUMENT_CLASS);
|
||||
miGotoDocumentClass.addActionListener(this);
|
||||
miGotoDocumentClass.addActionListener(this::gotoDucumentClass);
|
||||
menuBar.add(menuTools);
|
||||
|
||||
miDecompile = new JCheckBoxMenuItem(translate("menu.settings.disabledecompilation"));
|
||||
miDecompile.setSelected(!Configuration.decompile.get());
|
||||
miDecompile.setActionCommand(ACTION_DISABLE_DECOMPILATION);
|
||||
miDecompile.addActionListener(this);
|
||||
miDecompile.addActionListener(this::disableDecompilation);
|
||||
|
||||
miCacheDisk = new JCheckBoxMenuItem(translate("menu.settings.cacheOnDisk"));
|
||||
miCacheDisk.setSelected(Configuration.cacheOnDisk.get());
|
||||
miCacheDisk.setActionCommand(ACTION_CACHE_ON_DISK);
|
||||
miCacheDisk.addActionListener(this);
|
||||
miCacheDisk.addActionListener(this::cacheOnDisk);
|
||||
|
||||
miGotoMainClassOnStartup = new JCheckBoxMenuItem(translate("menu.settings.gotoMainClassOnStartup"));
|
||||
miGotoMainClassOnStartup.setSelected(Configuration.gotoMainClassOnStartup.get());
|
||||
miGotoMainClassOnStartup.setActionCommand(ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP);
|
||||
miGotoMainClassOnStartup.addActionListener(this);
|
||||
miGotoMainClassOnStartup.addActionListener(this::gotoDucumentClassOnStartup);
|
||||
|
||||
miAutoRenameIdentifiers = new JCheckBoxMenuItem(translate("menu.settings.autoRenameIdentifiers"));
|
||||
miAutoRenameIdentifiers.setSelected(Configuration.autoRenameIdentifiers.get());
|
||||
miAutoRenameIdentifiers.setActionCommand(ACTION_AUTO_RENAME_IDENTIFIERS);
|
||||
miAutoRenameIdentifiers.addActionListener(this);
|
||||
miAutoRenameIdentifiers.addActionListener(this::autoRenameIdentifiers);
|
||||
|
||||
JMenu menuSettings = new JMenu(translate("menu.settings"));
|
||||
menuSettings.add(miAutoDeobfuscation);
|
||||
@@ -323,13 +191,11 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
menuSettings.add(miAutoRenameIdentifiers);
|
||||
|
||||
miAssociate = new JCheckBoxMenuItem(translate("menu.settings.addtocontextmenu"));
|
||||
miAssociate.setActionCommand(ACTION_ASSOCIATE);
|
||||
miAssociate.addActionListener(this);
|
||||
miAssociate.addActionListener(this::associate);
|
||||
miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
|
||||
|
||||
JMenuItem miLanguage = new JMenuItem(translate("menu.settings.language"));
|
||||
miLanguage.setActionCommand(ACTION_SET_LANGUAGE);
|
||||
miLanguage.addActionListener(this);
|
||||
miLanguage.addActionListener(this::setLanguage);
|
||||
|
||||
if (Platform.isWindows()) {
|
||||
menuSettings.add(miAssociate);
|
||||
@@ -337,33 +203,27 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
menuSettings.add(miLanguage);
|
||||
|
||||
JMenuItem advancedSettingsCommandButton = new JMenuItem(translate("menu.advancedsettings.advancedsettings"));
|
||||
advancedSettingsCommandButton.setActionCommand(ACTION_ADVANCED_SETTINGS);
|
||||
advancedSettingsCommandButton.setIcon(View.getIcon("settings16"));
|
||||
advancedSettingsCommandButton.addActionListener(this);
|
||||
advancedSettingsCommandButton.addActionListener(this::advancedSettings);
|
||||
menuSettings.add(advancedSettingsCommandButton);
|
||||
|
||||
menuBar.add(menuSettings);
|
||||
JMenu menuHelp = new JMenu(translate("menu.help"));
|
||||
JMenuItem miAbout = new JMenuItem(translate("menu.help.about"));
|
||||
miAbout.setIcon(View.getIcon("about16"));
|
||||
|
||||
miAbout.setActionCommand(ACTION_ABOUT);
|
||||
miAbout.addActionListener(this);
|
||||
miAbout.addActionListener(this::about);
|
||||
|
||||
JMenuItem miCheckUpdates = new JMenuItem(translate("menu.help.checkupdates"));
|
||||
miCheckUpdates.setActionCommand(ACTION_CHECK_UPDATES);
|
||||
miCheckUpdates.setIcon(View.getIcon("update16"));
|
||||
miCheckUpdates.addActionListener(this);
|
||||
miCheckUpdates.addActionListener(this::checkUpdates);
|
||||
|
||||
JMenuItem miHelpUs = new JMenuItem(translate("menu.help.helpus"));
|
||||
miHelpUs.setActionCommand(ACTION_HELP_US);
|
||||
miHelpUs.setIcon(View.getIcon("donate16"));
|
||||
miHelpUs.addActionListener(this);
|
||||
miHelpUs.addActionListener(this::helpUs);
|
||||
|
||||
JMenuItem miHomepage = new JMenuItem(translate("menu.help.homepage"));
|
||||
miHomepage.setActionCommand(ACTION_HOMEPAGE);
|
||||
miHomepage.setIcon(View.getIcon("homepage16"));
|
||||
miHomepage.addActionListener(this);
|
||||
miHomepage.addActionListener(this::homePage);
|
||||
|
||||
menuHelp.add(miCheckUpdates);
|
||||
menuHelp.add(miHelpUs);
|
||||
@@ -401,157 +261,4 @@ public class MainFrameClassicMenu extends MainFrameMenu implements ActionListene
|
||||
gotoDocumentClassCommandButton.setEnabled(hasAbc);
|
||||
deobfuscationCommandButton.setEnabled(hasAbc);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_RELOAD:
|
||||
reload(null);
|
||||
break;
|
||||
case ACTION_ADVANCED_SETTINGS:
|
||||
advancedSettings(null);
|
||||
break;
|
||||
case ACTION_LOAD_MEMORY:
|
||||
loadFromMemory(null);
|
||||
break;
|
||||
case ACTION_LOAD_CACHE:
|
||||
loadFromCache(null);
|
||||
break;
|
||||
case ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP:
|
||||
Configuration.gotoMainClassOnStartup.set(miGotoMainClassOnStartup.isSelected());
|
||||
break;
|
||||
case ACTION_AUTO_RENAME_IDENTIFIERS:
|
||||
Configuration.autoRenameIdentifiers.set(miAutoRenameIdentifiers.isSelected());
|
||||
break;
|
||||
case ACTION_CACHE_ON_DISK:
|
||||
Configuration.cacheOnDisk.set(miCacheDisk.isSelected());
|
||||
if (miCacheDisk.isSelected()) {
|
||||
Cache.setStorageType(Cache.STORAGE_FILES);
|
||||
} else {
|
||||
Cache.setStorageType(Cache.STORAGE_MEMORY);
|
||||
}
|
||||
break;
|
||||
case ACTION_SET_LANGUAGE:
|
||||
setLanguage();
|
||||
break;
|
||||
case ACTION_DISABLE_DECOMPILATION:
|
||||
Configuration.decompile.set(!miDecompile.isSelected());
|
||||
mainFrame.getPanel().disableDecompilationChanged();
|
||||
break;
|
||||
case ACTION_ASSOCIATE:
|
||||
if (miAssociate.isSelected() == ContextMenuTools.isAddedToContextMenu()) {
|
||||
return;
|
||||
}
|
||||
ContextMenuTools.addToContextMenu(miAssociate.isSelected(), false);
|
||||
|
||||
// Update checkbox menuitem accordingly (User can cancel rights elevation)
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
|
||||
}
|
||||
}, 1000); // It takes some time registry change to apply
|
||||
break;
|
||||
case ACTION_GOTO_DOCUMENT_CLASS:
|
||||
mainFrame.getPanel().gotoDocumentClass(mainFrame.getPanel().getCurrentSwf());
|
||||
break;
|
||||
case ACTION_PARALLEL_SPEED_UP:
|
||||
String confStr = translate("message.confirm.parallel") + "\r\n";
|
||||
if (miParallelSpeedUp.isSelected()) {
|
||||
confStr += " " + translate("message.confirm.on");
|
||||
} else {
|
||||
confStr += " " + translate("message.confirm.off");
|
||||
}
|
||||
if (View.showConfirmDialog(null, confStr, translate("message.parallel"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.parallelSpeedUp.set((Boolean) miParallelSpeedUp.isSelected());
|
||||
} else {
|
||||
miParallelSpeedUp.setSelected(!miParallelSpeedUp.isSelected());
|
||||
}
|
||||
break;
|
||||
case ACTION_INTERNAL_VIEWER_SWITCH:
|
||||
Configuration.internalFlashViewer.set(miInternalViewer.isSelected());
|
||||
mainFrame.getPanel().reload(true);
|
||||
break;
|
||||
case ACTION_SEARCH:
|
||||
search(null);
|
||||
break;
|
||||
case ACTION_AUTO_DEOBFUSCATE:
|
||||
if (View.showConfirmDialog(mainFrame.getPanel(), translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected());
|
||||
mainFrame.getPanel().autoDeobfuscateChanged();
|
||||
} else {
|
||||
miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected());
|
||||
}
|
||||
break;
|
||||
case ACTION_EXIT:
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_RENAME_ONE_IDENTIFIER:
|
||||
renameOneIdentifier();
|
||||
break;
|
||||
case ACTION_SHOW_PROXY:
|
||||
showProxy();
|
||||
break;
|
||||
case ACTION_SUB_LIMITER:
|
||||
setSubLimiter(((JCheckBoxMenuItem) e.getSource()).isSelected());
|
||||
break;
|
||||
case ACTION_SAVE:
|
||||
save();
|
||||
break;
|
||||
case ACTION_SAVE_AS:
|
||||
saveAs();
|
||||
break;
|
||||
case ACTION_SAVE_AS_EXE:
|
||||
saveAsExe();
|
||||
break;
|
||||
case ACTION_OPEN:
|
||||
open();
|
||||
break;
|
||||
case ACTION_EXPORT_SEL:
|
||||
case ACTION_EXPORT:
|
||||
boolean onlySel = e.getActionCommand().equals(ACTION_EXPORT_SEL);
|
||||
export(onlySel);
|
||||
break;
|
||||
case ACTION_EXPORT_FLA:
|
||||
exportFla();
|
||||
break;
|
||||
case ACTION_CHECK_UPDATES:
|
||||
checkUpdates();
|
||||
break;
|
||||
case ACTION_HELP_US:
|
||||
helpUs();
|
||||
break;
|
||||
case ACTION_HOMEPAGE:
|
||||
homePage();
|
||||
break;
|
||||
case ACTION_ABOUT:
|
||||
about();
|
||||
break;
|
||||
case ACTION_RESTORE_CONTROL_FLOW:
|
||||
case ACTION_RESTORE_CONTROL_FLOW_ALL:
|
||||
boolean all = e.getActionCommand().equals(ACTION_RESTORE_CONTROL_FLOW_ALL);
|
||||
restoreControlFlow(all);
|
||||
break;
|
||||
case ACTION_RENAME_IDENTIFIERS:
|
||||
renameIdentifiers();
|
||||
break;
|
||||
case ACTION_DEOBFUSCATE:
|
||||
case ACTION_DEOBFUSCATE_ALL:
|
||||
deobfuscate();
|
||||
break;
|
||||
case ACTION_REMOVE_NON_SCRIPTS:
|
||||
removeNonScripts();
|
||||
break;
|
||||
case ACTION_REFRESH_DECOMPILED:
|
||||
refreshDecompiled();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,11 @@ import com.jpexs.decompiler.flash.ApplicationInfo;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFBundle;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.console.ContextMenuTools;
|
||||
import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
|
||||
import com.jpexs.decompiler.flash.gui.helpers.CheckResources;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Container;
|
||||
@@ -37,8 +39,11 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
@@ -65,12 +70,20 @@ public abstract class MainFrameMenu {
|
||||
return mainFrame.translate(key);
|
||||
}
|
||||
|
||||
protected boolean open() {
|
||||
protected boolean open(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Main.openFileDialog();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean save() {
|
||||
protected boolean save(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swf != null) {
|
||||
boolean saved = false;
|
||||
if (swf.swfList != null && swf.swfList.isBundle()) {
|
||||
@@ -107,6 +120,7 @@ public abstract class MainFrameMenu {
|
||||
}
|
||||
if (saved) {
|
||||
swf.clearModified();
|
||||
mainFrame.getPanel().refreshTree(swf);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -115,7 +129,11 @@ public abstract class MainFrameMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean saveAs() {
|
||||
protected boolean saveAs(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swf != null) {
|
||||
if (saveAs(swf, SaveFileMode.SAVEAS)) {
|
||||
swf.clearModified();
|
||||
@@ -136,13 +154,21 @@ public abstract class MainFrameMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void saveAsExe() {
|
||||
protected void saveAsExe(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (swf != null) {
|
||||
saveAs(swf, SaveFileMode.EXE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
protected void close(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (swf == null) {
|
||||
return;
|
||||
}
|
||||
@@ -150,7 +176,11 @@ public abstract class MainFrameMenu {
|
||||
Main.closeFile(swf.swfList);
|
||||
}
|
||||
|
||||
protected boolean closeAll() {
|
||||
protected boolean closeAll(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swf != null) {
|
||||
Main.closeAll();
|
||||
return true;
|
||||
@@ -159,18 +189,46 @@ public abstract class MainFrameMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void importText() {
|
||||
protected void importText(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().importText(swf);
|
||||
}
|
||||
|
||||
protected void importScript() {
|
||||
protected void importScript(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().importScript(swf);
|
||||
}
|
||||
|
||||
protected void importSymbolClass() {
|
||||
protected void importSymbolClass(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().importSymbolClass(swf);
|
||||
}
|
||||
|
||||
protected void exportAll(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
export(false);
|
||||
}
|
||||
|
||||
protected void exportSelected(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
export(true);
|
||||
}
|
||||
|
||||
protected boolean export(boolean onlySelected) {
|
||||
if (swf != null) {
|
||||
mainFrame.getPanel().export(onlySelected);
|
||||
@@ -180,11 +238,31 @@ public abstract class MainFrameMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void exportFla() {
|
||||
protected void exportFla(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().exportFla(swf);
|
||||
}
|
||||
|
||||
protected boolean search(Boolean searchInText) {
|
||||
protected void importSwfXml(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().importSwfXml();
|
||||
}
|
||||
|
||||
protected void exportSwfXml(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().exportSwfXml();
|
||||
}
|
||||
|
||||
protected boolean search(ActionEvent evt, Boolean searchInText) {
|
||||
if (swf != null) {
|
||||
mainFrame.getPanel().searchInActionScriptOrText(searchInText);
|
||||
return true;
|
||||
@@ -193,7 +271,7 @@ public abstract class MainFrameMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean replace() {
|
||||
protected boolean replace(ActionEvent evt) {
|
||||
if (swf != null) {
|
||||
mainFrame.getPanel().replaceText();
|
||||
return true;
|
||||
@@ -202,11 +280,31 @@ public abstract class MainFrameMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void restoreControlFlow(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
restoreControlFlow(false);
|
||||
}
|
||||
|
||||
protected void restoreControlFlowAll(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
restoreControlFlow(true);
|
||||
}
|
||||
|
||||
protected void restoreControlFlow(boolean all) {
|
||||
mainFrame.getPanel().restoreControlFlow(all);
|
||||
}
|
||||
|
||||
protected void showProxy() {
|
||||
protected void showProxy(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Main.showProxy();
|
||||
}
|
||||
|
||||
@@ -215,32 +313,61 @@ public abstract class MainFrameMenu {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void renameOneIdentifier() {
|
||||
protected void renameOneIdentifier(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().renameOneIdentifier(swf);
|
||||
}
|
||||
|
||||
protected void renameIdentifiers() {
|
||||
protected void renameIdentifiers(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().renameIdentifiers(swf);
|
||||
}
|
||||
|
||||
protected void deobfuscate() {
|
||||
protected void deobfuscate(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainFrame.getPanel().deobfuscate();
|
||||
}
|
||||
|
||||
protected void setSubLimiter(boolean value) {
|
||||
Main.setSubLimiter(value);
|
||||
protected void setSubLimiter(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
Main.setSubLimiter(selected);
|
||||
}
|
||||
|
||||
protected void switchDebugger() {
|
||||
DebuggerTools.switchDebugger(swf);
|
||||
}
|
||||
|
||||
protected void debuggerShowLog() {
|
||||
protected void debuggerShowLog(ActionEvent evt) {
|
||||
DebuggerTools.debuggerShowLog();
|
||||
}
|
||||
|
||||
protected void replaceTraceCalls(String fname) {
|
||||
DebuggerTools.replaceTraceCalls(swf, fname);
|
||||
protected void debuggerReplaceTraceCalls(ActionEvent evt) {
|
||||
ReplaceTraceDialog rtd = new ReplaceTraceDialog(Configuration.lastDebuggerReplaceFunction.get());
|
||||
rtd.setVisible(true);
|
||||
if (rtd.getValue() != null) {
|
||||
String fname = rtd.getValue();
|
||||
DebuggerTools.replaceTraceCalls(swf, fname);
|
||||
mainFrame.getPanel().refreshDecompiled();
|
||||
Configuration.lastDebuggerReplaceFunction.set(rtd.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
protected void clearRecentFiles(ActionEvent evt) {
|
||||
Configuration.recentFiles.set(null);
|
||||
}
|
||||
|
||||
protected void removeNonScripts() {
|
||||
@@ -285,27 +412,43 @@ public abstract class MainFrameMenu {
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
|
||||
protected void checkUpdates() {
|
||||
protected void checkUpdates(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Main.checkForUpdates()) {
|
||||
View.showMessageDialog(null, translate("update.check.nonewversion"), translate("update.check.title"), JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void helpUs() {
|
||||
protected void helpUs(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String helpUsURL = ApplicationInfo.PROJECT_PAGE + "/help_us.html?utm_source=app&utm_medium=menu&utm_campaign=app";
|
||||
if (!View.navigateUrl(helpUsURL)) {
|
||||
View.showMessageDialog(null, translate("message.helpus").replace("%url%", helpUsURL));
|
||||
}
|
||||
}
|
||||
|
||||
protected void homePage() {
|
||||
protected void homePage(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String homePageURL = ApplicationInfo.PROJECT_PAGE + "?utm_source=app&utm_medium=menu&utm_campaign=app";
|
||||
if (!View.navigateUrl(homePageURL)) {
|
||||
View.showMessageDialog(null, translate("message.homepage").replace("%url%", homePageURL));
|
||||
}
|
||||
}
|
||||
|
||||
protected void about() {
|
||||
protected void about(ActionEvent evt) {
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Main.about();
|
||||
}
|
||||
|
||||
@@ -334,15 +477,108 @@ public abstract class MainFrameMenu {
|
||||
}
|
||||
|
||||
protected void gotoDucumentClassOnStartup(ActionEvent evt) {
|
||||
boolean selected = true; // todo: honfika: get from evt.getSource()
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
Configuration.gotoMainClassOnStartup.set(selected);
|
||||
}
|
||||
|
||||
protected void setLanguage() {
|
||||
protected void autoRenameIdentifiers(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
Configuration.autoRenameIdentifiers.set(selected);
|
||||
}
|
||||
|
||||
protected void cacheOnDisk(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
Configuration.cacheOnDisk.set(selected);
|
||||
if (selected) {
|
||||
Cache.setStorageType(Cache.STORAGE_FILES);
|
||||
} else {
|
||||
Cache.setStorageType(Cache.STORAGE_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setLanguage(ActionEvent evt) {
|
||||
new SelectLanguageDialog().display();
|
||||
}
|
||||
|
||||
protected void exit() {
|
||||
protected void disableDecompilation(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
Configuration.decompile.set(!selected);
|
||||
mainFrame.getPanel().disableDecompilationChanged();
|
||||
}
|
||||
|
||||
protected void associate(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
if (selected == ContextMenuTools.isAddedToContextMenu()) {
|
||||
return;
|
||||
}
|
||||
ContextMenuTools.addToContextMenu(selected, false);
|
||||
|
||||
// Update checkbox menuitem accordingly (User can cancel rights elevation)
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
button.setSelected(ContextMenuTools.isAddedToContextMenu());
|
||||
}
|
||||
}, 1000); // It takes some time registry change to apply
|
||||
}
|
||||
|
||||
protected void gotoDucumentClass(ActionEvent evt) {
|
||||
mainFrame.getPanel().gotoDocumentClass(mainFrame.getPanel().getCurrentSwf());
|
||||
}
|
||||
|
||||
protected void parallelSpeedUp(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
String confStr = translate("message.confirm.parallel") + "\r\n";
|
||||
if (selected) {
|
||||
confStr += " " + translate("message.confirm.on");
|
||||
} else {
|
||||
confStr += " " + translate("message.confirm.off");
|
||||
}
|
||||
if (View.showConfirmDialog(null, confStr, translate("message.parallel"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.parallelSpeedUp.set(selected);
|
||||
} else {
|
||||
button.setSelected(Configuration.parallelSpeedUp.get());
|
||||
}
|
||||
}
|
||||
|
||||
protected void internalViewerSwitch(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
Configuration.internalFlashViewer.set(selected);
|
||||
mainFrame.getPanel().reload(true);
|
||||
}
|
||||
|
||||
protected void autoDeobfuscate(ActionEvent evt) {
|
||||
AbstractButton button = (AbstractButton) evt.getSource();
|
||||
boolean selected = button.isSelected();
|
||||
|
||||
if (View.showConfirmDialog(mainFrame.getPanel(), translate("message.confirm.autodeobfuscate") + "\r\n" + (selected ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(selected);
|
||||
mainFrame.getPanel().autoDeobfuscateChanged();
|
||||
} else {
|
||||
button.setSelected(Configuration.autoDeobfuscate.get());
|
||||
}
|
||||
}
|
||||
|
||||
protected void deobfuscationMode(ActionEvent evt, int mode) {
|
||||
Configuration.deobfuscationMode.set(mode);
|
||||
mainFrame.getPanel().autoDeobfuscateChanged();
|
||||
}
|
||||
|
||||
protected void exit(ActionEvent evt) {
|
||||
JFrame frame = (JFrame) mainFrame;
|
||||
frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
|
||||
}
|
||||
@@ -363,19 +599,19 @@ public abstract class MainFrameMenu {
|
||||
if (e.isControlDown() && e.isShiftDown()) {
|
||||
switch (code) {
|
||||
case KeyEvent.VK_O:
|
||||
return open();
|
||||
return open(null);
|
||||
case KeyEvent.VK_S:
|
||||
return save();
|
||||
return save(null);
|
||||
case KeyEvent.VK_A:
|
||||
return saveAs();
|
||||
return saveAs(null);
|
||||
case KeyEvent.VK_F:
|
||||
return search(false);
|
||||
return search(null, false);
|
||||
case KeyEvent.VK_T:
|
||||
return search(true);
|
||||
return search(null, true);
|
||||
case KeyEvent.VK_R:
|
||||
return reload(null);
|
||||
case KeyEvent.VK_X:
|
||||
return closeAll();
|
||||
return closeAll(null);
|
||||
case KeyEvent.VK_D:
|
||||
return clearLog();
|
||||
case KeyEvent.VK_E:
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.console.ContextMenuTools;
|
||||
import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.process.ProcessTools;
|
||||
import com.sun.jna.Platform;
|
||||
@@ -30,13 +29,10 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.pushingpixels.flamingo.api.common.AbstractCommandButton;
|
||||
import org.pushingpixels.flamingo.api.common.CommandButtonDisplayState;
|
||||
import org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup;
|
||||
import org.pushingpixels.flamingo.api.common.JCommandButton;
|
||||
@@ -61,113 +57,7 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener {
|
||||
|
||||
private static final String ACTION_RELOAD = "RELOAD";
|
||||
|
||||
private static final String ACTION_ADVANCED_SETTINGS = "ADVANCEDSETTINGS";
|
||||
|
||||
private static final String ACTION_LOAD_MEMORY = "LOADMEMORY";
|
||||
|
||||
private static final String ACTION_LOAD_CACHE = "LOADCACHE";
|
||||
|
||||
private static final String ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP = "GOTODOCUMENTCLASSONSTARTUP";
|
||||
|
||||
private static final String ACTION_AUTO_RENAME_IDENTIFIERS = "AUTORENAMEIDENTIFIERS";
|
||||
|
||||
private static final String ACTION_CACHE_ON_DISK = "CACHEONDISK";
|
||||
|
||||
private static final String ACTION_SET_LANGUAGE = "SETLANGUAGE";
|
||||
|
||||
private static final String ACTION_DISABLE_DECOMPILATION = "DISABLEDECOMPILATION";
|
||||
|
||||
private static final String ACTION_ASSOCIATE = "ASSOCIATE";
|
||||
|
||||
private static final String ACTION_GOTO_DOCUMENT_CLASS = "GOTODOCUMENTCLASS";
|
||||
|
||||
private static final String ACTION_PARALLEL_SPEED_UP = "PARALLELSPEEDUP";
|
||||
|
||||
private static final String ACTION_INTERNAL_VIEWER_SWITCH = "INTERNALVIEWERSWITCH";
|
||||
|
||||
private static final String ACTION_SEARCH = "SEARCH";
|
||||
|
||||
private static final String ACTION_REPLACE = "REPLACE";
|
||||
|
||||
private static final String ACTION_TIMELINE = "TIMELINE";
|
||||
|
||||
private static final String ACTION_AUTO_DEOBFUSCATE = "AUTODEOBFUSCATE";
|
||||
|
||||
private static final String ACTION_EXIT = "EXIT";
|
||||
|
||||
private static final String ACTION_DEBUGGER_SWITCH = "DEBUGGER_SWITCH";
|
||||
|
||||
private static final String ACTION_DEBUGGER_REPLACE_TRACE = "DEBUGGER_REPLACE_TRACE";
|
||||
|
||||
private static final String ACTION_DEBUGGER_LOG = "DEBUGGER_LOG";
|
||||
|
||||
private static final String ACTION_RENAME_ONE_IDENTIFIER = "RENAMEONEIDENTIFIER";
|
||||
|
||||
private static final String ACTION_ABOUT = "ABOUT";
|
||||
|
||||
private static final String ACTION_SHOW_PROXY = "SHOWPROXY";
|
||||
|
||||
private static final String ACTION_SUB_LIMITER = "SUBLIMITER";
|
||||
|
||||
private static final String ACTION_SAVE = "SAVE";
|
||||
|
||||
private static final String ACTION_SAVE_AS = "SAVEAS";
|
||||
|
||||
private static final String ACTION_SAVE_AS_EXE = "SAVEASEXE";
|
||||
|
||||
private static final String ACTION_OPEN = "OPEN";
|
||||
|
||||
private static final String ACTION_CLOSE = "CLOSE";
|
||||
|
||||
private static final String ACTION_CLOSE_ALL = "CLOSEALL";
|
||||
|
||||
private static final String ACTION_EXPORT_FLA = "EXPORTFLA";
|
||||
|
||||
public static final String ACTION_EXPORT_SEL = "EXPORTSEL";
|
||||
|
||||
public static final String ACTION_EXPORT_JAVA_SOURCE = "EXPORTJAVASOURCE";
|
||||
|
||||
public static final String ACTION_EXPORT_SWF_XML = "EXPORTSWFXML";
|
||||
|
||||
public static final String ACTION_IMPORT_SWF_XML = "IMPORTSWFXML";
|
||||
|
||||
private static final String ACTION_EXPORT = "EXPORT";
|
||||
|
||||
private static final String ACTION_IMPORT_TEXT = "IMPORTTEXT";
|
||||
|
||||
private static final String ACTION_IMPORT_SCRIPT = "IMPORTSCRIPT";
|
||||
|
||||
private static final String ACTION_IMPORT_SYMBOL_CLASS = "IMPORTSYMBOLCLASS";
|
||||
|
||||
private static final String ACTION_CHECK_UPDATES = "CHECKUPDATES";
|
||||
|
||||
private static final String ACTION_HELP_US = "HELPUS";
|
||||
|
||||
private static final String ACTION_HOMEPAGE = "HOMEPAGE";
|
||||
|
||||
private static final String ACTION_RESTORE_CONTROL_FLOW = "RESTORECONTROLFLOW";
|
||||
|
||||
private static final String ACTION_RESTORE_CONTROL_FLOW_ALL = "RESTORECONTROLFLOWALL";
|
||||
|
||||
private static final String ACTION_RENAME_IDENTIFIERS = "RENAMEIDENTIFIERS";
|
||||
|
||||
private static final String ACTION_DEOBFUSCATE = "DEOBFUSCATE";
|
||||
|
||||
private static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL";
|
||||
|
||||
private static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES";
|
||||
|
||||
private static final String ACTION_VIEWMODE_RESOURCES = "VIEWMODERESOURCES";
|
||||
|
||||
private static final String ACTION_VIEWMODE_HEX_DUMP = "VIEWMODEHEXDUMP";
|
||||
|
||||
private static final String ACTION_DEOBFUSCATION_MODE_OLD = "DEOBFUSCATIONMODEOLD";
|
||||
|
||||
private static final String ACTION_DEOBFUSCATION_MODE_NEW = "DEOBFUSCATIONMODENEW";
|
||||
public class MainFrameRibbonMenu extends MainFrameMenu {
|
||||
|
||||
private final MainFrameRibbon mainFrame;
|
||||
|
||||
@@ -282,16 +172,6 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
return miInternalViewer.isSelected();
|
||||
}
|
||||
|
||||
private void assignListener(AbstractCommandButton b, final String command) {
|
||||
final MainFrameRibbonMenu t = this;
|
||||
b.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
t.actionPerformed(new ActionEvent(e.getSource(), 0, command));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String fixCommandTitle(String title) {
|
||||
if (title.length() > 2) {
|
||||
if (title.charAt(1) == ' ') {
|
||||
@@ -303,16 +183,16 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
|
||||
private RibbonApplicationMenu createMainMenu() {
|
||||
RibbonApplicationMenu mainMenu = new RibbonApplicationMenu();
|
||||
exportFlaMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportfla32"), translate("menu.file.export.fla"), new ActionRedirector(this, ACTION_EXPORT_FLA), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
exportAllMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("export32"), translate("menu.file.export.all"), new ActionRedirector(this, ACTION_EXPORT), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
exportSelMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportsel32"), translate("menu.file.export.selection"), new ActionRedirector(this, ACTION_EXPORT_SEL), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
RibbonApplicationMenuEntryPrimary checkUpdatesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("update32"), translate("menu.help.checkupdates"), new ActionRedirector(this, ACTION_CHECK_UPDATES), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
RibbonApplicationMenuEntryPrimary aboutMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("about32"), translate("menu.help.about"), new ActionRedirector(this, ACTION_ABOUT), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
RibbonApplicationMenuEntryPrimary openFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("open32"), translate("menu.file.open"), new ActionRedirector(this, ACTION_OPEN), JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
|
||||
saveFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("save32"), translate("menu.file.save"), new ActionRedirector(this, ACTION_SAVE), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
saveAsFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("saveas32"), translate("menu.file.saveas"), new ActionRedirector(this, ACTION_SAVE_AS), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
closeFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.close"), new ActionRedirector(this, ACTION_CLOSE), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
closeAllFilesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.closeAll"), new ActionRedirector(this, ACTION_CLOSE_ALL), JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
exportFlaMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportfla32"), translate("menu.file.export.fla"), this::exportFla, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
exportAllMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("export32"), translate("menu.file.export.all"), this::exportAll, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
exportSelMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportsel32"), translate("menu.file.export.selection"), this::exportSelected, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
RibbonApplicationMenuEntryPrimary checkUpdatesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("update32"), translate("menu.help.checkupdates"), this::checkUpdates, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
RibbonApplicationMenuEntryPrimary aboutMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("about32"), translate("menu.help.about"), this::about, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
RibbonApplicationMenuEntryPrimary openFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("open32"), translate("menu.file.open"), this::open, JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
|
||||
saveFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("save32"), translate("menu.file.save"), this::save, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
saveAsFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("saveas32"), translate("menu.file.saveas"), this::saveAs, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
closeFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.close"), this::close, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
closeAllFilesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.closeAll"), this::closeAll, JCommandButton.CommandButtonKind.ACTION_ONLY);
|
||||
openFileMenu.setRolloverCallback(new RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback() {
|
||||
@Override
|
||||
public void menuEntryActivated(JPanel targetPanel) {
|
||||
@@ -348,7 +228,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
}
|
||||
});
|
||||
|
||||
RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), new ActionRedirector(this, "EXIT"));
|
||||
RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), this::exit);
|
||||
|
||||
mainMenu.addMenuEntry(openFileMenu);
|
||||
mainMenu.addMenuEntry(saveFileMenu);
|
||||
@@ -412,17 +292,17 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
JRibbonBand editBand = new JRibbonBand(translate("menu.general"), null);
|
||||
editBand.setResizePolicies(getResizePolicies(editBand));
|
||||
JCommandButton openCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.open")), View.getResizableIcon("open32"));
|
||||
assignListener(openCommandButton, ACTION_OPEN);
|
||||
openCommandButton.addActionListener(this::open);
|
||||
saveCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.save")), View.getResizableIcon("save32"));
|
||||
assignListener(saveCommandButton, ACTION_SAVE);
|
||||
saveCommandButton.addActionListener(this::save);
|
||||
saveasCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveas")), View.getResizableIcon("saveas16"));
|
||||
assignListener(saveasCommandButton, ACTION_SAVE_AS);
|
||||
saveasCommandButton.addActionListener(this::saveAs);
|
||||
|
||||
reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16"));
|
||||
assignListener(reloadCommandButton, ACTION_RELOAD);
|
||||
reloadCommandButton.addActionListener(this::reload);
|
||||
|
||||
saveasexeCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveasexe")), View.getResizableIcon("saveasexe16"));
|
||||
assignListener(saveasexeCommandButton, ACTION_SAVE_AS_EXE);
|
||||
saveasexeCommandButton.addActionListener(this::saveAsExe);;
|
||||
|
||||
editBand.addCommandButton(openCommandButton, RibbonElementPriority.TOP);
|
||||
editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP);
|
||||
@@ -433,14 +313,14 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
JRibbonBand exportBand = new JRibbonBand(translate("menu.export"), null);
|
||||
exportBand.setResizePolicies(getResizePolicies(exportBand));
|
||||
exportFlaCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.fla")), View.getResizableIcon("exportfla32"));
|
||||
assignListener(exportFlaCommandButton, ACTION_EXPORT_FLA);
|
||||
exportFlaCommandButton.addActionListener(this::exportFla);
|
||||
exportAllCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.all")), View.getResizableIcon("export16"));
|
||||
assignListener(exportAllCommandButton, ACTION_EXPORT);
|
||||
exportAllCommandButton.addActionListener(this::exportAll);
|
||||
exportSelectionCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.selection")), View.getResizableIcon("exportsel16"));
|
||||
assignListener(exportSelectionCommandButton, ACTION_EXPORT_SEL);
|
||||
exportSelectionCommandButton.addActionListener(this::exportSelected);
|
||||
|
||||
exportXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.xml")), View.getResizableIcon("exportxml32"));
|
||||
assignListener(exportXmlCommandButton, ACTION_EXPORT_SWF_XML);
|
||||
exportXmlCommandButton.addActionListener(this::exportSwfXml);
|
||||
|
||||
exportBand.addCommandButton(exportFlaCommandButton, RibbonElementPriority.TOP);
|
||||
exportBand.addCommandButton(exportAllCommandButton, RibbonElementPriority.MEDIUM);
|
||||
@@ -450,17 +330,17 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
JRibbonBand importBand = new JRibbonBand(translate("menu.import"), null);
|
||||
importBand.setResizePolicies(getResizePolicies(importBand));
|
||||
importTextCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.text")), View.getResizableIcon("importtext32"));
|
||||
assignListener(importTextCommandButton, ACTION_IMPORT_TEXT);
|
||||
importTextCommandButton.addActionListener(this::importText);
|
||||
|
||||
// todo: icon
|
||||
importScriptCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.script")), View.getResizableIcon("importtext32"));
|
||||
assignListener(importScriptCommandButton, ACTION_IMPORT_SCRIPT);
|
||||
importScriptCommandButton.addActionListener(this::importScript);
|
||||
|
||||
importSymbolClassCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.symbolClass")), View.getResizableIcon("importsymbolclass32"));
|
||||
assignListener(importSymbolClassCommandButton, ACTION_IMPORT_SYMBOL_CLASS);
|
||||
importSymbolClassCommandButton.addActionListener(this::importSymbolClass);
|
||||
|
||||
importXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.xml")), View.getResizableIcon("importxml32"));
|
||||
assignListener(importXmlCommandButton, ACTION_IMPORT_SWF_XML);
|
||||
importXmlCommandButton.addActionListener(this::importSwfXml);
|
||||
|
||||
importBand.addCommandButton(importXmlCommandButton, RibbonElementPriority.TOP);
|
||||
importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.MEDIUM);
|
||||
@@ -473,10 +353,10 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
viewModeToggleGroup = new CommandToggleButtonGroup();
|
||||
|
||||
viewModeResourcesToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.resources")), View.getResizableIcon("viewresources16"));
|
||||
assignListener(viewModeResourcesToggleButton, ACTION_VIEWMODE_RESOURCES);
|
||||
viewModeResourcesToggleButton.addActionListener(this::viewModeResouresButtonActionPerformed);
|
||||
|
||||
viewModeHexToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.hex")), View.getResizableIcon("viewhex16"));
|
||||
assignListener(viewModeHexToggleButton, ACTION_VIEWMODE_HEX_DUMP);
|
||||
viewModeHexToggleButton.addActionListener(this::viewModeHexDumpButtonActionPerformed);;
|
||||
|
||||
viewModeToggleGroup.add(viewModeResourcesToggleButton);
|
||||
viewModeToggleGroup.add(viewModeHexToggleButton);
|
||||
@@ -499,15 +379,15 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
debuggerBand.setResizePolicies(getResizePolicies(debuggerBand));
|
||||
|
||||
debuggerSwitchCommandButton = new JCommandToggleButton(translate("menu.debugger.switch"), View.getResizableIcon("debugger32"));
|
||||
assignListener(debuggerSwitchCommandButton, ACTION_DEBUGGER_SWITCH);
|
||||
debuggerSwitchCommandButton.addActionListener(this::debuggerSwitchButtonActionPerformed);
|
||||
|
||||
//debuggerDetachCommandButton = new JCommandButton("Detach debugger",View.getResizableIcon("debuggerremove16"));
|
||||
//assignListener(debuggerDetachCommandButton, ACTION_DEBUGGER_DETACH);
|
||||
//debuggerDetachCommandButton.addActionListener(this::debuggerDetach);
|
||||
debuggerReplaceTraceCommandButton = new JCommandButton(translate("menu.debugger.replacetrace"), View.getResizableIcon("debuggerreplace16"));
|
||||
assignListener(debuggerReplaceTraceCommandButton, ACTION_DEBUGGER_REPLACE_TRACE);
|
||||
debuggerReplaceTraceCommandButton.addActionListener(this::debuggerReplaceTraceCalls);
|
||||
|
||||
debuggerLogCommandButton = new JCommandButton(translate("menu.debugger.showlog"), View.getResizableIcon("debuggerlog16"));
|
||||
assignListener(debuggerLogCommandButton, ACTION_DEBUGGER_LOG);
|
||||
debuggerLogCommandButton.addActionListener(this::debuggerShowLog);
|
||||
|
||||
debuggerSwitchGroup = new CommandToggleButtonGroup();
|
||||
debuggerSwitchGroup.add(debuggerSwitchCommandButton);
|
||||
@@ -525,28 +405,30 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
toolsBand.setResizePolicies(getResizePolicies(toolsBand));
|
||||
|
||||
searchCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.search")), View.getResizableIcon("search32"));
|
||||
assignListener(searchCommandButton, ACTION_SEARCH);
|
||||
searchCommandButton.addActionListener((ActionEvent e) -> {
|
||||
search(e, null);
|
||||
});
|
||||
|
||||
replaceCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.replace")), View.getResizableIcon("replace32"));
|
||||
assignListener(replaceCommandButton, ACTION_REPLACE);
|
||||
replaceCommandButton.addActionListener(this::replace);
|
||||
|
||||
timeLineToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.tools.timeline")), View.getResizableIcon("timeline32"));
|
||||
assignListener(timeLineToggleButton, ACTION_TIMELINE);
|
||||
timeLineToggleButton.addActionListener(this::timelineButtonActionPerformed);
|
||||
|
||||
timeLineToggleGroup = new CommandToggleButtonGroup();
|
||||
timeLineToggleGroup.add(timeLineToggleButton);
|
||||
|
||||
gotoDocumentClassCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.gotodocumentclass")), View.getResizableIcon("gotomainclass32"));
|
||||
assignListener(gotoDocumentClassCommandButton, ACTION_GOTO_DOCUMENT_CLASS);
|
||||
gotoDocumentClassCommandButton.addActionListener(this::gotoDucumentClass);
|
||||
|
||||
JCommandButton proxyCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.proxy")), View.getResizableIcon("proxy16"));
|
||||
assignListener(proxyCommandButton, ACTION_SHOW_PROXY);
|
||||
proxyCommandButton.addActionListener(this::showProxy);
|
||||
|
||||
JCommandButton loadMemoryCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.searchmemory")), View.getResizableIcon("loadmemory16"));
|
||||
assignListener(loadMemoryCommandButton, ACTION_LOAD_MEMORY);
|
||||
loadMemoryCommandButton.addActionListener(this::loadFromMemory);
|
||||
|
||||
JCommandButton loadCacheCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.searchcache")), View.getResizableIcon("loadcache16"));
|
||||
assignListener(loadCacheCommandButton, ACTION_LOAD_CACHE);
|
||||
loadCacheCommandButton.addActionListener(this::loadFromCache);
|
||||
|
||||
toolsBand.addCommandButton(searchCommandButton, RibbonElementPriority.TOP);
|
||||
toolsBand.addCommandButton(replaceCommandButton, RibbonElementPriority.TOP);
|
||||
@@ -562,11 +444,11 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
deobfuscationBand.setResizePolicies(getResizePolicies(deobfuscationBand));
|
||||
|
||||
deobfuscationCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.pcode")), View.getResizableIcon("deobfuscate32"));
|
||||
assignListener(deobfuscationCommandButton, ACTION_DEOBFUSCATE);
|
||||
deobfuscationCommandButton.addActionListener(this::deobfuscate);
|
||||
globalRenameCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.globalrename")), View.getResizableIcon("rename16"));
|
||||
assignListener(globalRenameCommandButton, ACTION_RENAME_ONE_IDENTIFIER);
|
||||
globalRenameCommandButton.addActionListener(this::renameOneIdentifier);
|
||||
renameInvalidCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.renameinvalid")), View.getResizableIcon("renameall16"));
|
||||
assignListener(renameInvalidCommandButton, ACTION_RENAME_IDENTIFIERS);
|
||||
renameInvalidCommandButton.addActionListener(this::renameIdentifiers);
|
||||
|
||||
deobfuscationBand.addCommandButton(deobfuscationCommandButton, RibbonElementPriority.TOP);
|
||||
deobfuscationBand.addCommandButton(globalRenameCommandButton, RibbonElementPriority.MEDIUM);
|
||||
@@ -585,46 +467,38 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
|
||||
miAutoDeobfuscation = new JCheckBox(translate("menu.settings.autodeobfuscation"));
|
||||
miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
|
||||
miAutoDeobfuscation.addActionListener(this);
|
||||
miAutoDeobfuscation.setActionCommand(ACTION_AUTO_DEOBFUSCATE);
|
||||
miAutoDeobfuscation.addActionListener(this::autoDeobfuscate);
|
||||
|
||||
miInternalViewer = new JCheckBox(translate("menu.settings.internalflashviewer"));
|
||||
miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable);
|
||||
if (externalFlashPlayerUnavailable) {
|
||||
miInternalViewer.setEnabled(false);
|
||||
}
|
||||
miInternalViewer.setActionCommand(ACTION_INTERNAL_VIEWER_SWITCH);
|
||||
miInternalViewer.addActionListener(this);
|
||||
miInternalViewer.addActionListener(this::internalViewerSwitch);
|
||||
|
||||
miParallelSpeedUp = new JCheckBox(translate("menu.settings.parallelspeedup"));
|
||||
miParallelSpeedUp.setSelected(Configuration.parallelSpeedUp.get());
|
||||
miParallelSpeedUp.setActionCommand(ACTION_PARALLEL_SPEED_UP);
|
||||
miParallelSpeedUp.addActionListener(this);
|
||||
miParallelSpeedUp.addActionListener(this::parallelSpeedUp);
|
||||
|
||||
miDecompile = new JCheckBox(translate("menu.settings.disabledecompilation"));
|
||||
miDecompile.setSelected(!Configuration.decompile.get());
|
||||
miDecompile.setActionCommand(ACTION_DISABLE_DECOMPILATION);
|
||||
miDecompile.addActionListener(this);
|
||||
miDecompile.addActionListener(this::disableDecompilation);
|
||||
|
||||
miAssociate = new JCheckBox(translate("menu.settings.addtocontextmenu"));
|
||||
miAssociate.setActionCommand(ACTION_ASSOCIATE);
|
||||
miAssociate.addActionListener(this);
|
||||
miAssociate.addActionListener(this::associate);
|
||||
miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
|
||||
|
||||
miCacheDisk = new JCheckBox(translate("menu.settings.cacheOnDisk"));
|
||||
miCacheDisk.setSelected(Configuration.cacheOnDisk.get());
|
||||
miCacheDisk.setActionCommand(ACTION_CACHE_ON_DISK);
|
||||
miCacheDisk.addActionListener(this);
|
||||
miCacheDisk.addActionListener(this::cacheOnDisk);
|
||||
|
||||
miGotoMainClassOnStartup = new JCheckBox(translate("menu.settings.gotoMainClassOnStartup"));
|
||||
miGotoMainClassOnStartup.setSelected(Configuration.gotoMainClassOnStartup.get());
|
||||
miGotoMainClassOnStartup.setActionCommand(ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP);
|
||||
miGotoMainClassOnStartup.addActionListener(this);
|
||||
miGotoMainClassOnStartup.addActionListener(this::gotoDucumentClassOnStartup);
|
||||
|
||||
miAutoRenameIdentifiers = new JCheckBox(translate("menu.settings.autoRenameIdentifiers"));
|
||||
miAutoRenameIdentifiers.setSelected(Configuration.autoRenameIdentifiers.get());
|
||||
miAutoRenameIdentifiers.setActionCommand(ACTION_AUTO_RENAME_IDENTIFIERS);
|
||||
miAutoRenameIdentifiers.addActionListener(this);
|
||||
miAutoRenameIdentifiers.addActionListener(this::autoRenameIdentifiers);
|
||||
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer));
|
||||
@@ -641,17 +515,17 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
List<RibbonBandResizePolicy> languageBandResizePolicies = getIconBandResizePolicies(languageBand);
|
||||
languageBand.setResizePolicies(languageBandResizePolicies);
|
||||
JCommandButton setLanguageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.settings.language")), View.getResizableIcon("setlanguage32"));
|
||||
assignListener(setLanguageCommandButton, ACTION_SET_LANGUAGE);
|
||||
setLanguageCommandButton.addActionListener(this::setLanguage);
|
||||
languageBand.addCommandButton(setLanguageCommandButton, RibbonElementPriority.TOP);
|
||||
|
||||
JRibbonBand advancedSettingsBand = new JRibbonBand(translate("menu.advancedsettings.advancedsettings"), null);
|
||||
advancedSettingsBand.setResizePolicies(getResizePolicies(advancedSettingsBand));
|
||||
JCommandButton advancedSettingsCommandButton = new JCommandButton(fixCommandTitle(translate("menu.advancedsettings.advancedsettings")), View.getResizableIcon("settings32"));
|
||||
assignListener(advancedSettingsCommandButton, ACTION_ADVANCED_SETTINGS);
|
||||
advancedSettingsCommandButton.addActionListener(this::advancedSettings);
|
||||
advancedSettingsBand.addCommandButton(advancedSettingsCommandButton, RibbonElementPriority.TOP);
|
||||
|
||||
clearRecentFilesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.otherTools.clearRecentFiles")), View.getResizableIcon("clearrecent16"));
|
||||
assignListener(clearRecentFilesCommandButton, ACTION_CLEAR_RECENT_FILES);
|
||||
clearRecentFilesCommandButton.addActionListener(this::clearRecentFiles);
|
||||
advancedSettingsBand.addCommandButton(clearRecentFilesCommandButton, RibbonElementPriority.MEDIUM);
|
||||
|
||||
JRibbonBand deobfuscationBand = new JRibbonBand(translate("menu.deobfuscation"), null);
|
||||
@@ -660,10 +534,14 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
CommandToggleButtonGroup grpDeobfuscation = new CommandToggleButtonGroup();
|
||||
|
||||
deobfuscationModeOldToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.deobfuscation.old")), View.getResizableIcon("deobfuscateold16"));
|
||||
assignListener(deobfuscationModeOldToggleButton, ACTION_DEOBFUSCATION_MODE_OLD);
|
||||
deobfuscationModeOldToggleButton.addActionListener((ActionEvent e) -> {
|
||||
deobfuscationMode(e, 0);
|
||||
});
|
||||
|
||||
deobfuscationModeNewToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.deobfuscation.new")), View.getResizableIcon("deobfuscatenew16"));
|
||||
assignListener(deobfuscationModeNewToggleButton, ACTION_DEOBFUSCATION_MODE_NEW);
|
||||
deobfuscationModeNewToggleButton.addActionListener((ActionEvent e) -> {
|
||||
deobfuscationMode(e, 1);
|
||||
});
|
||||
|
||||
grpDeobfuscation.add(deobfuscationModeOldToggleButton);
|
||||
grpDeobfuscation.add(deobfuscationModeNewToggleButton);
|
||||
@@ -691,13 +569,13 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
helpBand.setResizePolicies(getResizePolicies(helpBand));
|
||||
|
||||
JCommandButton checkForUpdatesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.checkupdates")), View.getResizableIcon("update16"));
|
||||
assignListener(checkForUpdatesCommandButton, ACTION_CHECK_UPDATES);
|
||||
checkForUpdatesCommandButton.addActionListener(this::checkUpdates);
|
||||
JCommandButton helpUsUpdatesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.helpus")), View.getResizableIcon("donate32"));
|
||||
assignListener(helpUsUpdatesCommandButton, ACTION_HELP_US);
|
||||
helpUsUpdatesCommandButton.addActionListener(this::helpUs);
|
||||
JCommandButton homepageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.homepage")), View.getResizableIcon("homepage16"));
|
||||
assignListener(homepageCommandButton, ACTION_HOMEPAGE);
|
||||
homepageCommandButton.addActionListener(this::homePage);
|
||||
JCommandButton aboutCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.about")), View.getResizableIcon("about32"));
|
||||
assignListener(aboutCommandButton, ACTION_ABOUT);
|
||||
aboutCommandButton.addActionListener(this::about);
|
||||
|
||||
helpBand.addCommandButton(aboutCommandButton, RibbonElementPriority.TOP);
|
||||
helpBand.addCommandButton(checkForUpdatesCommandButton, RibbonElementPriority.MEDIUM);
|
||||
@@ -810,245 +688,51 @@ public class MainFrameRibbonMenu extends MainFrameMenu implements ActionListener
|
||||
//debuggerSwitchCommandButton.
|
||||
//debuggerDetachCommandButton.setEnabled(hasDebugger);
|
||||
debuggerReplaceTraceCommandButton.setEnabled(hasAbc && hasDebugger);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_DEBUGGER_SWITCH:
|
||||
if (debuggerSwitchGroup.getSelected() == null || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
|
||||
switchDebugger();
|
||||
mainFrame.getPanel().refreshDecompiled();
|
||||
} else {
|
||||
if (debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton) {
|
||||
debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, false);
|
||||
}
|
||||
}
|
||||
debuggerReplaceTraceCommandButton.setEnabled(debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton);
|
||||
break;
|
||||
case ACTION_DEBUGGER_LOG:
|
||||
debuggerShowLog();
|
||||
break;
|
||||
case ACTION_DEBUGGER_REPLACE_TRACE:
|
||||
ReplaceTraceDialog rtd = new ReplaceTraceDialog(mainFrame, Configuration.lastDebuggerReplaceFunction.get());
|
||||
rtd.setVisible(true);
|
||||
if (rtd.getValue() != null) {
|
||||
replaceTraceCalls(rtd.getValue());
|
||||
mainFrame.getPanel().refreshDecompiled();
|
||||
Configuration.lastDebuggerReplaceFunction.set(rtd.getValue());
|
||||
}
|
||||
break;
|
||||
case ACTION_RELOAD:
|
||||
reload(null);
|
||||
break;
|
||||
case ACTION_ADVANCED_SETTINGS:
|
||||
advancedSettings(null);
|
||||
break;
|
||||
case ACTION_LOAD_MEMORY:
|
||||
loadFromMemory(null);
|
||||
break;
|
||||
case ACTION_LOAD_CACHE:
|
||||
loadFromCache(null);
|
||||
break;
|
||||
case ACTION_GOTO_DOCUMENT_CLASS_ON_STARTUP:
|
||||
Configuration.gotoMainClassOnStartup.set(miGotoMainClassOnStartup.isSelected());
|
||||
break;
|
||||
case ACTION_AUTO_RENAME_IDENTIFIERS:
|
||||
Configuration.autoRenameIdentifiers.set(miAutoRenameIdentifiers.isSelected());
|
||||
break;
|
||||
case ACTION_CACHE_ON_DISK:
|
||||
Configuration.cacheOnDisk.set(miCacheDisk.isSelected());
|
||||
if (miCacheDisk.isSelected()) {
|
||||
Cache.setStorageType(Cache.STORAGE_FILES);
|
||||
} else {
|
||||
Cache.setStorageType(Cache.STORAGE_MEMORY);
|
||||
}
|
||||
break;
|
||||
case ACTION_SET_LANGUAGE:
|
||||
setLanguage();
|
||||
break;
|
||||
case ACTION_DISABLE_DECOMPILATION:
|
||||
Configuration.decompile.set(!miDecompile.isSelected());
|
||||
mainFrame.getPanel().disableDecompilationChanged();
|
||||
break;
|
||||
case ACTION_ASSOCIATE:
|
||||
if (miAssociate.isSelected() == ContextMenuTools.isAddedToContextMenu()) {
|
||||
return;
|
||||
}
|
||||
ContextMenuTools.addToContextMenu(miAssociate.isSelected(), false);
|
||||
private void debuggerSwitchButtonActionPerformed(ActionEvent evt) {
|
||||
if (debuggerSwitchGroup.getSelected() == null || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
|
||||
switchDebugger();
|
||||
mainFrame.getPanel().refreshDecompiled();
|
||||
} else {
|
||||
if (debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton) {
|
||||
debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, false);
|
||||
}
|
||||
}
|
||||
debuggerReplaceTraceCommandButton.setEnabled(debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton);
|
||||
}
|
||||
|
||||
// Update checkbox menuitem accordingly (User can cancel rights elevation)
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
|
||||
}
|
||||
}, 1000); // It takes some time registry change to apply
|
||||
break;
|
||||
case ACTION_GOTO_DOCUMENT_CLASS:
|
||||
mainFrame.getPanel().gotoDocumentClass(mainFrame.getPanel().getCurrentSwf());
|
||||
break;
|
||||
case ACTION_PARALLEL_SPEED_UP:
|
||||
String confStr = translate("message.confirm.parallel") + "\r\n";
|
||||
if (miParallelSpeedUp.isSelected()) {
|
||||
confStr += " " + translate("message.confirm.on");
|
||||
} else {
|
||||
confStr += " " + translate("message.confirm.off");
|
||||
}
|
||||
if (View.showConfirmDialog(null, confStr, translate("message.parallel"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.parallelSpeedUp.set((Boolean) miParallelSpeedUp.isSelected());
|
||||
} else {
|
||||
miParallelSpeedUp.setSelected(!miParallelSpeedUp.isSelected());
|
||||
}
|
||||
break;
|
||||
case ACTION_INTERNAL_VIEWER_SWITCH:
|
||||
Configuration.internalFlashViewer.set(miInternalViewer.isSelected());
|
||||
mainFrame.getPanel().reload(true);
|
||||
break;
|
||||
private void viewModeResouresButtonActionPerformed(ActionEvent evt) {
|
||||
Configuration.dumpView.set(false);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, false);
|
||||
viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
|
||||
}
|
||||
|
||||
case ACTION_VIEWMODE_RESOURCES:
|
||||
Configuration.dumpView.set(false);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, false);
|
||||
viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
|
||||
break;
|
||||
case ACTION_VIEWMODE_HEX_DUMP:
|
||||
Configuration.dumpView.set(true);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
|
||||
private void viewModeHexDumpButtonActionPerformed(ActionEvent evt) {
|
||||
Configuration.dumpView.set(true);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, false);
|
||||
viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
|
||||
}
|
||||
|
||||
private void timelineButtonActionPerformed(ActionEvent evt) {
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, timeLineToggleGroup.getSelected() == timeLineToggleButton);
|
||||
if (timeLineToggleGroup.getSelected() == timeLineToggleButton) {
|
||||
if (!mainFrame.getPanel().showView(MainPanel.VIEW_TIMELINE)) {
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, false);
|
||||
} else {
|
||||
viewModeToggleGroup.setSelected(viewModeHexToggleButton, false);
|
||||
viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, false);
|
||||
}
|
||||
} else {
|
||||
if (Configuration.dumpView.get()) {
|
||||
viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
|
||||
break;
|
||||
case ACTION_DEOBFUSCATION_MODE_OLD:
|
||||
Configuration.deobfuscationMode.set(0);
|
||||
mainFrame.getPanel().autoDeobfuscateChanged();
|
||||
break;
|
||||
case ACTION_DEOBFUSCATION_MODE_NEW:
|
||||
Configuration.deobfuscationMode.set(1);
|
||||
mainFrame.getPanel().autoDeobfuscateChanged();
|
||||
break;
|
||||
case ACTION_SEARCH:
|
||||
search(null);
|
||||
break;
|
||||
case ACTION_REPLACE:
|
||||
replace();
|
||||
break;
|
||||
case ACTION_TIMELINE:
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, timeLineToggleGroup.getSelected() == timeLineToggleButton);
|
||||
if (timeLineToggleGroup.getSelected() == timeLineToggleButton) {
|
||||
if (!mainFrame.getPanel().showView(MainPanel.VIEW_TIMELINE)) {
|
||||
timeLineToggleGroup.setSelected(timeLineToggleButton, false);
|
||||
} else {
|
||||
viewModeToggleGroup.setSelected(viewModeHexToggleButton, false);
|
||||
viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, false);
|
||||
}
|
||||
} else {
|
||||
if (Configuration.dumpView.get()) {
|
||||
viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
|
||||
} else {
|
||||
viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case ACTION_AUTO_DEOBFUSCATE:
|
||||
if (View.showConfirmDialog(mainFrame.getPanel(), translate("message.confirm.autodeobfuscate") + "\r\n" + (miAutoDeobfuscation.isSelected() ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.autoDeobfuscate.set(miAutoDeobfuscation.isSelected());
|
||||
mainFrame.getPanel().autoDeobfuscateChanged();
|
||||
} else {
|
||||
miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected());
|
||||
}
|
||||
break;
|
||||
case ACTION_CLEAR_RECENT_FILES:
|
||||
Configuration.recentFiles.set(null);
|
||||
break;
|
||||
case ACTION_EXIT:
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.isWorking()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_RENAME_ONE_IDENTIFIER:
|
||||
renameOneIdentifier();
|
||||
break;
|
||||
case ACTION_SHOW_PROXY:
|
||||
showProxy();
|
||||
break;
|
||||
case ACTION_SUB_LIMITER:
|
||||
setSubLimiter(((JCheckBox) e.getSource()).isSelected());
|
||||
break;
|
||||
case ACTION_SAVE:
|
||||
save();
|
||||
break;
|
||||
case ACTION_SAVE_AS:
|
||||
saveAs();
|
||||
break;
|
||||
case ACTION_SAVE_AS_EXE:
|
||||
saveAsExe();
|
||||
break;
|
||||
case ACTION_OPEN:
|
||||
open();
|
||||
break;
|
||||
case ACTION_CLOSE:
|
||||
close();
|
||||
break;
|
||||
case ACTION_CLOSE_ALL:
|
||||
closeAll();
|
||||
break;
|
||||
case ACTION_IMPORT_TEXT:
|
||||
importText();
|
||||
break;
|
||||
case ACTION_IMPORT_SCRIPT:
|
||||
importScript();
|
||||
break;
|
||||
case ACTION_IMPORT_SYMBOL_CLASS:
|
||||
importSymbolClass();
|
||||
break;
|
||||
|
||||
case ACTION_EXPORT_SWF_XML:
|
||||
mainFrame.getPanel().exportSwfXml();
|
||||
break;
|
||||
case ACTION_IMPORT_SWF_XML:
|
||||
mainFrame.getPanel().importSwfXml();
|
||||
break;
|
||||
case ACTION_EXPORT_SEL:
|
||||
case ACTION_EXPORT:
|
||||
boolean onlySel = e.getActionCommand().equals(ACTION_EXPORT_SEL);
|
||||
export(onlySel);
|
||||
break;
|
||||
case ACTION_EXPORT_FLA:
|
||||
exportFla();
|
||||
break;
|
||||
case ACTION_CHECK_UPDATES:
|
||||
checkUpdates();
|
||||
break;
|
||||
case ACTION_HELP_US:
|
||||
helpUs();
|
||||
break;
|
||||
case ACTION_HOMEPAGE:
|
||||
homePage();
|
||||
break;
|
||||
case ACTION_ABOUT:
|
||||
about();
|
||||
break;
|
||||
case ACTION_RESTORE_CONTROL_FLOW:
|
||||
case ACTION_RESTORE_CONTROL_FLOW_ALL:
|
||||
boolean all = e.getActionCommand().equals(ACTION_RESTORE_CONTROL_FLOW_ALL);
|
||||
restoreControlFlow(all);
|
||||
break;
|
||||
case ACTION_RENAME_IDENTIFIERS:
|
||||
renameIdentifiers();
|
||||
break;
|
||||
case ACTION_DEOBFUSCATE:
|
||||
case ACTION_DEOBFUSCATE_ALL:
|
||||
deobfuscate();
|
||||
break;
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
|
||||
} else {
|
||||
viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
|
||||
mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.timeline.TagScript;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.treeitems.TreeItem;
|
||||
import com.jpexs.decompiler.flash.types.GLYPHENTRY;
|
||||
@@ -340,8 +341,7 @@ public class PreviewPanel extends JSplitPane {
|
||||
/*JPanel bottomPanel = new JPanel(new BorderLayout());
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton selectColorButton = new JButton(View.getIcon("color16"));
|
||||
selectColorButton.addActionListener(mainPanel);
|
||||
selectColorButton.setActionCommand(MainPanel.ACTION_SELECT_BKCOLOR);
|
||||
selectColorButton.addActionListener(mainPanel::selectBkColor);
|
||||
selectColorButton.setToolTipText(AppStrings.translate("button.selectbkcolor.hint"));
|
||||
buttonsPanel.add(selectColorButton);
|
||||
bottomPanel.add(buttonsPanel, BorderLayout.EAST);
|
||||
@@ -1143,6 +1143,10 @@ public class PreviewPanel extends JSplitPane {
|
||||
return;
|
||||
}
|
||||
|
||||
if (item instanceof TagScript) {
|
||||
item = ((TagScript) item).getTag();
|
||||
}
|
||||
|
||||
if (item instanceof Tag) {
|
||||
genericEditButton.setVisible(false);
|
||||
genericSaveButton.setVisible(true);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Container;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ButtonGroup;
|
||||
@@ -61,8 +60,7 @@ public class ReplaceTraceDialog extends AppDialog {
|
||||
return value;
|
||||
}
|
||||
|
||||
public ReplaceTraceDialog(Window owner, String defaultVal) {
|
||||
super(owner);
|
||||
public ReplaceTraceDialog(String defaultVal) {
|
||||
setTitle(translate("dialog.title"));
|
||||
Container cnt = getContentPane();
|
||||
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));
|
||||
|
||||
@@ -111,7 +111,7 @@ import jsyntaxpane.SyntaxDocument;
|
||||
import jsyntaxpane.Token;
|
||||
import jsyntaxpane.TokenType;
|
||||
|
||||
public class ABCPanel extends JPanel implements ItemListener, ActionListener, SearchListener<ABCPanelSearchResult>, Freed {
|
||||
public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABCPanelSearchResult>, Freed {
|
||||
|
||||
private MainPanel mainPanel;
|
||||
|
||||
@@ -149,12 +149,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
public JLabel scriptNameLabel;
|
||||
|
||||
private static final String ACTION_SAVE_DECOMPILED = "SAVEDECOMPILED";
|
||||
|
||||
private static final String ACTION_EDIT_DECOMPILED = "EDITDECOMPILED";
|
||||
|
||||
private static final String ACTION_CANCEL_DECOMPILED = "CANCELDECOMPILED";
|
||||
|
||||
public JLabel experimentalLabel = new JLabel(AppStrings.translate("action.edit.experimental"));
|
||||
|
||||
public JButton editDecompiledButton = new JButton(AppStrings.translate("button.edit"), View.getIcon("edit16"));
|
||||
@@ -163,8 +157,6 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
public JButton cancelDecompiledButton = new JButton(AppStrings.translate("button.cancel"), View.getIcon("cancel16"));
|
||||
|
||||
private static final String ACTION_ADD_TRAIT = "ADDTRAIT";
|
||||
|
||||
private static List<Long> modifiedPacks = new ArrayList<>();
|
||||
|
||||
public MainPanel getMainPanel() {
|
||||
@@ -354,8 +346,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
|
||||
JButton newTraitButton = new JButton(View.getIcon("traitadd16"));
|
||||
newTraitButton.setMargin(new Insets(5, 5, 5, 5));
|
||||
newTraitButton.addActionListener(this);
|
||||
newTraitButton.setActionCommand(ACTION_ADD_TRAIT);
|
||||
newTraitButton.addActionListener(this::addTraitButtonActionPerformed);
|
||||
newTraitButton.setToolTipText(AppStrings.translate("button.addtrait"));
|
||||
iconsPanel.add(newTraitButton);
|
||||
|
||||
@@ -378,13 +369,10 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
saveDecompiledButton.setMargin(new Insets(3, 3, 3, 10));
|
||||
cancelDecompiledButton.setMargin(new Insets(3, 3, 3, 10));
|
||||
|
||||
saveDecompiledButton.addActionListener(this);
|
||||
saveDecompiledButton.setActionCommand(ACTION_SAVE_DECOMPILED);
|
||||
editDecompiledButton.addActionListener(this);
|
||||
editDecompiledButton.setActionCommand(ACTION_EDIT_DECOMPILED);
|
||||
saveDecompiledButton.addActionListener(this::saveDecompiledButtonActionPerformed);
|
||||
editDecompiledButton.addActionListener(this::editDecompiledButtonActionPerformed);
|
||||
cancelDecompiledButton.addActionListener(this::cancelDecompiledButtonActionPerformed);
|
||||
|
||||
cancelDecompiledButton.addActionListener(this);
|
||||
cancelDecompiledButton.setActionCommand(ACTION_CANCEL_DECOMPILED);
|
||||
saveDecompiledButton.setVisible(false);
|
||||
cancelDecompiledButton.setVisible(false);
|
||||
decButtonsPan.setAlignmentX(0);
|
||||
@@ -762,171 +750,168 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
|
||||
decompiledTextArea.requestFocusInWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case ACTION_EDIT_DECOMPILED:
|
||||
File swc = Configuration.getPlayerSWC();
|
||||
final String adobePage = "http://www.adobe.com/support/flashplayer/downloads.html";
|
||||
if (swc == null) {
|
||||
if (View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.needed").replace("%adobehomepage%", adobePage), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.OK_OPTION) {
|
||||
private void editDecompiledButtonActionPerformed(ActionEvent evt) {
|
||||
File swc = Configuration.getPlayerSWC();
|
||||
final String adobePage = "http://www.adobe.com/support/flashplayer/downloads.html";
|
||||
if (swc == null) {
|
||||
if (View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.needed").replace("%adobehomepage%", adobePage), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.OK_OPTION) {
|
||||
|
||||
View.navigateUrl(adobePage);
|
||||
View.navigateUrl(adobePage);
|
||||
|
||||
int ret;
|
||||
do {
|
||||
ret = View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.place").replace("%libpath%", Configuration.getFlashLibPath().getAbsolutePath()), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
|
||||
swc = Configuration.getPlayerSWC();
|
||||
} while (ret == JOptionPane.OK_OPTION && swc == null);
|
||||
}
|
||||
}
|
||||
if (swc != null) {
|
||||
if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS3Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
|
||||
setDecompiledEditMode(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_CANCEL_DECOMPILED:
|
||||
setDecompiledEditMode(false);
|
||||
break;
|
||||
case ACTION_SAVE_DECOMPILED:
|
||||
ScriptPack pack = decompiledTextArea.getScriptLeaf();
|
||||
int oldIndex = pack.scriptIndex;
|
||||
SWF.uncache(pack);
|
||||
|
||||
try {
|
||||
String oldSp = null;
|
||||
List<ScriptPack> packs = abc.script_info.get(oldIndex).getPacks(abc, oldIndex, null);
|
||||
if (!packs.isEmpty()) {
|
||||
oldSp = packs.get(0).getClassPath().toString();
|
||||
}
|
||||
|
||||
String as = decompiledTextArea.getText();
|
||||
abc.replaceScriptPack(pack, as);
|
||||
lastDecompiled = as;
|
||||
mainPanel.updateClassesList();
|
||||
|
||||
if (oldSp != null) {
|
||||
hilightScript(getSwf(), oldSp);
|
||||
}
|
||||
setDecompiledEditMode(false);
|
||||
reload();
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
|
||||
} catch (AVM2ParseException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
decompiledTextArea.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (CompilationException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
decompiledTextArea.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
//ignore
|
||||
}
|
||||
break;
|
||||
case ACTION_ADD_TRAIT:
|
||||
int class_index = decompiledTextArea.getClassIndex();
|
||||
if (class_index < 0) {
|
||||
return;
|
||||
}
|
||||
if (newTraitDialog == null) {
|
||||
newTraitDialog = new NewTraitDialog();
|
||||
}
|
||||
int void_type = abc.constants.getPublicQnameId("void", true);//abc.constants.forceGetMultinameId(new Multiname(Multiname.QNAME, abc.constants.forceGetStringId("void"), abc.constants.forceGetNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.forceGetStringId("")), 0), -1, -1, new ArrayList<Integer>()));
|
||||
int int_type = abc.constants.getPublicQnameId("int", true); //abc.constants.forceGetMultinameId(new Multiname(Multiname.QNAME, abc.constants.forceGetStringId("int"), abc.constants.forceGetNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.forceGetStringId("")), 0), -1, -1, new ArrayList<Integer>()));
|
||||
|
||||
Trait t = null;
|
||||
int kind;
|
||||
int nskind;
|
||||
String name = null;
|
||||
boolean isStatic;
|
||||
Multiname m;
|
||||
|
||||
boolean again = false;
|
||||
loopm:
|
||||
int ret;
|
||||
do {
|
||||
if (again) {
|
||||
View.showMessageDialog(null, AppStrings.translate("error.trait.exists").replace("%name%", name), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
again = false;
|
||||
if (newTraitDialog.showDialog() != AppDialog.OK_OPTION) {
|
||||
return;
|
||||
}
|
||||
kind = newTraitDialog.getTraitType();
|
||||
nskind = newTraitDialog.getNamespaceKind();
|
||||
name = newTraitDialog.getTraitName();
|
||||
isStatic = newTraitDialog.getStatic();
|
||||
m = new Multiname(Multiname.QNAME, abc.constants.getStringId(name, true), abc.constants.getNamespaceId(new Namespace(nskind, abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<>());
|
||||
int mid = abc.constants.getMultinameId(m);
|
||||
if (mid == 0) {
|
||||
break;
|
||||
}
|
||||
for (Trait tr : abc.class_info.get(class_index).static_traits.traits) {
|
||||
if (tr.name_index == mid) {
|
||||
again = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret = View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.place").replace("%libpath%", Configuration.getFlashLibPath().getAbsolutePath()), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
|
||||
swc = Configuration.getPlayerSWC();
|
||||
} while (ret == JOptionPane.OK_OPTION && swc == null);
|
||||
}
|
||||
}
|
||||
if (swc != null) {
|
||||
if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS3Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
|
||||
setDecompiledEditMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Trait tr : abc.instance_info.get(class_index).instance_traits.traits) {
|
||||
if (tr.name_index == mid) {
|
||||
again = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (again);
|
||||
switch (kind) {
|
||||
case Trait.TRAIT_GETTER:
|
||||
case Trait.TRAIT_SETTER:
|
||||
case Trait.TRAIT_METHOD:
|
||||
TraitMethodGetterSetter tm = new TraitMethodGetterSetter();
|
||||
MethodInfo mi = new MethodInfo(new int[0], void_type, abc.constants.getStringId(name, true), 0, new ValueKind[0], new int[0]);
|
||||
int method_info = abc.addMethodInfo(mi);
|
||||
tm.method_info = method_info;
|
||||
MethodBody body = new MethodBody();
|
||||
body.method_info = method_info;
|
||||
body.init_scope_depth = 1;
|
||||
body.max_regs = 1;
|
||||
body.max_scope_depth = 1;
|
||||
body.max_stack = 1;
|
||||
body.exceptions = new ABCException[0];
|
||||
AVM2Code code = new AVM2Code();
|
||||
code.code.add(new AVM2Instruction(0, new GetLocal0Ins(), new int[0]));
|
||||
code.code.add(new AVM2Instruction(0, new PushScopeIns(), new int[0]));
|
||||
code.code.add(new AVM2Instruction(0, new ReturnVoidIns(), new int[0]));
|
||||
body.setCode(code);
|
||||
Traits traits = new Traits();
|
||||
traits.traits = new ArrayList<>();
|
||||
body.traits = traits;
|
||||
abc.addMethodBody(body);
|
||||
mi.setBody(body);
|
||||
t = tm;
|
||||
break;
|
||||
case Trait.TRAIT_SLOT:
|
||||
case Trait.TRAIT_CONST:
|
||||
TraitSlotConst ts = new TraitSlotConst();
|
||||
ts.type_index = int_type;
|
||||
ts.value_kind = ValueKind.CONSTANT_Int;
|
||||
ts.value_index = abc.constants.getIntId(0, true);
|
||||
t = ts;
|
||||
break;
|
||||
}
|
||||
if (t != null) {
|
||||
t.kindType = kind;
|
||||
t.name_index = abc.constants.getMultinameId(m, true);
|
||||
int traitId;
|
||||
if (isStatic) {
|
||||
traitId = abc.class_info.get(class_index).static_traits.addTrait(t);
|
||||
} else {
|
||||
traitId = abc.class_info.get(class_index).static_traits.traits.size() + abc.instance_info.get(class_index).instance_traits.addTrait(t);
|
||||
}
|
||||
reload();
|
||||
decompiledTextArea.gotoTrait(traitId);
|
||||
}
|
||||
private void cancelDecompiledButtonActionPerformed(ActionEvent evt) {
|
||||
setDecompiledEditMode(false);
|
||||
}
|
||||
|
||||
private void saveDecompiledButtonActionPerformed(ActionEvent evt) {
|
||||
ScriptPack pack = decompiledTextArea.getScriptLeaf();
|
||||
int oldIndex = pack.scriptIndex;
|
||||
SWF.uncache(pack);
|
||||
|
||||
try {
|
||||
String oldSp = null;
|
||||
List<ScriptPack> packs = abc.script_info.get(oldIndex).getPacks(abc, oldIndex, null);
|
||||
if (!packs.isEmpty()) {
|
||||
oldSp = packs.get(0).getClassPath().toString();
|
||||
}
|
||||
|
||||
String as = decompiledTextArea.getText();
|
||||
abc.replaceScriptPack(pack, as);
|
||||
lastDecompiled = as;
|
||||
mainPanel.updateClassesList();
|
||||
|
||||
if (oldSp != null) {
|
||||
hilightScript(getSwf(), oldSp);
|
||||
}
|
||||
setDecompiledEditMode(false);
|
||||
reload();
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
|
||||
} catch (AVM2ParseException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
decompiledTextArea.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (CompilationException ex) {
|
||||
abc.script_info.get(oldIndex).delete(abc, false);
|
||||
decompiledTextArea.gotoLine((int) ex.line);
|
||||
decompiledTextArea.markError();
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
private void addTraitButtonActionPerformed(ActionEvent evt) {
|
||||
int class_index = decompiledTextArea.getClassIndex();
|
||||
if (class_index < 0) {
|
||||
return;
|
||||
}
|
||||
if (newTraitDialog == null) {
|
||||
newTraitDialog = new NewTraitDialog();
|
||||
}
|
||||
int void_type = abc.constants.getPublicQnameId("void", true);//abc.constants.forceGetMultinameId(new Multiname(Multiname.QNAME, abc.constants.forceGetStringId("void"), abc.constants.forceGetNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.forceGetStringId("")), 0), -1, -1, new ArrayList<Integer>()));
|
||||
int int_type = abc.constants.getPublicQnameId("int", true); //abc.constants.forceGetMultinameId(new Multiname(Multiname.QNAME, abc.constants.forceGetStringId("int"), abc.constants.forceGetNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.forceGetStringId("")), 0), -1, -1, new ArrayList<Integer>()));
|
||||
|
||||
Trait t = null;
|
||||
int kind;
|
||||
int nskind;
|
||||
String name = null;
|
||||
boolean isStatic;
|
||||
Multiname m;
|
||||
|
||||
boolean again = false;
|
||||
loopm:
|
||||
do {
|
||||
if (again) {
|
||||
View.showMessageDialog(null, AppStrings.translate("error.trait.exists").replace("%name%", name), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
again = false;
|
||||
if (newTraitDialog.showDialog() != AppDialog.OK_OPTION) {
|
||||
return;
|
||||
}
|
||||
kind = newTraitDialog.getTraitType();
|
||||
nskind = newTraitDialog.getNamespaceKind();
|
||||
name = newTraitDialog.getTraitName();
|
||||
isStatic = newTraitDialog.getStatic();
|
||||
m = new Multiname(Multiname.QNAME, abc.constants.getStringId(name, true), abc.constants.getNamespaceId(new Namespace(nskind, abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<>());
|
||||
int mid = abc.constants.getMultinameId(m);
|
||||
if (mid == 0) {
|
||||
break;
|
||||
}
|
||||
for (Trait tr : abc.class_info.get(class_index).static_traits.traits) {
|
||||
if (tr.name_index == mid) {
|
||||
again = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Trait tr : abc.instance_info.get(class_index).instance_traits.traits) {
|
||||
if (tr.name_index == mid) {
|
||||
again = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (again);
|
||||
switch (kind) {
|
||||
case Trait.TRAIT_GETTER:
|
||||
case Trait.TRAIT_SETTER:
|
||||
case Trait.TRAIT_METHOD:
|
||||
TraitMethodGetterSetter tm = new TraitMethodGetterSetter();
|
||||
MethodInfo mi = new MethodInfo(new int[0], void_type, abc.constants.getStringId(name, true), 0, new ValueKind[0], new int[0]);
|
||||
int method_info = abc.addMethodInfo(mi);
|
||||
tm.method_info = method_info;
|
||||
MethodBody body = new MethodBody();
|
||||
body.method_info = method_info;
|
||||
body.init_scope_depth = 1;
|
||||
body.max_regs = 1;
|
||||
body.max_scope_depth = 1;
|
||||
body.max_stack = 1;
|
||||
body.exceptions = new ABCException[0];
|
||||
AVM2Code code = new AVM2Code();
|
||||
code.code.add(new AVM2Instruction(0, new GetLocal0Ins(), new int[0]));
|
||||
code.code.add(new AVM2Instruction(0, new PushScopeIns(), new int[0]));
|
||||
code.code.add(new AVM2Instruction(0, new ReturnVoidIns(), new int[0]));
|
||||
body.setCode(code);
|
||||
Traits traits = new Traits();
|
||||
traits.traits = new ArrayList<>();
|
||||
body.traits = traits;
|
||||
abc.addMethodBody(body);
|
||||
mi.setBody(body);
|
||||
t = tm;
|
||||
break;
|
||||
case Trait.TRAIT_SLOT:
|
||||
case Trait.TRAIT_CONST:
|
||||
TraitSlotConst ts = new TraitSlotConst();
|
||||
ts.type_index = int_type;
|
||||
ts.value_kind = ValueKind.CONSTANT_Int;
|
||||
ts.value_index = abc.constants.getIntId(0, true);
|
||||
t = ts;
|
||||
break;
|
||||
}
|
||||
if (t != null) {
|
||||
t.kindType = kind;
|
||||
t.name_index = abc.constants.getMultinameId(m, true);
|
||||
int traitId;
|
||||
if (isStatic) {
|
||||
traitId = abc.class_info.get(class_index).static_traits.addTrait(t);
|
||||
} else {
|
||||
traitId = abc.class_info.get(class_index).static_traits.traits.size() + abc.instance_info.get(class_index).instance_traits.addTrait(t);
|
||||
}
|
||||
reload();
|
||||
decompiledTextArea.gotoTrait(traitId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi
|
||||
//acode.getBytes(abc.bodies.get(bodyIndex).getCodeBytes());
|
||||
abc.bodies.get(bodyIndex).setCode(acode);
|
||||
}
|
||||
|
||||
((Tag) abc.parentTag).setModified(true);
|
||||
abc.script_info.get(scriptIndex).setModified(true);
|
||||
textWithHex = null;
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.jpexs.decompiler.graph.CompilationException;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.Insets;
|
||||
@@ -68,6 +69,7 @@ import java.util.concurrent.CancellationException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
@@ -114,6 +116,8 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
|
||||
public JToggleButton hexOnlyButton;
|
||||
|
||||
public JToggleButton resolveConstantsButton;
|
||||
|
||||
public JLabel asmLabel = new HeaderLabel(AppStrings.translate("panel.disassembled"));
|
||||
|
||||
public JLabel decLabel = new HeaderLabel(AppStrings.translate("panel.decompiled"));
|
||||
@@ -477,11 +481,20 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
hexOnlyButton.setToolTipText(AppStrings.translate("button.viewhex"));
|
||||
hexOnlyButton.setMargin(new Insets(3, 3, 3, 3));
|
||||
|
||||
resolveConstantsButton = new JToggleButton(View.getIcon("constantpool16"));
|
||||
resolveConstantsButton.addActionListener(this::resolveConstantsButtonActionPerformed);
|
||||
resolveConstantsButton.setToolTipText(AppStrings.translate("button.resolveConstants"));
|
||||
resolveConstantsButton.setMargin(new Insets(3, 3, 3, 3));
|
||||
resolveConstantsButton.setSelected(Configuration.resolveConstants.get());
|
||||
|
||||
topButtonsPan = new JPanel();
|
||||
topButtonsPan.setLayout(new BoxLayout(topButtonsPan, BoxLayout.X_AXIS));
|
||||
topButtonsPan.add(graphButton);
|
||||
topButtonsPan.add(hexButton);
|
||||
topButtonsPan.add(hexOnlyButton);
|
||||
topButtonsPan.add(Box.createRigidArea(new Dimension(10, 0)));
|
||||
topButtonsPan.add(resolveConstantsButton);
|
||||
|
||||
JPanel panCode = new JPanel(new BorderLayout());
|
||||
panCode.add(new JScrollPane(editor), BorderLayout.CENTER);
|
||||
panCode.add(topButtonsPan, BorderLayout.NORTH);
|
||||
@@ -721,6 +734,16 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
setHex(getExportMode());
|
||||
}
|
||||
|
||||
private void resolveConstantsButtonActionPerformed(ActionEvent evt) {
|
||||
boolean resolve = resolveConstantsButton.isSelected();
|
||||
Configuration.resolveConstants.set(resolve);
|
||||
|
||||
srcWithHex = null;
|
||||
srcNoHex = null;
|
||||
// srcHexOnly = null; is not needed since it does not contains the resolved constant names
|
||||
setHex(getExportMode());
|
||||
}
|
||||
|
||||
private void cancelActionButtonActionPerformed(ActionEvent evt) {
|
||||
setEditMode(false);
|
||||
setHex(getExportMode());
|
||||
@@ -734,7 +757,10 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
|
||||
} else {
|
||||
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false));
|
||||
}
|
||||
|
||||
SWF.uncache(src);
|
||||
src.setModified();
|
||||
mainPanel.refreshTree(src.getSwf());
|
||||
setSource(this.src, false);
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
|
||||
saveButton.setVisible(false);
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.abc.ABCInputStream;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionListReader;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfo;
|
||||
import com.jpexs.decompiler.flash.dumpview.DumpInfoSwfNode;
|
||||
@@ -216,7 +215,7 @@ public class DumpTree extends JTree {
|
||||
di.parent = dumpInfo;
|
||||
rri.dumpInfo = di;
|
||||
rri.seek(action.getAddress());
|
||||
rri.readAction(new ConstantPool());
|
||||
rri.readAction();
|
||||
dumpInfo.getChildInfos().add(di);
|
||||
}
|
||||
repaint();
|
||||
|
||||
BIN
src/com/jpexs/decompiler/flash/gui/graphics/constantpool16.png
Normal file
BIN
src/com/jpexs/decompiler/flash/gui/graphics/constantpool16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 621 B |
@@ -583,3 +583,4 @@ preview.loop = Loop
|
||||
menu.file.import.script = Import script
|
||||
contextmenu.copyTagWithDependencies = Copy tag with dependencies to
|
||||
button.replaceWithTag = Replace with other character tag
|
||||
button.resolveConstants = Resolve constants
|
||||
|
||||
@@ -582,3 +582,4 @@ preview.loop = Ism\u00e9tl\u00e9s
|
||||
menu.file.import.script = Szkript import\u00e1l\u00e1sa
|
||||
contextmenu.copyTagWithDependencies = M\u00e1sol\u00e1s ide f\u00fcgg\u0151s\u00e9gekkel
|
||||
button.replaceWithTag = Csere m\u00e1sik karakter tagre
|
||||
button.resolveConstants = Konstansok felold\u00e1sa
|
||||
|
||||
Reference in New Issue
Block a user