mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 22:00:55 +00:00
AS1/2 Highlighting
This commit is contained in:
@@ -31,7 +31,6 @@ import java.awt.event.MouseEvent;
|
||||
import java.io.*;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.FileHandler;
|
||||
|
||||
@@ -383,8 +383,8 @@ public class Action {
|
||||
if (importantOffsets.contains(offset)) {
|
||||
ret += "loc" + Helper.formatAddress(offset) + ":";
|
||||
}
|
||||
ret += Highlighting.hilighOffset("", offset) + a.getASMSource(importantOffsets, constantPool, version) + "\r\n";
|
||||
offset += a.getBytes(version).length;
|
||||
ret += a.getASMSource(importantOffsets, constantPool, version) + "\r\n";
|
||||
}
|
||||
if (importantOffsets.contains(offset)) {
|
||||
ret += "loc" + Helper.formatAddress(offset) + ":\r\n";
|
||||
|
||||
@@ -158,7 +158,7 @@ public class TagNode {
|
||||
}
|
||||
String ret;
|
||||
if (isPcode) {
|
||||
ret = ((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION);
|
||||
ret = Highlighting.stripHilights(((ASMSource) node.tag).getASMSource(SWF.DEFAULT_VERSION));
|
||||
} else {
|
||||
List<com.jpexs.asdec.action.Action> as = ((ASMSource) node.tag).getActions(SWF.DEFAULT_VERSION);
|
||||
com.jpexs.asdec.action.Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION);
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.asdec.action.gui;
|
||||
|
||||
import com.jpexs.asdec.Main;
|
||||
import com.jpexs.asdec.SWF;
|
||||
import com.jpexs.asdec.abc.gui.LineMarkedEditorPane;
|
||||
import com.jpexs.asdec.action.TagNode;
|
||||
import com.jpexs.asdec.action.parser.ASMParser;
|
||||
import com.jpexs.asdec.action.parser.ParseException;
|
||||
@@ -34,17 +35,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import javax.swing.event.CaretEvent;
|
||||
import javax.swing.event.CaretListener;
|
||||
import javax.swing.event.TreeSelectionEvent;
|
||||
import javax.swing.event.TreeSelectionListener;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreePath;
|
||||
import jsyntaxpane.DefaultSyntaxKit;
|
||||
|
||||
public class ActionPanel extends JPanel implements TreeSelectionListener, ActionListener {
|
||||
public class ActionPanel extends JPanel implements TreeSelectionListener, ActionListener, CaretListener {
|
||||
|
||||
public JTree tagTree;
|
||||
public JEditorPane editor;
|
||||
public JEditorPane decompiledEditor;
|
||||
public LineMarkedEditorPane editor;
|
||||
public LineMarkedEditorPane decompiledEditor;
|
||||
public List<Tag> list;
|
||||
public JSplitPane splitPane;
|
||||
public JSplitPane splitPane2;
|
||||
@@ -53,12 +56,14 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action
|
||||
public JButton loadHexButton = new JButton("Load hex");
|
||||
public JLabel asmLabel = new JLabel("P-code source (editable)");
|
||||
public JLabel decLabel = new JLabel("ActionScript source");
|
||||
public List<Highlighting> decompiledHilights = new ArrayList<Highlighting>();
|
||||
public List<Highlighting> disassembledHilights = new ArrayList<Highlighting>();
|
||||
|
||||
public ActionPanel(List<Tag> list) {
|
||||
this.list = list;
|
||||
DefaultSyntaxKit.initKit();
|
||||
editor = new JEditorPane();
|
||||
decompiledEditor = new JEditorPane();
|
||||
editor = new LineMarkedEditorPane();
|
||||
decompiledEditor = new LineMarkedEditorPane();
|
||||
tagTree = new JTree(new TagTreeModel(list));
|
||||
|
||||
DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer();
|
||||
@@ -107,7 +112,7 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action
|
||||
editor.setContentType("text/flasm");
|
||||
decompiledEditor.setContentType("text/actionscript");
|
||||
tagTree.addTreeSelectionListener(this);
|
||||
|
||||
decompiledEditor.addCaretListener(this);
|
||||
}
|
||||
|
||||
public void initSplits() {
|
||||
@@ -128,12 +133,16 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action
|
||||
(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
editor.setText(asm.getASMSource(SWF.DEFAULT_VERSION));
|
||||
String disasm = asm.getASMSource(SWF.DEFAULT_VERSION);
|
||||
disassembledHilights = Highlighting.getInstrHighlights(disasm);
|
||||
editor.setText(Highlighting.stripHilights(disasm));
|
||||
if (Main.DO_DECOMPILE) {
|
||||
List<com.jpexs.asdec.action.Action> as = asm.getActions(SWF.DEFAULT_VERSION);
|
||||
com.jpexs.asdec.action.Action.setActionsAddresses(as, 0, SWF.DEFAULT_VERSION);
|
||||
decompiledEditor.setText("//Decompiling...");
|
||||
decompiledEditor.setText(Highlighting.stripHilights(com.jpexs.asdec.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION)));
|
||||
String s = com.jpexs.asdec.action.Action.actionsToSource(as, SWF.DEFAULT_VERSION);
|
||||
decompiledHilights = Highlighting.getInstrHighlights(s);
|
||||
decompiledEditor.setText(Highlighting.stripHilights(s));
|
||||
}
|
||||
Main.stopWork();
|
||||
}
|
||||
@@ -177,4 +186,21 @@ public class ActionPanel extends JPanel implements TreeSelectionListener, Action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void caretUpdate(CaretEvent e) {
|
||||
decompiledEditor.getCaret().setVisible(true);
|
||||
int pos = decompiledEditor.getCaretPosition();
|
||||
for (Highlighting h : decompiledHilights) {
|
||||
if ((pos >= h.startPos) && (pos < h.startPos + h.len)) {
|
||||
for (Highlighting h2 : disassembledHilights) {
|
||||
if (h2.offset == h.offset) {
|
||||
editor.setCaretPosition(h2.startPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,4 @@ public class ActionIf extends Action {
|
||||
public String toString() {
|
||||
return "ActionIf";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class AsciiToCharTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "ord(" + value.toString(constants) + ")";
|
||||
return hilight("ord(") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ public class CallFunctionTreeItem extends TreeItem {
|
||||
String paramStr = "";
|
||||
for (int t = 0; t < arguments.size(); t++) {
|
||||
if (t > 0) {
|
||||
paramStr += ",";
|
||||
paramStr += hilight(",");
|
||||
}
|
||||
paramStr += arguments.get(t).toString(constants);
|
||||
}
|
||||
return stripQuotes(functionName) + "(" + paramStr + ")";
|
||||
return stripQuotes(functionName) + hilight("(") + paramStr + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CallMethodTreeItem extends TreeItem {
|
||||
String paramStr = "";
|
||||
for (int t = 0; t < arguments.size(); t++) {
|
||||
if (t > 0) {
|
||||
paramStr += ",";
|
||||
paramStr += hilight(",");
|
||||
}
|
||||
paramStr += arguments.get(t).toString(constants);
|
||||
}
|
||||
@@ -54,8 +54,8 @@ public class CallMethodTreeItem extends TreeItem {
|
||||
}
|
||||
}
|
||||
if (blankMethod) {
|
||||
return scriptObject.toString(constants) + "(" + paramStr + ")";
|
||||
return scriptObject.toString(constants) + hilight("(") + paramStr + hilight(")");
|
||||
}
|
||||
return scriptObject.toString(constants) + "." + stripQuotes(methodName) + "(" + paramStr + ")";
|
||||
return scriptObject.toString(constants) + hilight(".") + stripQuotes(methodName) + hilight("(") + paramStr + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class CallTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return stripQuotes(value) + "()";
|
||||
return stripQuotes(value) + hilight("()");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class CastOpTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "(" + stripQuotes(constructor) + ")" + object.toString(constants);
|
||||
return hilight("(") + stripQuotes(constructor) + hilight(")") + object.toString(constants);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class CharToAsciiTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "chr(" + value.toString(constants) + ")";
|
||||
return hilight("chr(") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ public class CloneSpriteTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "duplicateMovieClip(" + target.toString(constants) + "," + source.toString(constants) + "," + depth.toString(constants) + ");";
|
||||
return hilight("duplicateMovieClip(") + target.toString(constants) + hilight(",") + source.toString(constants) + hilight(",") + depth.toString(constants) + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class DecrementTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return object.toString(constants) + "-1";
|
||||
return object.toString(constants) + hilight("-1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public class DefineLocalTreeItem extends TreeItem {
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (value == null) {
|
||||
return "var " + stripQuotes(name);
|
||||
return hilight("var ") + stripQuotes(name);
|
||||
}
|
||||
return "var " + stripQuotes(name) + "=" + value.toString(constants);
|
||||
return hilight("var ") + stripQuotes(name) + hilight("=") + value.toString(constants);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public class DeleteTreeItem extends TreeItem {
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (object == null) {
|
||||
return "delete " + propertyName.toString(constants);
|
||||
return hilight("delete ") + propertyName.toString(constants);
|
||||
}
|
||||
return "delete " + object.toString(constants) + "." + stripQuotes(propertyName);
|
||||
return hilight("delete ") + object.toString(constants) + "." + stripQuotes(propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,41 +38,41 @@ public class DirectValueTreeItem extends TreeItem {
|
||||
public String toStringNoQuotes(ConstantPool constants) {
|
||||
if (value instanceof Double) {
|
||||
if (Double.compare((double) (Double) value, 0) == 0) {
|
||||
return "0";
|
||||
return hilight("0");
|
||||
}
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
if (Float.compare((float) (Float) value, 0) == 0) {
|
||||
return "0";
|
||||
return hilight("0");
|
||||
}
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return (String) value;
|
||||
return hilight((String) value);
|
||||
}
|
||||
if (value instanceof ConstantIndex) {
|
||||
return (this.constants.get(((ConstantIndex) value).index));
|
||||
return hilight(this.constants.get(((ConstantIndex) value).index));
|
||||
}
|
||||
return value.toString();
|
||||
return hilight(value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (value instanceof Double) {
|
||||
if (Double.compare((double) (Double) value, 0) == 0) {
|
||||
return "0";
|
||||
return hilight("0");
|
||||
}
|
||||
}
|
||||
if (value instanceof Float) {
|
||||
if (Float.compare((float) (Float) value, 0) == 0) {
|
||||
return "0";
|
||||
return hilight("0");
|
||||
}
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return "\"" + Helper.escapeString((String) value) + "\"";
|
||||
return hilight("\"" + Helper.escapeString((String) value) + "\"");
|
||||
}
|
||||
if (value instanceof ConstantIndex) {
|
||||
return "\"" + Helper.escapeString(this.constants.get(((ConstantIndex) value).index)) + "\"";
|
||||
return hilight("\"" + Helper.escapeString(this.constants.get(((ConstantIndex) value).index)) + "\"");
|
||||
}
|
||||
return value.toString();
|
||||
return hilight(value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class ExtendsTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return subclass.toString(constants) + " extends " + stripQuotes(superclass);
|
||||
return subclass.toString(constants) + hilight(" extends ") + stripQuotes(superclass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@ public class FSCommand2TreeItem extends TreeItem {
|
||||
paramStr += ",";
|
||||
paramStr += arguments.get(t).toString(constants);
|
||||
}
|
||||
return "FSCommand2(" + command.toString(constants) + paramStr + ");";
|
||||
return hilight("FSCommand2(") + command.toString(constants) + paramStr + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,20 +37,20 @@ public class FunctionTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
String ret = "function";
|
||||
String ret = hilight("function");
|
||||
if (calculatedFunctionName != null) {
|
||||
ret += " " + calculatedFunctionName.toStringNoQuotes(constants);
|
||||
} else if (!functionName.equals("")) {
|
||||
ret += " " + functionName;
|
||||
}
|
||||
ret += "(";
|
||||
ret += hilight("(");
|
||||
for (int p = 0; p < paramNames.size(); p++) {
|
||||
if (p > 0) {
|
||||
ret += ", ";
|
||||
ret += hilight(", ");
|
||||
}
|
||||
ret += paramNames.get(p);
|
||||
ret += hilight(paramNames.get(p));
|
||||
}
|
||||
ret += ")\r\n{\r\n" + Action.treeToString(actions) + "}";
|
||||
ret += hilight(")") + "\r\n{\r\n" + Action.treeToString(actions) + "}";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public class GetPropertyTreeItem extends TreeItem {
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (isEmptyString(target)) {
|
||||
return Action.propertyNames[propertyIndex];
|
||||
return hilight(Action.propertyNames[propertyIndex]);
|
||||
}
|
||||
return target.toString(constants) + "." + Action.propertyNames[propertyIndex];
|
||||
return target.toString(constants) + hilight("." + Action.propertyNames[propertyIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class GetURL2TreeItem extends TreeItem {
|
||||
prefix = "loadMovie";
|
||||
}
|
||||
|
||||
return prefix + "(" + urlString.toString(constants) + "," + targetString.toString(constants) + methodStr + ");";
|
||||
return hilight(prefix + "(") + urlString.toString(constants) + hilight(",") + targetString.toString(constants) + hilight(methodStr + ")") + ";";
|
||||
}
|
||||
|
||||
public GetURL2TreeItem(Action instruction, TreeItem urlString, TreeItem targetString, int method, boolean loadTargetFlag, boolean loadVariablesFlag) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class GetURLTreeItem extends TreeItem {
|
||||
public String targetString;
|
||||
|
||||
public String toString(ConstantPool constants) {
|
||||
return "getUrl(\"" + Helper.escapeString(urlString) + "\", \"" + Helper.escapeString(targetString) + "\");";
|
||||
return hilight("getUrl(\"") + Helper.escapeString(urlString) + "\", \"" + Helper.escapeString(targetString) + hilight("\")") + ";";
|
||||
}
|
||||
|
||||
public GetURLTreeItem(Action instruction, String urlString, String targetString) {
|
||||
|
||||
@@ -39,6 +39,6 @@ public class GotoFrame2TreeItem extends TreeItem {
|
||||
if (playFlag) {
|
||||
prefix = "gotoAndPlay";
|
||||
}
|
||||
return prefix + "(" + frame.toString(constants) + (sceneBiasFlag ? "," + sceneBias : "") + ");";
|
||||
return hilight(prefix + "(") + frame.toString(constants) + (sceneBiasFlag ? "," + sceneBias : "") + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class GotoFrameTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "gotoAndStop(" + frame + ");";
|
||||
return hilight("gotoAndStop(") + frame + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ public class GotoLabelTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "gotoAndStop(\"" + Helper.escapeString(label) + "\");";
|
||||
return hilight("gotoAndStop(\"") + Helper.escapeString(label) + hilight("\")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public class ImplementsOpTreeItem extends TreeItem {
|
||||
}
|
||||
impStr += superclasses.get(i).toString(constants);
|
||||
}
|
||||
return subclass.toString(constants) + " implements " + impStr;
|
||||
return subclass.toString(constants) + hilight(" implements ") + impStr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class IncrementTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return object.toString(constants) + "+1";
|
||||
return object.toString(constants) + hilight("+1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ public class InitArrayTreeItem extends TreeItem {
|
||||
String arrStr = "";
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
if (i > 0) {
|
||||
arrStr += ",";
|
||||
arrStr += hilight(",");
|
||||
}
|
||||
arrStr += values.get(i).toString(constants);
|
||||
}
|
||||
return "[" + arrStr + "]";
|
||||
return hilight("[") + arrStr + hilight("]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ public class InitObjectTreeItem extends TreeItem {
|
||||
String objStr = "";
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
if (i > 0) {
|
||||
objStr += ",";
|
||||
objStr += hilight(",");
|
||||
}
|
||||
objStr += names.get(i).toString(constants) + ":" + values.get(i).toString(constants);
|
||||
objStr += names.get(i).toString(constants) + hilight(":") + values.get(i).toString(constants);
|
||||
}
|
||||
return "{" + objStr + "}";
|
||||
return hilight("{") + objStr + hilight("}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class MBAsciiToCharTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "mbord(" + value.toString(constants) + ")";
|
||||
return hilight("mbord(") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class MBCharToAsciiTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "mbchr(" + value.toString(constants) + ")";
|
||||
return hilight("mbchr(") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ public class MBStringExtractTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "mbsubstring(" + value.toString(constants) + "," + index.toString(constants) + "," + count.toString(constants) + ")";
|
||||
return hilight("mbsubstring(") + value.toString(constants) + hilight(",") + index.toString(constants) + hilight(",") + count.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ public class NewMethodTreeItem extends TreeItem {
|
||||
if (blankMethod) {
|
||||
return scriptObject.toString(constants) + "(" + paramStr + ")";
|
||||
}
|
||||
return "new " + scriptObject.toString(constants) + "." + methodNameStr + "(" + paramStr + ")";
|
||||
return hilight("new ") + scriptObject.toString(constants) + hilight(".") + methodNameStr + hilight("(") + paramStr + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@ public class NewObjectTreeItem extends TreeItem {
|
||||
}
|
||||
paramStr += arguments.get(t).toString(constants);
|
||||
}
|
||||
return "new " + stripQuotes(objectName) + "(" + paramStr + ")";
|
||||
return hilight("new ") + stripQuotes(objectName) + hilight("(") + paramStr + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class RandomNumberTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "random(" + maximum.toString(constants) + ")";
|
||||
return hilight("random(") + maximum.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class RemoveSpriteTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "removeMovieClip(" + target.toString(constants) + ");";
|
||||
return hilight("removeMovieClip(") + target.toString(constants) + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class ReturnTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "return " + value.toString(constants) + ";";
|
||||
return hilight("return ") + value.toString(constants) + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.jpexs.asdec.action.treemodel;
|
||||
|
||||
import com.jpexs.asdec.action.Action;
|
||||
|
||||
public class SetMemberTreeItem extends TreeItem implements SetTypeTreeItem{
|
||||
public class SetMemberTreeItem extends TreeItem implements SetTypeTreeItem {
|
||||
|
||||
public TreeItem object;
|
||||
public TreeItem objectName;
|
||||
@@ -40,6 +40,4 @@ public class SetMemberTreeItem extends TreeItem implements SetTypeTreeItem{
|
||||
public TreeItem getObject() {
|
||||
return new GetMemberTreeItem(instruction, object, objectName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.jpexs.asdec.action.treemodel;
|
||||
|
||||
import com.jpexs.asdec.action.Action;
|
||||
|
||||
public class SetPropertyTreeItem extends TreeItem implements SetTypeTreeItem{
|
||||
public class SetPropertyTreeItem extends TreeItem implements SetTypeTreeItem {
|
||||
|
||||
public TreeItem target;
|
||||
public int propertyIndex;
|
||||
@@ -34,15 +34,13 @@ public class SetPropertyTreeItem extends TreeItem implements SetTypeTreeItem{
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (isEmptyString(target)) {
|
||||
return Action.propertyNames[propertyIndex] + "=" + value.toString(constants) + ";";
|
||||
return hilight(Action.propertyNames[propertyIndex] + "=") + value.toString(constants) + ";";
|
||||
}
|
||||
return target.toString(constants) + "." + Action.propertyNames[propertyIndex] + "=" + value.toString(constants) + ";";
|
||||
return target.toString(constants) + hilight("." + Action.propertyNames[propertyIndex] + "=") + value.toString(constants) + ";";
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeItem getObject() {
|
||||
return new GetPropertyTreeItem(instruction, target, propertyIndex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class SetTarget2TreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "tellTarget(" + target.toString(constants) + ");";
|
||||
return hilight("tellTarget(") + target.toString(constants) + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ public class SetTargetTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "tellTarget(\"" + Helper.escapeString(target) + "\");";
|
||||
return hilight("tellTarget(\"") + Helper.escapeString(target) + hilight("\")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,6 @@ package com.jpexs.asdec.action.treemodel;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface SetTypeTreeItem {
|
||||
|
||||
public TreeItem getObject();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,6 @@ public class StartDragTreeItem extends TreeItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
return "startDrag(" + target.toString(constants) + "," + lockCenter.toString(constants) + (hasConstrains ? "," + x1.toString(constants) + "," + y1.toString(constants) + "," + x2.toString(constants) + "," + y2.toString(constants) : "") + ")";
|
||||
return hilight("startDrag(") + target.toString(constants) + hilight(",") + lockCenter.toString(constants) + (hasConstrains ? hilight(",") + x1.toString(constants) + hilight(",") + y1.toString(constants) + hilight(",") + x2.toString(constants) + hilight(",") + y2.toString(constants) : "") + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class StoreRegisterTreeItem extends TreeItem implements SetTypeTreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return register.toString() + "=" + value.toString(constants) + ";";
|
||||
return hilight(register.toString() + "=") + value.toString(constants) + ";";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,6 @@ public class ThrowTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "throw " + object.toString(constants) + ";";
|
||||
return hilight("throw ") + object.toString(constants) + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class ToIntegerTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "int(" + value.toString(constants) + ")";
|
||||
return hilight("int(") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class ToNumberTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return value.toString(constants) + ".valueOf()";
|
||||
return value.toString(constants) + hilight(".valueOf()");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class ToStringTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return value.toString(constants) + ".toString()";
|
||||
return value.toString(constants) + hilight(".toString()");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class TraceTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "trace(" + value.toString(constants) + ");";
|
||||
return hilight("trace(") + value.toString(constants) + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public abstract class TreeItem {
|
||||
protected String stripQuotes(TreeItem target) {
|
||||
if (target instanceof DirectValueTreeItem) {
|
||||
if (((DirectValueTreeItem) target).value instanceof String) {
|
||||
return (String) ((DirectValueTreeItem) target).value;
|
||||
return (String) ((DirectValueTreeItem) target).hilight((String) ((DirectValueTreeItem) target).value);
|
||||
}
|
||||
}
|
||||
if (target == null) {
|
||||
|
||||
@@ -29,6 +29,6 @@ public class TypeOfTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "typeof(" + value.toString(constants) + ")";
|
||||
return hilight("typeof(") + value.toString(constants) + hilight(")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class WaitForFrame2TreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "waitForFrame2(" + frame.toString(constants) + "," + skipCount + ");";
|
||||
return hilight("waitForFrame2(") + frame.toString(constants) + "," + skipCount + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class WaitForFrameTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return "waitForFrame(" + frame + "," + skipCount + ");";
|
||||
return hilight("waitForFrame(") + frame + "," + skipCount + hilight(")") + ";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,26 +35,26 @@ public class ClassTreeItem extends TreeItem implements Block {
|
||||
public HashMap<TreeItem, TreeItem> vars;
|
||||
public HashMap<TreeItem, TreeItem> staticVars;
|
||||
|
||||
public ClassTreeItem(TreeItem className, TreeItem extendsOp, List<TreeItem> implementsOp, List<FunctionTreeItem> functions, HashMap<TreeItem, TreeItem> vars,List<FunctionTreeItem> staticFunctions,HashMap<TreeItem, TreeItem> staticVars) {
|
||||
public ClassTreeItem(TreeItem className, TreeItem extendsOp, List<TreeItem> implementsOp, List<FunctionTreeItem> functions, HashMap<TreeItem, TreeItem> vars, List<FunctionTreeItem> staticFunctions, HashMap<TreeItem, TreeItem> staticVars) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.className = className;
|
||||
this.functions = functions;
|
||||
this.vars = vars;
|
||||
this.extendsOp = extendsOp;
|
||||
this.implementsOp = implementsOp;
|
||||
this.staticFunctions=staticFunctions;
|
||||
this.staticVars=staticVars;
|
||||
this.staticFunctions = staticFunctions;
|
||||
this.staticVars = staticVars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
String ret;
|
||||
ret = "class " + className.toStringNoQuotes(constants);
|
||||
ret = hilight("class ") + className.toStringNoQuotes(constants);
|
||||
if (extendsOp != null) {
|
||||
ret += " extends " + extendsOp.toStringNoQuotes(constants);
|
||||
ret += hilight(" extends ") + extendsOp.toStringNoQuotes(constants);
|
||||
}
|
||||
if (!implementsOp.isEmpty()) {
|
||||
ret += " implements ";
|
||||
ret += hilight(" implements ");
|
||||
boolean first = true;
|
||||
for (TreeItem t : implementsOp) {
|
||||
if (!first) {
|
||||
@@ -69,7 +69,7 @@ public class ClassTreeItem extends TreeItem implements Block {
|
||||
ret += f.toString(constants) + "\r\n";
|
||||
}
|
||||
for (FunctionTreeItem f : staticFunctions) {
|
||||
ret += "static "+f.toString(constants) + "\r\n";
|
||||
ret += "static " + f.toString(constants) + "\r\n";
|
||||
}
|
||||
for (TreeItem v : vars.keySet()) {
|
||||
ret += "var " + v.toStringNoQuotes(constants) + " = " + vars.get(v).toStringNoQuotes(constants) + ";\r\n";
|
||||
|
||||
@@ -233,7 +233,6 @@ public class MainFrame extends JFrame implements ActionListener {
|
||||
menuDeobfuscation.add(miRenameIdentifiers);
|
||||
|
||||
|
||||
|
||||
JMenu menuTools = new JMenu("Tools");
|
||||
JMenuItem miProxy = new JMenuItem("Proxy");
|
||||
miProxy.setActionCommand("SHOWPROXY");
|
||||
@@ -313,7 +312,6 @@ public class MainFrame extends JFrame implements ActionListener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
loadingPanel.setPreferredSize(new Dimension(30, 30));
|
||||
statusPanel = new JPanel();
|
||||
statusPanel.setPreferredSize(new Dimension(1, 30));
|
||||
|
||||
@@ -26,11 +26,6 @@ import com.jpexs.asdec.tags.DefineBitsLosslessTag;
|
||||
import com.jpexs.asdec.tags.DefineBitsTag;
|
||||
import com.jpexs.asdec.tags.DefineMorphShape2Tag;
|
||||
import com.jpexs.asdec.tags.DefineMorphShapeTag;
|
||||
import com.jpexs.asdec.tags.DefineShape2Tag;
|
||||
import com.jpexs.asdec.tags.DefineShape3Tag;
|
||||
import com.jpexs.asdec.tags.DefineShape4Tag;
|
||||
import com.jpexs.asdec.tags.DefineShapeTag;
|
||||
import com.jpexs.asdec.tags.DefineSpriteTag;
|
||||
import com.jpexs.asdec.tags.DefineTextTag;
|
||||
import com.jpexs.asdec.tags.EndTag;
|
||||
import com.jpexs.asdec.tags.JPEGTablesTag;
|
||||
|
||||
@@ -22,10 +22,8 @@ import com.jpexs.asdec.types.LINESTYLE;
|
||||
import com.jpexs.asdec.types.LINESTYLE2;
|
||||
import com.jpexs.asdec.types.LINESTYLEARRAY;
|
||||
import com.jpexs.asdec.types.RECT;
|
||||
import com.jpexs.asdec.types.RGB;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user