mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 02:30:44 +00:00
AS3: "All" option in ABC list to merge scripts into 1 tree
AS3: Better decompiling namespaces
This commit is contained in:
@@ -297,13 +297,18 @@ public class SWF {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
List<DoABCTag> abcTags=new ArrayList<DoABCTag>();
|
||||||
for (Tag t : tags) {
|
for (Tag t : tags) {
|
||||||
if (t instanceof DoABCTag) {
|
if (t instanceof DoABCTag) {
|
||||||
((DoABCTag) t).abc.addEventListener(evl);
|
abcTags.add((DoABCTag)t);
|
||||||
((DoABCTag) t).abc.export(outdir, isPcode);
|
|
||||||
asV3Found = true;
|
asV3Found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(DoABCTag t:abcTags){
|
||||||
|
t.abc.addEventListener(evl);
|
||||||
|
t.abc.export(outdir, isPcode,abcTags);
|
||||||
|
}
|
||||||
|
|
||||||
if (!asV3Found) {
|
if (!asV3Found) {
|
||||||
List<Object> list2 = new ArrayList<Object>();
|
List<Object> list2 = new ArrayList<Object>();
|
||||||
list2.addAll(tags);
|
list2.addAll(tags);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.jpexs.asdec.abc.types.traits.TraitSlotConst;
|
|||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
import com.jpexs.asdec.abc.usages.*;
|
import com.jpexs.asdec.abc.usages.*;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -474,52 +475,48 @@ public class ABC {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Map from multiname index of namespace value to namespace name**/
|
/* Map from multiname index of namespace value to namespace name**/
|
||||||
private HashMap<Integer, Integer> namespaceMap;
|
private HashMap<String, String> namespaceMap;
|
||||||
|
|
||||||
private void loadNamespaceMap() {
|
private void loadNamespaceMap() {
|
||||||
namespaceMap = new HashMap<Integer, Integer>();
|
namespaceMap = new HashMap<String, String>();
|
||||||
for (ScriptInfo si : script_info) {
|
for (ScriptInfo si : script_info) {
|
||||||
for (Trait t : si.traits.traits) {
|
for (Trait t : si.traits.traits) {
|
||||||
if (t instanceof TraitSlotConst) {
|
if (t instanceof TraitSlotConst) {
|
||||||
TraitSlotConst s = ((TraitSlotConst) t);
|
TraitSlotConst s = ((TraitSlotConst) t);
|
||||||
if (s.value_kind == ValueKind.CONSTANT_Namespace) {
|
if (s.isNamespace()) {
|
||||||
namespaceMap.put(s.value_index, s.name_index);
|
String key=constants.constant_namespace[s.value_index].getName(constants);
|
||||||
|
String val=constants.constant_multiname[s.name_index].getNameWithNamespace(constants);
|
||||||
|
namespaceMap.put(key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int nsValueToName(int value_index) {
|
public String builtInNs(String ns) {
|
||||||
if (namespaceMap.containsKey(value_index)) {
|
if (ns.equals("http://www.adobe.com/2006/actionscript/flash/proxy")) {
|
||||||
return namespaceMap.get(value_index);
|
return "flash.utils.flash_proxy";
|
||||||
|
}
|
||||||
|
if(ns.equals("http://adobe.com/AS3/2006/builtin")){
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String nsValueToName(String value) {
|
||||||
|
if (namespaceMap.containsKey(value)) {
|
||||||
|
return namespaceMap.get(value);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
String ns=builtInNs(value);
|
||||||
}
|
if(ns==null){
|
||||||
}
|
return "";
|
||||||
|
}else{
|
||||||
public HashMap<String, String> namespacesToString() {
|
return ns;
|
||||||
HashMap<String, String> ret = new HashMap<String, String>();
|
|
||||||
for (Integer value_index : namespaceMap.keySet()) {
|
|
||||||
int name_index = namespaceMap.get(value_index);
|
|
||||||
String n = "";
|
|
||||||
String packageName = constants.constant_multiname[name_index].getNamespace(constants).getName(constants);
|
|
||||||
n += ("package " + packageName + "\r\n");
|
|
||||||
n += ("{\r\n");
|
|
||||||
Namespace ns = constants.constant_multiname[name_index].getNamespace(constants);
|
|
||||||
String modifiers = ns.getPrefix(this);
|
|
||||||
if (!modifiers.equals("")) {
|
|
||||||
modifiers += " ";
|
|
||||||
}
|
}
|
||||||
String nsname = constants.constant_multiname[name_index].getName(constants);
|
|
||||||
n += IDENT_STRING + modifiers + "namespace " + nsname + " = \"" + Helper.escapeString(constants.constant_namespace[value_index].getName(constants)) + "\";\r\n";
|
|
||||||
n += ("}\r\n");
|
|
||||||
ret.put(packageName + "." + nsname, n);
|
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void export(String directory, boolean pcode) throws IOException {
|
public void export(String directory, boolean pcode,List<DoABCTag> abcList) throws IOException {
|
||||||
for (int i = 0; i < script_info.length; i++) {
|
for (int i = 0; i < script_info.length; i++) {
|
||||||
String path = script_info[i].getPath(this);
|
String path = script_info[i].getPath(this);
|
||||||
String packageName = path.substring(0, path.lastIndexOf("."));
|
String packageName = path.substring(0, path.lastIndexOf("."));
|
||||||
@@ -536,7 +533,7 @@ public class ABC {
|
|||||||
}
|
}
|
||||||
String fileName = outDir.toString() + File.separator + className + ".as";
|
String fileName = outDir.toString() + File.separator + className + ".as";
|
||||||
FileOutputStream fos = new FileOutputStream(fileName);
|
FileOutputStream fos = new FileOutputStream(fileName);
|
||||||
fos.write(script_info[i].convert(this, pcode, false).getBytes());
|
fos.write(script_info[i].convert(abcList,this, pcode, false).getBytes());
|
||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class FullMultinameTreeItem extends TreeItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames) {
|
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames) {
|
||||||
String ret;
|
String ret = "";
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
ret = "[" + name.toString(constants, localRegNames) + "]";
|
ret = "[" + name.toString(constants, localRegNames) + "]";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -91,19 +91,25 @@ public abstract class TreeItem {
|
|||||||
return propertyName.toString(constants, localRegNames);
|
return propertyName.toString(constants, localRegNames);
|
||||||
}
|
}
|
||||||
if (propertyName instanceof FullMultinameTreeItem) {
|
if (propertyName instanceof FullMultinameTreeItem) {
|
||||||
|
|
||||||
if (((FullMultinameTreeItem) propertyName).isRuntime()) {
|
if (((FullMultinameTreeItem) propertyName).isRuntime()) {
|
||||||
return obStr + propertyName.toString(constants, localRegNames);
|
return joinProperty(obStr ,propertyName.toString(constants, localRegNames));
|
||||||
} else {
|
} else {
|
||||||
if (!obStr.equals("")) {
|
return joinProperty(obStr,((FullMultinameTreeItem) propertyName).toString(constants, localRegNames));
|
||||||
obStr += ".";
|
|
||||||
}
|
|
||||||
return obStr + ((FullMultinameTreeItem) propertyName).toString(constants, localRegNames);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return obStr + "[" + propertyName.toString(constants, localRegNames) + "]";
|
return obStr + "[" + propertyName.toString(constants, localRegNames) + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String joinProperty(String prefix,String name){
|
||||||
|
if(prefix.endsWith(".")){
|
||||||
|
prefix=prefix.substring(0,prefix.length()-1);
|
||||||
|
}
|
||||||
|
if(!name.startsWith("[")){
|
||||||
|
return prefix+"."+name;
|
||||||
|
}
|
||||||
|
return prefix+name;
|
||||||
|
}
|
||||||
|
|
||||||
public TreeItem getNotCoerced() {
|
public TreeItem getNotCoerced() {
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class ABCComboBoxModel implements ComboBoxModel {
|
|||||||
|
|
||||||
public List<DoABCTag> list;
|
public List<DoABCTag> list;
|
||||||
public int itemIndex = 0;
|
public int itemIndex = 0;
|
||||||
|
public static final String ROOT=" - all - ";
|
||||||
|
|
||||||
public ABCComboBoxModel(List<DoABCTag> list) {
|
public ABCComboBoxModel(List<DoABCTag> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
@@ -33,11 +34,14 @@ public class ABCComboBoxModel implements ComboBoxModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return list.size();
|
return 1+list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
return list.get(index);
|
if(index==0){
|
||||||
|
return ROOT;
|
||||||
|
}
|
||||||
|
return list.get(index-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListDataListener(ListDataListener l) {
|
public void addListDataListener(ListDataListener l) {
|
||||||
@@ -47,7 +51,11 @@ public class ABCComboBoxModel implements ComboBoxModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedItem(Object anItem) {
|
public void setSelectedItem(Object anItem) {
|
||||||
itemIndex = list.indexOf(anItem);
|
if(anItem==ROOT){
|
||||||
|
itemIndex=0;
|
||||||
|
}else{
|
||||||
|
itemIndex = 1+list.indexOf(anItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import com.jpexs.asdec.abc.ABC;
|
|||||||
import com.jpexs.asdec.abc.types.ScriptInfo;
|
import com.jpexs.asdec.abc.types.ScriptInfo;
|
||||||
import com.jpexs.asdec.abc.types.traits.Trait;
|
import com.jpexs.asdec.abc.types.traits.Trait;
|
||||||
import com.jpexs.asdec.abc.types.traits.TraitClass;
|
import com.jpexs.asdec.abc.types.traits.TraitClass;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
import javax.swing.event.TreeSelectionEvent;
|
import javax.swing.event.TreeSelectionEvent;
|
||||||
@@ -30,8 +32,7 @@ import javax.swing.tree.TreePath;
|
|||||||
|
|
||||||
public class ClassesListTree extends JTree implements TreeSelectionListener {
|
public class ClassesListTree extends JTree implements TreeSelectionListener {
|
||||||
|
|
||||||
public ABC abc;
|
private List<DoABCTag> abcList;
|
||||||
|
|
||||||
public void selectClass(int classIndex) {
|
public void selectClass(int classIndex) {
|
||||||
ClassesListTreeModel model = (ClassesListTreeModel) getModel();
|
ClassesListTreeModel model = (ClassesListTreeModel) getModel();
|
||||||
TreeElement selectedElement = model.getElementByClassIndex(classIndex);
|
TreeElement selectedElement = model.getElementByClassIndex(classIndex);
|
||||||
@@ -40,9 +41,9 @@ public class ClassesListTree extends JTree implements TreeSelectionListener {
|
|||||||
scrollPathToVisible(treePath);
|
scrollPathToVisible(treePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassesListTree(ABC abc) {
|
public ClassesListTree(List<DoABCTag> list) {
|
||||||
this.abc = abc;
|
this.abcList=list;
|
||||||
setModel(new ClassesListTreeModel(abc));
|
setModel(new ClassesListTreeModel(list));
|
||||||
addTreeSelectionListener(this);
|
addTreeSelectionListener(this);
|
||||||
DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer();
|
DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer();
|
||||||
ClassLoader cldr = this.getClass().getClassLoader();
|
ClassLoader cldr = this.getClass().getClassLoader();
|
||||||
@@ -52,9 +53,9 @@ public class ClassesListTree extends JTree implements TreeSelectionListener {
|
|||||||
setCellRenderer(treeRenderer);
|
setCellRenderer(treeRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setABC(ABC abc) {
|
public void setDoABCTags(List<DoABCTag> list) {
|
||||||
setModel(new ClassesListTreeModel(abc));
|
this.abcList=list;
|
||||||
this.abc = abc;
|
setModel(new ClassesListTreeModel(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void valueChanged(TreeSelectionEvent e) {
|
public void valueChanged(TreeSelectionEvent e) {
|
||||||
@@ -66,23 +67,25 @@ public class ClassesListTree extends JTree implements TreeSelectionListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object item = tp.getItem();
|
Object item = tp.getItem();
|
||||||
if (item instanceof ScriptInfo) {
|
if (item instanceof TreeLeafScript) {
|
||||||
final ScriptInfo script = (ScriptInfo) item;
|
final TreeLeafScript scriptLeaf = (TreeLeafScript) item;
|
||||||
|
|
||||||
if (!Main.isWorking()) {
|
if (!Main.isWorking()) {
|
||||||
Main.startWork("Decompiling class...");
|
Main.startWork("Decompiling...");
|
||||||
(new Thread() {
|
(new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
int classIndex = -1;
|
int classIndex = -1;
|
||||||
for (Trait t : script.traits.traits) {
|
for (Trait t : scriptLeaf.abc.script_info[scriptLeaf.scriptIndex].traits.traits) {
|
||||||
if (t instanceof TraitClass) {
|
if (t instanceof TraitClass) {
|
||||||
classIndex = ((TraitClass) t).class_info;
|
classIndex = ((TraitClass) t).class_info;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Main.abcMainFrame.navigator.setClassIndex(classIndex);
|
Main.abcMainFrame.navigator.setClassIndex(classIndex);
|
||||||
Main.abcMainFrame.decompiledTextArea.setScript(script, abc);
|
Main.abcMainFrame.navigator.setABC(abcList,scriptLeaf.abc);
|
||||||
|
Main.abcMainFrame.setAbc(scriptLeaf.abc);
|
||||||
|
Main.abcMainFrame.decompiledTextArea.setScript(scriptLeaf.abc.script_info[scriptLeaf.scriptIndex], scriptLeaf.abc,abcList);
|
||||||
Main.abcMainFrame.detailPanel.methodTraitPanel.methodCodePanel.sourceTextArea.setText("");
|
Main.abcMainFrame.detailPanel.methodTraitPanel.methodCodePanel.sourceTextArea.setText("");
|
||||||
Main.stopWork();
|
Main.stopWork();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.gui;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.ScriptInfo;
|
import com.jpexs.asdec.abc.types.ScriptInfo;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.event.TreeModelListener;
|
import javax.swing.event.TreeModelListener;
|
||||||
import javax.swing.tree.TreeModel;
|
import javax.swing.tree.TreeModel;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
@@ -50,16 +52,18 @@ class ClassIndexVisitor implements TreeVisitor {
|
|||||||
|
|
||||||
public class ClassesListTreeModel implements TreeModel {
|
public class ClassesListTreeModel implements TreeModel {
|
||||||
|
|
||||||
private ABC abc;
|
|
||||||
private Tree classTree = new Tree();
|
private Tree classTree = new Tree();
|
||||||
|
private List<DoABCTag> list;
|
||||||
|
|
||||||
public ClassesListTreeModel(ABC abc) {
|
public ClassesListTreeModel(List<DoABCTag> list) {
|
||||||
this.abc = abc;
|
this.list = list;
|
||||||
for (ScriptInfo si : abc.script_info) {
|
for (DoABCTag tag : list) {
|
||||||
String path = si.getPath(abc);
|
for (int i = 0; i < tag.abc.script_info.length; i++) {
|
||||||
String nsName = path.substring(path.lastIndexOf(".") + 1);
|
String path = tag.abc.script_info[i].getPath(tag.abc);
|
||||||
String packageName = path.substring(0, path.lastIndexOf("."));
|
String nsName = path.substring(path.lastIndexOf(".") + 1);
|
||||||
classTree.add(nsName, packageName, si);
|
String packageName = path.substring(0, path.lastIndexOf("."));
|
||||||
|
classTree.add(nsName, packageName, new TreeLeafScript(tag.abc, i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.jpexs.asdec.abc.types.ScriptInfo;
|
|||||||
import com.jpexs.asdec.abc.types.traits.Trait;
|
import com.jpexs.asdec.abc.types.traits.Trait;
|
||||||
import com.jpexs.asdec.abc.types.traits.TraitSlotConst;
|
import com.jpexs.asdec.abc.types.traits.TraitSlotConst;
|
||||||
import com.jpexs.asdec.helpers.Highlighting;
|
import com.jpexs.asdec.helpers.Highlighting;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -177,7 +178,9 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
|
|||||||
addCaretListener(this);
|
addCaretListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScript(ScriptInfo script, ABC abc) {
|
private List<DoABCTag> abcList;
|
||||||
|
|
||||||
|
public void setScript(ScriptInfo script, ABC abc,List<DoABCTag> abcList) {
|
||||||
setText("//Please wait...");
|
setText("//Please wait...");
|
||||||
if (script == null) {
|
if (script == null) {
|
||||||
highlights = new ArrayList<Highlighting>();
|
highlights = new ArrayList<Highlighting>();
|
||||||
@@ -189,7 +192,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
|
|||||||
|
|
||||||
String hilightedCode;
|
String hilightedCode;
|
||||||
if (!bufferedClasses.containsKey(script)) {
|
if (!bufferedClasses.containsKey(script)) {
|
||||||
hilightedCode = script.convert(abc, false, true);
|
hilightedCode = script.convert(abcList,abc, false, true);
|
||||||
highlights = Highlighting.getInstrHighlights(hilightedCode);
|
highlights = Highlighting.getInstrHighlights(hilightedCode);
|
||||||
traitHighlights = Highlighting.getTraitHighlights(hilightedCode);
|
traitHighlights = Highlighting.getTraitHighlights(hilightedCode);
|
||||||
methodHighlights = Highlighting.getMethodHighlights(hilightedCode);
|
methodHighlights = Highlighting.getMethodHighlights(hilightedCode);
|
||||||
@@ -205,6 +208,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
|
|||||||
}
|
}
|
||||||
setText(hilightedCode);
|
setText(hilightedCode);
|
||||||
this.abc = abc;
|
this.abc = abc;
|
||||||
|
this.abcList = abcList;
|
||||||
this.script = script;
|
this.script = script;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +216,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
|
|||||||
if (bufferedClasses.containsKey(script)) {
|
if (bufferedClasses.containsKey(script)) {
|
||||||
bufferedClasses.remove(script);
|
bufferedClasses.remove(script);
|
||||||
}
|
}
|
||||||
setScript(script, abc);
|
setScript(script, abc,abcList);
|
||||||
setNoTrait();
|
setNoTrait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,14 +52,13 @@ public class IconListRenderer
|
|||||||
// Get icon to use for the list item value
|
// Get icon to use for the list item value
|
||||||
|
|
||||||
String modifiersRegex = "(public |static |final |override |private |protected |package )*";
|
String modifiersRegex = "(public |static |final |override |private |protected |package )*";
|
||||||
|
if((" "+value.toString()).contains(" const ")){
|
||||||
if (value.toString().matches(modifiersRegex + "const .*")) {
|
|
||||||
label.setIcon(constIcon);
|
label.setIcon(constIcon);
|
||||||
}
|
}
|
||||||
if (value.toString().matches(modifiersRegex + "var .*")) {
|
if((" "+value.toString()).contains(" var ")){
|
||||||
label.setIcon(variableIcon);
|
label.setIcon(variableIcon);
|
||||||
}
|
}
|
||||||
if (value.toString().matches(modifiersRegex + "function .*")) {
|
if((" "+value.toString()).contains(" function ")){
|
||||||
label.setIcon(functionIcon);
|
label.setIcon(functionIcon);
|
||||||
}
|
}
|
||||||
if (value.toString().equals(TraitsListModel.STR_CLASS_INITIALIZER)) {
|
if (value.toString().equals(TraitsListModel.STR_CLASS_INITIALIZER)) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.awt.Component;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -116,6 +117,13 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAbc(ABC abc) {
|
||||||
|
this.abc = abc;
|
||||||
|
updateConstList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void updateConstList() {
|
public void updateConstList() {
|
||||||
switch (constantTypeList.getSelectedIndex()) {
|
switch (constantTypeList.getSelectedIndex()) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -148,14 +156,19 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void switchAbc(int index) {
|
public void switchAbc(int index) {
|
||||||
listIndex = index;
|
listIndex = index;
|
||||||
this.abc = list.get(listIndex).abc;
|
if (index == -1) {
|
||||||
classTree.setABC(abc);
|
classTree.setDoABCTags(list);
|
||||||
decompiledTextArea.setABC(abc);
|
} else {
|
||||||
navigator.setABC(abc);
|
List<DoABCTag> oneList = new ArrayList<DoABCTag>();
|
||||||
|
oneList.add(list.get(index));
|
||||||
|
this.abc=list.get(index).abc;
|
||||||
|
classTree.setDoABCTags(oneList);
|
||||||
|
}
|
||||||
|
//decompiledTextArea.setABC(abc);
|
||||||
|
//navigator.setABC(abc);
|
||||||
//constantTypeList = new JComboBox(new String[]{"UINT", "INT", "DOUBLE", "STRING", "NAMESPACE", "NAMESPACESET", "MULTINAME"});
|
//constantTypeList = new JComboBox(new String[]{"UINT", "INT", "DOUBLE", "STRING", "NAMESPACE", "NAMESPACESET", "MULTINAME"});
|
||||||
updateConstList();
|
updateConstList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainFrame(List<DoABCTag> list) {
|
public MainFrame(List<DoABCTag> list) {
|
||||||
@@ -195,7 +208,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
pan2.add((abcComboBox = new JComboBox(new ABCComboBoxModel(list))), BorderLayout.NORTH);
|
pan2.add((abcComboBox = new JComboBox(new ABCComboBoxModel(list))), BorderLayout.NORTH);
|
||||||
|
|
||||||
navigator = new TraitsList();
|
navigator = new TraitsList();
|
||||||
navigator.setABC(abc);
|
navigator.setABC(list,abc);
|
||||||
|
|
||||||
|
|
||||||
JPanel navPanel = new JPanel(new BorderLayout());
|
JPanel navPanel = new JPanel(new BorderLayout());
|
||||||
@@ -206,7 +219,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
navPanel.add(new JScrollPane(navigator), BorderLayout.CENTER);
|
navPanel.add(new JScrollPane(navigator), BorderLayout.CENTER);
|
||||||
|
|
||||||
splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
||||||
new JScrollPane(classTree = new ClassesListTree(abc)),
|
new JScrollPane(classTree = new ClassesListTree(list)),
|
||||||
navPanel);
|
navPanel);
|
||||||
|
|
||||||
JTabbedPane tabbedPane = new JTabbedPane();
|
JTabbedPane tabbedPane = new JTabbedPane();
|
||||||
@@ -332,6 +345,9 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
constantTable = new JTable();
|
constantTable = new JTable();
|
||||||
autoResizeColWidth(constantTable, new UIntTableModel(abc));
|
autoResizeColWidth(constantTable, new UIntTableModel(abc));
|
||||||
constantTable.setAutoCreateRowSorter(true);
|
constantTable.setAutoCreateRowSorter(true);
|
||||||
|
|
||||||
|
final List<DoABCTag> inlist=list;
|
||||||
|
|
||||||
constantTable.addMouseListener(new MouseAdapter() {
|
constantTable.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
@@ -343,7 +359,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
}
|
}
|
||||||
int multinameIndex = constantTable.convertRowIndexToModel(rowIndex);
|
int multinameIndex = constantTable.convertRowIndexToModel(rowIndex);
|
||||||
if (multinameIndex > 0) {
|
if (multinameIndex > 0) {
|
||||||
UsageFrame usageFrame = new UsageFrame(abc, multinameIndex);
|
UsageFrame usageFrame = new UsageFrame(inlist,abc, multinameIndex);
|
||||||
usageFrame.setVisible(true);
|
usageFrame.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,7 +468,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reload() {
|
public void reload() {
|
||||||
switchAbc(listIndex);
|
switchAbc(listIndex-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void itemStateChanged(ItemEvent e) {
|
public void itemStateChanged(ItemEvent e) {
|
||||||
@@ -461,7 +477,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
|
|||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switchAbc(index);
|
switchAbc(index-1);
|
||||||
}
|
}
|
||||||
if (e.getSource() == constantTypeList) {
|
if (e.getSource() == constantTypeList) {
|
||||||
int index = ((JComboBox) e.getSource()).getSelectedIndex();
|
int index = ((JComboBox) e.getSource()).getSelectedIndex();
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.gui;
|
|||||||
|
|
||||||
import com.jpexs.asdec.Main;
|
import com.jpexs.asdec.Main;
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
import javax.swing.JList;
|
import javax.swing.JList;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
@@ -26,6 +28,7 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
public class TraitsList extends JList implements ListSelectionListener {
|
public class TraitsList extends JList implements ListSelectionListener {
|
||||||
|
|
||||||
ABC abc;
|
ABC abc;
|
||||||
|
List<DoABCTag> abcTags;
|
||||||
int classIndex = -1;
|
int classIndex = -1;
|
||||||
|
|
||||||
public int getClassIndex() {
|
public int getClassIndex() {
|
||||||
@@ -37,8 +40,9 @@ public class TraitsList extends JList implements ListSelectionListener {
|
|||||||
setCellRenderer(new IconListRenderer());
|
setCellRenderer(new IconListRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setABC(ABC abc) {
|
public void setABC(List<DoABCTag> abcTags,ABC abc) {
|
||||||
this.abc = abc;
|
this.abc = abc;
|
||||||
|
this.abcTags=abcTags;
|
||||||
setModel(new DefaultListModel());
|
setModel(new DefaultListModel());
|
||||||
setClassIndex(-1);
|
setClassIndex(-1);
|
||||||
}
|
}
|
||||||
@@ -49,7 +53,7 @@ public class TraitsList extends JList implements ListSelectionListener {
|
|||||||
setModel(new DefaultListModel());
|
setModel(new DefaultListModel());
|
||||||
} else {
|
} else {
|
||||||
if (abc != null) {
|
if (abc != null) {
|
||||||
setModel(new TraitsListModel(abc, classIndex));
|
setModel(new TraitsListModel(abcTags,abc, classIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.gui;
|
package com.jpexs.asdec.abc.gui;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.ListModel;
|
import javax.swing.ListModel;
|
||||||
import javax.swing.event.ListDataListener;
|
import javax.swing.event.ListDataListener;
|
||||||
|
|
||||||
@@ -26,9 +28,11 @@ public class TraitsListModel implements ListModel {
|
|||||||
int classIndex;
|
int classIndex;
|
||||||
public static final String STR_INSTANCE_INITIALIZER = "instance initializer";
|
public static final String STR_INSTANCE_INITIALIZER = "instance initializer";
|
||||||
public static final String STR_CLASS_INITIALIZER = "class initializer";
|
public static final String STR_CLASS_INITIALIZER = "class initializer";
|
||||||
|
private List<DoABCTag> abcTags;
|
||||||
|
|
||||||
public TraitsListModel(ABC abc, int classIndex) {
|
public TraitsListModel(List<DoABCTag> abcTags,ABC abc, int classIndex) {
|
||||||
this.abc = abc;
|
this.abc = abc;
|
||||||
|
this.abcTags=abcTags;
|
||||||
this.classIndex = classIndex;
|
this.classIndex = classIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,9 +45,9 @@ public class TraitsListModel implements ListModel {
|
|||||||
|
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
if (index < abc.class_info[classIndex].static_traits.traits.length) {
|
if (index < abc.class_info[classIndex].static_traits.traits.length) {
|
||||||
return abc.class_info[classIndex].static_traits.traits[index].convertHeader(abc, true, false, classIndex, false);
|
return abc.class_info[classIndex].static_traits.traits[index].convertHeader(abcTags,abc, true, false, classIndex, false);
|
||||||
} else if (index < abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) {
|
} else if (index < abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) {
|
||||||
return abc.instance_info[classIndex].instance_traits.traits[index - abc.class_info[classIndex].static_traits.traits.length].convertHeader(abc, false, false, classIndex, false);
|
return abc.instance_info[classIndex].instance_traits.traits[index - abc.class_info[classIndex].static_traits.traits.length].convertHeader(abcTags,abc, false, false, classIndex, false);
|
||||||
} else if (index == abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) {
|
} else if (index == abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) {
|
||||||
return STR_INSTANCE_INITIALIZER;
|
return STR_INSTANCE_INITIALIZER;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+10
-4
@@ -16,15 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
package com.jpexs.asdec.abc.gui;
|
package com.jpexs.asdec.abc.gui;
|
||||||
|
|
||||||
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author JPEXS
|
* @author JPEXS
|
||||||
*/
|
*/
|
||||||
public class TreeLeafClass {
|
public class TreeLeafScript {
|
||||||
|
|
||||||
public int classIndex;
|
public ABC abc;
|
||||||
|
public int scriptIndex;
|
||||||
|
|
||||||
public TreeLeafClass(int classIndex) {
|
public TreeLeafScript(ABC abc, int scriptIndex) {
|
||||||
this.classIndex = classIndex;
|
this.abc = abc;
|
||||||
|
this.scriptIndex = scriptIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012 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.asdec.abc.gui;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author JPEXS
|
|
||||||
*/
|
|
||||||
public class TreeLeafString {
|
|
||||||
|
|
||||||
public String str;
|
|
||||||
|
|
||||||
public TreeLeafString(String str) {
|
|
||||||
this.str = str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,6 +23,7 @@ import com.jpexs.asdec.abc.usages.MethodMultinameUsage;
|
|||||||
import com.jpexs.asdec.abc.usages.MultinameUsage;
|
import com.jpexs.asdec.abc.usages.MultinameUsage;
|
||||||
import com.jpexs.asdec.abc.usages.TraitMultinameUsage;
|
import com.jpexs.asdec.abc.usages.TraitMultinameUsage;
|
||||||
import com.jpexs.asdec.gui.View;
|
import com.jpexs.asdec.gui.View;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
@@ -45,10 +46,10 @@ public class UsageFrame extends JFrame implements ActionListener, MouseListener
|
|||||||
private UsageListModel usageListModel;
|
private UsageListModel usageListModel;
|
||||||
private ABC abc;
|
private ABC abc;
|
||||||
|
|
||||||
public UsageFrame(ABC abc, int multinameIndex) {
|
public UsageFrame(List<DoABCTag> abcTags,ABC abc, int multinameIndex) {
|
||||||
List<MultinameUsage> usages = abc.findMultinameUsage(multinameIndex);
|
List<MultinameUsage> usages = abc.findMultinameUsage(multinameIndex);
|
||||||
this.abc = abc;
|
this.abc = abc;
|
||||||
usageListModel = new UsageListModel(abc);
|
usageListModel = new UsageListModel(abcTags,abc);
|
||||||
for (MultinameUsage u : usages) {
|
for (MultinameUsage u : usages) {
|
||||||
usageListModel.addElement(u);
|
usageListModel.addElement(u);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.gui;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.usages.MultinameUsage;
|
import com.jpexs.asdec.abc.usages.MultinameUsage;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,19 +29,21 @@ import javax.swing.DefaultListModel;
|
|||||||
public class UsageListModel extends DefaultListModel {
|
public class UsageListModel extends DefaultListModel {
|
||||||
|
|
||||||
private ABC abc;
|
private ABC abc;
|
||||||
|
private List<DoABCTag> abcTags;
|
||||||
|
|
||||||
public UsageListModel(ABC abc) {
|
public UsageListModel(List<DoABCTag> abcTags,ABC abc) {
|
||||||
this.abc = abc;
|
this.abc = abc;
|
||||||
|
this.abcTags=abcTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object get(int index) {
|
public Object get(int index) {
|
||||||
return ((MultinameUsage) super.get(index)).toString(abc);
|
return ((MultinameUsage) super.get(index)).toString(abcTags,abc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElementAt(int index) {
|
public Object getElementAt(int index) {
|
||||||
return ((MultinameUsage) super.getElementAt(index)).toString(abc);
|
return ((MultinameUsage) super.getElementAt(index)).toString(abcTags,abc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultinameUsage getUsage(int index) {
|
public MultinameUsage getUsage(int index) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class InstanceInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isFinal()) {
|
if (isFinal()) {
|
||||||
modifiers = "final ";
|
modifiers += "final ";
|
||||||
}
|
}
|
||||||
if (isDynamic()) {
|
if (isDynamic()) {
|
||||||
modifiers = modifiers + "dynamic ";
|
modifiers = modifiers + "dynamic ";
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package com.jpexs.asdec.abc.types;
|
|||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Trait;
|
import com.jpexs.asdec.abc.types.traits.Trait;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ScriptInfo {
|
public class ScriptInfo {
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@ public class ScriptInfo {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convert(ABC abc, boolean pcode, boolean highlighting) {
|
public String convert(List<DoABCTag> abcTags,ABC abc, boolean pcode, boolean highlighting) {
|
||||||
return traits.convert(abc, false, pcode, true, -1, highlighting);
|
return traits.convert(abcTags,abc, false, pcode, true, -1, highlighting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.jpexs.asdec.abc.ABC;
|
|||||||
import com.jpexs.asdec.abc.types.Multiname;
|
import com.jpexs.asdec.abc.types.Multiname;
|
||||||
import com.jpexs.asdec.abc.types.Namespace;
|
import com.jpexs.asdec.abc.types.Namespace;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class Trait {
|
public abstract class Trait {
|
||||||
|
|
||||||
@@ -40,18 +42,47 @@ public abstract class Trait {
|
|||||||
public static final int TRAIT_FUNCTION = 5;
|
public static final int TRAIT_FUNCTION = 5;
|
||||||
public static final int TRAIT_CONST = 6;
|
public static final int TRAIT_CONST = 6;
|
||||||
|
|
||||||
public String getModifiers(ABC abc, boolean isStatic) {
|
public String getModifiers(List<DoABCTag> abcTags, ABC abc, boolean isStatic) {
|
||||||
String ret = "";
|
String ret = "";
|
||||||
if ((kindFlags & ATTR_Override) > 0) {
|
if ((kindFlags & ATTR_Override) > 0) {
|
||||||
ret += "override";
|
ret += "override";
|
||||||
}
|
}
|
||||||
Multiname m = getName(abc);
|
Multiname m = getName(abc);
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
int v = abc.nsValueToName(m.namespace_index);
|
String nsname = "";
|
||||||
if (v > -1) {
|
if (abc.constants.constant_namespace[m.namespace_index].kind == Namespace.KIND_NAMESPACE) {
|
||||||
ret += " " + abc.constants.constant_multiname[v].getName(abc.constants);
|
for (DoABCTag abcTag : abcTags) {
|
||||||
|
nsname = abcTag.abc.nsValueToName(abc.constants.constant_namespace[m.namespace_index].getName(abc.constants));
|
||||||
|
if (nsname.equals("-")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (nsname.contains(".")) {
|
||||||
|
nsname = nsname.substring(nsname.lastIndexOf(".") + 1);
|
||||||
|
}
|
||||||
|
if (!nsname.equals("")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Namespace ns = m.getNamespace(abc.constants);
|
Namespace ns = m.getNamespace(abc.constants);
|
||||||
|
|
||||||
|
if (nsname.contains(":")) {
|
||||||
|
nsname = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((!nsname.equals("")) && (!nsname.equals("-"))) {
|
||||||
|
} else {
|
||||||
|
if (ns != null) {
|
||||||
|
if (ns.kind == Namespace.KIND_NAMESPACE) {
|
||||||
|
nsname = ns.getName(abc.constants);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nsname.contains(":")) {
|
||||||
|
ret += " " + nsname;
|
||||||
|
}
|
||||||
if (ns != null) {
|
if (ns != null) {
|
||||||
ret += " " + ns.getPrefix(abc);
|
ret += " " + ns.getPrefix(abc);
|
||||||
}
|
}
|
||||||
@@ -76,16 +107,16 @@ public abstract class Trait {
|
|||||||
return abc.constants.constant_multiname[name_index].toString(abc.constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata);
|
return abc.constants.constant_multiname[name_index].toString(abc.constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convert(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convert(List<DoABCTag> abcTags, ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
return abc.constants.constant_multiname[name_index].toString(abc.constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata);
|
return abc.constants.constant_multiname[name_index].toString(abc.constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertPackaged(ABC abc, boolean isStatic, boolean pcod, int classIndex, boolean highlight) {
|
public String convertPackaged(List<DoABCTag> abcTags, ABC abc, boolean isStatic, boolean pcod, int classIndex, boolean highlight) {
|
||||||
return makePackageFromIndex(abc, name_index, convert(abc, isStatic, pcod, classIndex, highlight));
|
return makePackageFromIndex(abc, name_index, convert(abcTags, abc, isStatic, pcod, classIndex, highlight));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertHeader(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convertHeader(List<DoABCTag> abcTags, ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
return convert(abc, isStatic, pcode, classIndex, highlight).trim();
|
return convert(abcTags, abc, isStatic, pcode, classIndex, highlight).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String makePackageFromIndex(ABC abc, int name_index, String value) {
|
protected String makePackageFromIndex(ABC abc, int name_index, String value) {
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ import com.jpexs.asdec.abc.avm2.instructions.construction.NewFunctionIns;
|
|||||||
import com.jpexs.asdec.abc.avm2.treemodel.InitPropertyTreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.InitPropertyTreeItem;
|
||||||
import com.jpexs.asdec.abc.avm2.treemodel.SetPropertyTreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.SetPropertyTreeItem;
|
||||||
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
||||||
|
import com.jpexs.asdec.abc.types.ABCException;
|
||||||
import com.jpexs.asdec.abc.types.MethodBody;
|
import com.jpexs.asdec.abc.types.MethodBody;
|
||||||
import com.jpexs.asdec.abc.types.Multiname;
|
import com.jpexs.asdec.abc.types.Multiname;
|
||||||
import com.jpexs.asdec.abc.types.Namespace;
|
import com.jpexs.asdec.abc.types.Namespace;
|
||||||
import com.jpexs.asdec.abc.types.NamespaceSet;
|
import com.jpexs.asdec.abc.types.NamespaceSet;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
import com.jpexs.asdec.helpers.Highlighting;
|
import com.jpexs.asdec.helpers.Highlighting;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -46,14 +48,48 @@ public class TraitClass extends Trait {
|
|||||||
return "Class " + abc.constants.constant_multiname[name_index].toString(abc.constants) + " slot=" + slot_id + " class_info=" + class_info + " metadata=" + Helper.intArrToString(metadata);
|
return "Class " + abc.constants.constant_multiname[name_index].toString(abc.constants) + " slot=" + slot_id + " class_info=" + class_info + " metadata=" + Helper.intArrToString(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseImportFromNS(ABC abc, List imports, Namespace ns, String ignorePackage, String name) {
|
private void parseImportFromNS(List<DoABCTag> abcTags, ABC abc, List imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
|
||||||
|
Namespace ns = abc.constants.constant_namespace[namespace_index];
|
||||||
if (name.equals("")) {
|
if (name.equals("")) {
|
||||||
name = "*";
|
name = "*";
|
||||||
}
|
}
|
||||||
if (ns.kind != Namespace.KIND_PACKAGE) {
|
String newimport = ns.getName(abc.constants);
|
||||||
|
if (ns.kind == Namespace.KIND_NAMESPACE) {
|
||||||
|
String oldimport = newimport;
|
||||||
|
newimport = null;
|
||||||
|
for (DoABCTag abcTag : abcTags) {
|
||||||
|
String newname = abcTag.abc.nsValueToName(oldimport);
|
||||||
|
if (newname.equals("-")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!newname.equals("")) {
|
||||||
|
newimport = newname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newimport != null) {
|
||||||
|
if (!imports.contains(newimport)) {
|
||||||
|
if (newimport.contains(":")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String pkg = "";
|
||||||
|
if (newimport.contains(".")) {
|
||||||
|
pkg = newimport.substring(0, newimport.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
String usname=newimport;
|
||||||
|
if(usname.contains(".")){
|
||||||
|
usname=usname.substring(usname.lastIndexOf(".")+1);
|
||||||
|
}
|
||||||
|
if (!pkg.equals(ignorePackage)) {
|
||||||
|
imports.add(newimport);
|
||||||
|
}
|
||||||
|
uses.add(usname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (ns.kind != Namespace.KIND_PACKAGE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String newimport = ns.getName(abc.constants);
|
|
||||||
if (newimport.equals("-")) {
|
if (newimport.equals("-")) {
|
||||||
newimport = "";
|
newimport = "";
|
||||||
}
|
}
|
||||||
@@ -71,50 +107,65 @@ public class TraitClass extends Trait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseImportFromMultiname(ABC abc, List imports, Multiname m, String ignorePackage) {
|
private void parseImportFromMultiname(List<DoABCTag> abcTags, ABC abc, List<String> imports, List<String> uses, Multiname m, String ignorePackage) {
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
Namespace ns = m.getNamespace(abc.constants);
|
Namespace ns = m.getNamespace(abc.constants);
|
||||||
String name = m.getName(abc.constants);
|
String name = m.getName(abc.constants);
|
||||||
NamespaceSet nss = m.getNamespaceSet(abc.constants);
|
NamespaceSet nss = m.getNamespaceSet(abc.constants);
|
||||||
if (ns != null) {
|
if (ns != null) {
|
||||||
parseImportFromNS(abc, imports, ns, ignorePackage, name);
|
parseImportFromNS(abcTags, abc, imports,uses, m.namespace_index, ignorePackage, name);
|
||||||
}
|
}
|
||||||
if (nss != null) {
|
if (nss != null) {
|
||||||
for (int ni : nss.namespaces) {
|
for (int ni : nss.namespaces) {
|
||||||
parseImportFromNS(abc, imports, abc.constants.constant_namespace[ni], ignorePackage, name);
|
parseImportFromNS(abcTags, abc, imports,uses, ni, ignorePackage, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseImportsFromMethodInfo(ABC abc, int method_index, List imports, String ignorePackage) {
|
private void parseImportsFromMethodInfo(List<DoABCTag> abcTags, ABC abc, int method_index, List<String> imports, List<String> uses, String ignorePackage) {
|
||||||
if (abc.method_info[method_index].ret_type != 0) {
|
if (abc.method_info[method_index].ret_type != 0) {
|
||||||
parseImportFromMultiname(abc, imports, abc.constants.constant_multiname[abc.method_info[method_index].ret_type], ignorePackage);
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[abc.method_info[method_index].ret_type], ignorePackage);
|
||||||
}
|
}
|
||||||
for (int t : abc.method_info[method_index].param_types) {
|
for (int t : abc.method_info[method_index].param_types) {
|
||||||
if (t != 0) {
|
if (t != 0) {
|
||||||
parseImportFromMultiname(abc, imports, abc.constants.constant_multiname[t], ignorePackage);
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[t], ignorePackage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MethodBody body = abc.findBody(method_index);
|
MethodBody body = abc.findBody(method_index);
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
|
for (ABCException ex : body.exceptions) {
|
||||||
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[ex.type_index], ignorePackage);
|
||||||
|
}
|
||||||
for (AVM2Instruction ins : body.code.code) {
|
for (AVM2Instruction ins : body.code.code) {
|
||||||
if (ins.definition instanceof NewFunctionIns) {
|
if (ins.definition instanceof NewFunctionIns) {
|
||||||
parseImportsFromMethodInfo(abc, ins.operands[0], imports, ignorePackage);
|
parseImportsFromMethodInfo(abcTags, abc, ins.operands[0], imports,uses, ignorePackage);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < ins.definition.operands.length; k++) {
|
for (int k = 0; k < ins.definition.operands.length; k++) {
|
||||||
if (ins.definition.operands[k] == AVM2Code.DAT_MULTINAME_INDEX) {
|
if (ins.definition.operands[k] == AVM2Code.DAT_MULTINAME_INDEX) {
|
||||||
int multinameIndex = ins.operands[k];
|
int multinameIndex = ins.operands[k];
|
||||||
parseImportFromMultiname(abc, imports, abc.constants.constant_multiname[multinameIndex], ignorePackage);
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[multinameIndex], ignorePackage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getImports(ABC abc) {
|
private void parseImportsFromTrait(List<DoABCTag> abcTags, ABC abc, Trait t, List<String> imports, List<String> uses, String ignorePackage) {
|
||||||
List<String> imports = new ArrayList<String>();
|
if (t instanceof TraitMethodGetterSetter) {
|
||||||
|
TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t;
|
||||||
|
if (tm.method_info != 0) {
|
||||||
|
parseImportsFromMethodInfo(abcTags, abc, tm.method_info, imports,uses, ignorePackage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parseImportFromMultiname(abcTags, abc, imports,uses, t.getName(abc), ignorePackage);
|
||||||
|
if (t instanceof TraitSlotConst) {
|
||||||
|
TraitSlotConst ts = (TraitSlotConst) t;
|
||||||
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[ts.type_index], ignorePackage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List getImports(List<DoABCTag> abcTags, ABC abc,List<String> imports,List<String> uses) {
|
||||||
//constructor
|
//constructor
|
||||||
|
|
||||||
//parseImportFromMultiname(imports, constants.constant_multiname[instance_info[instanceIndex].name_index]);
|
//parseImportFromMultiname(imports, constants.constant_multiname[instance_info[instanceIndex].name_index]);
|
||||||
@@ -122,45 +173,32 @@ public class TraitClass extends Trait {
|
|||||||
String packageName = abc.instance_info[class_info].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants);
|
String packageName = abc.instance_info[class_info].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants);
|
||||||
|
|
||||||
if (abc.instance_info[class_info].super_index > 0) {
|
if (abc.instance_info[class_info].super_index > 0) {
|
||||||
parseImportFromMultiname(abc, imports, abc.constants.constant_multiname[abc.instance_info[class_info].super_index], packageName);
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[abc.instance_info[class_info].super_index], packageName);
|
||||||
}
|
}
|
||||||
for (int i : abc.instance_info[class_info].interfaces) {
|
for (int i : abc.instance_info[class_info].interfaces) {
|
||||||
parseImportFromMultiname(abc, imports, abc.constants.constant_multiname[i], packageName);
|
parseImportFromMultiname(abcTags, abc, imports,uses, abc.constants.constant_multiname[i], packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
for (Trait t : abc.class_info[class_info].static_traits.traits) {
|
for (Trait t : abc.class_info[class_info].static_traits.traits) {
|
||||||
//parseImportFromMultiname(imports, t.getMultiName(constants));
|
parseImportsFromTrait(abcTags, abc, t, imports, uses, packageName);
|
||||||
if (t instanceof TraitMethodGetterSetter) {
|
|
||||||
TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t;
|
|
||||||
if (tm.method_info != 0) {
|
|
||||||
parseImportsFromMethodInfo(abc, tm.method_info, imports, packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static initializer
|
//static initializer
|
||||||
parseImportsFromMethodInfo(abc, abc.class_info[class_info].cinit_index, imports, packageName);
|
parseImportsFromMethodInfo(abcTags, abc, abc.class_info[class_info].cinit_index, imports, uses, packageName);
|
||||||
|
|
||||||
//instance
|
//instance
|
||||||
for (Trait t : abc.instance_info[class_info].instance_traits.traits) {
|
for (Trait t : abc.instance_info[class_info].instance_traits.traits) {
|
||||||
//parseImportFromMultiname(imports, t.getMultiName(constants));
|
parseImportsFromTrait(abcTags, abc, t, imports, uses, packageName);
|
||||||
if (t instanceof TraitMethodGetterSetter) {
|
|
||||||
TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t;
|
|
||||||
if (tm.method_info != 0) {
|
|
||||||
parseImportsFromMethodInfo(abc, tm.method_info, imports, packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//instance initializer
|
//instance initializer
|
||||||
parseImportsFromMethodInfo(abc, abc.instance_info[class_info].iinit_index, imports, packageName);
|
parseImportsFromMethodInfo(abcTags, abc, abc.instance_info[class_info].iinit_index, imports, uses, packageName);
|
||||||
return imports;
|
return imports;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convert(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convert(List<DoABCTag> abcTags, ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
if (!highlight) {
|
if (!highlight) {
|
||||||
Highlighting.doHighlight = false;
|
Highlighting.doHighlight = false;
|
||||||
}
|
}
|
||||||
@@ -168,12 +206,18 @@ public class TraitClass extends Trait {
|
|||||||
PrintStream out = new PrintStream(baos);
|
PrintStream out = new PrintStream(baos);
|
||||||
|
|
||||||
//imports
|
//imports
|
||||||
List<String> imports = getImports(abc);
|
List<String> imports = new ArrayList<String>();
|
||||||
|
List<String> uses = new ArrayList<String>();
|
||||||
|
getImports(abcTags, abc,imports,uses);
|
||||||
for (String imp : imports) {
|
for (String imp : imports) {
|
||||||
out.println(ABC.IDENT_STRING + "import " + imp + ";");
|
out.println(ABC.IDENT_STRING + "import " + imp + ";");
|
||||||
}
|
}
|
||||||
out.println();
|
out.println();
|
||||||
|
for (String us : uses) {
|
||||||
|
out.println(ABC.IDENT_STRING + "use namespace " + us + ";");
|
||||||
|
}
|
||||||
|
out.println();
|
||||||
|
|
||||||
//class header
|
//class header
|
||||||
String classHeader = abc.instance_info[class_info].getClassHeaderStr(abc);
|
String classHeader = abc.instance_info[class_info].getClassHeaderStr(abc);
|
||||||
if (classHeader.startsWith("private ")) {
|
if (classHeader.startsWith("private ")) {
|
||||||
@@ -266,9 +310,9 @@ public class TraitClass extends Trait {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
//static variables,constants & methods
|
//static variables,constants & methods
|
||||||
outTraits.add(abc.class_info[class_info].static_traits.convert(abc, true, pcode, false, class_info, highlight));
|
outTraits.add(abc.class_info[class_info].static_traits.convert(abcTags, abc, true, pcode, false, class_info, highlight));
|
||||||
|
|
||||||
outTraits.add(abc.instance_info[class_info].instance_traits.convert(abc, false, pcode, false, class_info, highlight));
|
outTraits.add(abc.instance_info[class_info].instance_traits.convert(abcTags, abc, false, pcode, false, class_info, highlight));
|
||||||
|
|
||||||
out.println(Helper.joinStrings(outTraits, "\r\n\r\n"));
|
out.println(Helper.joinStrings(outTraits, "\r\n\r\n"));
|
||||||
out.println(ABC.IDENT_STRING + "}");//class
|
out.println(ABC.IDENT_STRING + "}");//class
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.jpexs.asdec.abc.ABC;
|
|||||||
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
||||||
import com.jpexs.asdec.abc.types.MethodBody;
|
import com.jpexs.asdec.abc.types.MethodBody;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
public class TraitFunction extends Trait {
|
public class TraitFunction extends Trait {
|
||||||
@@ -33,8 +35,8 @@ public class TraitFunction extends Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertHeader(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convertHeader(List<DoABCTag> abcTags,ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
String modifier = getModifiers(abc, isStatic) + " ";
|
String modifier = getModifiers(abcTags,abc, isStatic) + " ";
|
||||||
if (modifier.equals(" ")) {
|
if (modifier.equals(" ")) {
|
||||||
modifier = "";
|
modifier = "";
|
||||||
}
|
}
|
||||||
@@ -43,8 +45,8 @@ public class TraitFunction extends Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convert(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convert(List<DoABCTag> abcTags,ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
String header = convertHeader(abc, isStatic, pcode, classIndex, highlight);
|
String header = convertHeader(abcTags,abc, isStatic, pcode, classIndex, highlight);
|
||||||
String bodyStr = "";
|
String bodyStr = "";
|
||||||
int bodyIndex = abc.findBodyIndex(method_info);
|
int bodyIndex = abc.findBodyIndex(method_info);
|
||||||
if (bodyIndex != -1) {
|
if (bodyIndex != -1) {
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.jpexs.asdec.abc.ABC;
|
|||||||
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
||||||
import com.jpexs.asdec.abc.types.MethodBody;
|
import com.jpexs.asdec.abc.types.MethodBody;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
public class TraitMethodGetterSetter extends Trait {
|
public class TraitMethodGetterSetter extends Trait {
|
||||||
@@ -32,8 +34,9 @@ public class TraitMethodGetterSetter extends Trait {
|
|||||||
return "0x" + Helper.formatAddress(fileOffset) + " " + Helper.byteArrToString(bytes) + " MethodGetterSetter " + abc.constants.constant_multiname[name_index].toString(abc.constants) + " disp_id=" + disp_id + " method_info=" + method_info + " metadata=" + Helper.intArrToString(metadata);
|
return "0x" + Helper.formatAddress(fileOffset) + " " + Helper.byteArrToString(bytes) + " MethodGetterSetter " + abc.constants.constant_multiname[name_index].toString(abc.constants) + " disp_id=" + disp_id + " method_info=" + method_info + " metadata=" + Helper.intArrToString(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertHeader(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
@Override
|
||||||
String modifier = getModifiers(abc, isStatic) + " ";
|
public String convertHeader(List<DoABCTag> abcTags,ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
|
String modifier = getModifiers(abcTags,abc, isStatic) + " ";
|
||||||
if (modifier.equals(" ")) {
|
if (modifier.equals(" ")) {
|
||||||
modifier = "";
|
modifier = "";
|
||||||
}
|
}
|
||||||
@@ -50,8 +53,8 @@ public class TraitMethodGetterSetter extends Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convert(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convert(List<DoABCTag> abcTags,ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
String header = convertHeader(abc, isStatic, pcode, classIndex, highlight);
|
String header = convertHeader(abcTags,abc, isStatic, pcode, classIndex, highlight);
|
||||||
|
|
||||||
String bodyStr = "";
|
String bodyStr = "";
|
||||||
int bodyIndex = abc.findBodyIndex(method_info);
|
int bodyIndex = abc.findBodyIndex(method_info);
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
|||||||
import com.jpexs.asdec.abc.types.ValueKind;
|
import com.jpexs.asdec.abc.types.ValueKind;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
import com.jpexs.asdec.helpers.Highlighting;
|
import com.jpexs.asdec.helpers.Highlighting;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class TraitSlotConst extends Trait {
|
public class TraitSlotConst extends Trait {
|
||||||
|
|
||||||
@@ -77,9 +79,17 @@ public class TraitSlotConst extends Trait {
|
|||||||
return slotconst + " " + getName(abc).getName(abc.constants) + typeStr + valueStr + ";";
|
return slotconst + " " + getName(abc).getName(abc.constants) + typeStr + valueStr + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNamespace(){
|
||||||
|
if (value_kind != 0) {
|
||||||
|
ValueKind val = new ValueKind(value_index, value_kind);
|
||||||
|
return val.isNamespace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convert(ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
public String convert(List<DoABCTag> abcTags,ABC abc, boolean isStatic, boolean pcode, int classIndex, boolean highlight) {
|
||||||
String modifier = getModifiers(abc, isStatic) + " ";
|
String modifier = getModifiers(abcTags,abc, isStatic) + " ";
|
||||||
if (modifier.equals(" ")) {
|
if (modifier.equals(" ")) {
|
||||||
modifier = "";
|
modifier = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.types.traits;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.helpers.Highlighting;
|
import com.jpexs.asdec.helpers.Highlighting;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Traits {
|
public class Traits {
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public class Traits {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convert(ABC abc, boolean isStatic, boolean pcode, boolean makePackages, int classIndex, boolean highlighting) {
|
public String convert(List<DoABCTag> abcTags,ABC abc, boolean isStatic, boolean pcode, boolean makePackages, int classIndex, boolean highlighting) {
|
||||||
String s = "";
|
String s = "";
|
||||||
for (int t = 0; t < traits.length; t++) {
|
for (int t = 0; t < traits.length; t++) {
|
||||||
if (t > 0) {
|
if (t > 0) {
|
||||||
@@ -54,9 +56,9 @@ public class Traits {
|
|||||||
}
|
}
|
||||||
String plus;
|
String plus;
|
||||||
if (makePackages) {
|
if (makePackages) {
|
||||||
plus = traits[t].convertPackaged(abc, isStatic, pcode, classIndex, highlighting);
|
plus = traits[t].convertPackaged(abcTags,abc, isStatic, pcode, classIndex, highlighting);
|
||||||
} else {
|
} else {
|
||||||
plus = traits[t].convert(abc, isStatic, pcode, classIndex, highlighting);
|
plus = traits[t].convert(abcTags,abc, isStatic, pcode, classIndex, highlighting);
|
||||||
}
|
}
|
||||||
if (highlighting) {
|
if (highlighting) {
|
||||||
int h = t;
|
int h = t;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.usages;
|
package com.jpexs.asdec.abc.usages;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -29,7 +31,7 @@ public class ClassNameMultinameUsage extends InsideClassMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return "class " + abc.constants.constant_multiname[abc.instance_info[classIndex].name_index].getNameWithNamespace(abc.constants);
|
return "class " + abc.constants.constant_multiname[abc.instance_info[classIndex].name_index].getNameWithNamespace(abc.constants);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import com.jpexs.asdec.abc.ABC;
|
|||||||
import com.jpexs.asdec.abc.types.traits.TraitMethodGetterSetter;
|
import com.jpexs.asdec.abc.types.traits.TraitMethodGetterSetter;
|
||||||
import com.jpexs.asdec.abc.types.traits.TraitSlotConst;
|
import com.jpexs.asdec.abc.types.traits.TraitSlotConst;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -32,14 +34,14 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " "
|
return super.toString(abcTags,abc) + " "
|
||||||
+ (parentTraitIndex > -1
|
+ (parentTraitIndex > -1
|
||||||
? (isStatic
|
? (isStatic
|
||||||
? (((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(abc, isStatic, false, classIndex, false))
|
? (((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(abcTags,abc, isStatic, false, classIndex, false))
|
||||||
: (((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(abc, isStatic, false, classIndex, false)))
|
: (((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(abcTags,abc, isStatic, false, classIndex, false)))
|
||||||
: "")
|
: "")
|
||||||
+ ((TraitSlotConst) traits.traits[traitIndex]).convertHeader(abc, isStatic, false, classIndex, false);
|
+ ((TraitSlotConst) traits.traits[traitIndex]).convertHeader(abcTags,abc, isStatic, false, classIndex, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTraitIndex() {
|
public int getTraitIndex() {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +32,7 @@ public class ConstVarNameMultinameUsage extends ConstVarMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " name";
|
return super.toString(abcTags,abc) + " name";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +32,7 @@ public class ConstVarTypeMultinameUsage extends ConstVarMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " type";
|
return super.toString(abcTags,abc) + " type";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.usages;
|
package com.jpexs.asdec.abc.usages;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -29,7 +31,7 @@ public class ExtendsMultinameUsage extends InsideClassMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " extends";
|
return super.toString(abcTags,abc) + " extends";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.usages;
|
package com.jpexs.asdec.abc.usages;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -29,7 +31,7 @@ public class ImplementsMultinameUsage extends InsideClassMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " implements";
|
return super.toString(abcTags,abc) + " implements";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.usages;
|
package com.jpexs.asdec.abc.usages;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -32,7 +34,7 @@ public abstract class InsideClassMultinameUsage extends MultinameUsage {
|
|||||||
this.classIndex = classIndex;
|
this.classIndex = classIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return "class " + abc.constants.constant_multiname[abc.instance_info[classIndex].name_index].getNameWithNamespace(abc.constants);
|
return "class " + abc.constants.constant_multiname[abc.instance_info[classIndex].name_index].getNameWithNamespace(abc.constants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +32,7 @@ public class MethodBodyMultinameUsage extends MethodMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " body";
|
return super.toString(abcTags,abc) + " body";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.TraitMethodGetterSetter;
|
import com.jpexs.asdec.abc.types.traits.TraitMethodGetterSetter;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -38,17 +40,17 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " " + (isInitializer
|
return super.toString(abcTags,abc) + " " + (isInitializer
|
||||||
? (isStatic
|
? (isStatic
|
||||||
? "class initializer"
|
? "class initializer"
|
||||||
: "instance initializer")
|
: "instance initializer")
|
||||||
: ((parentTraitIndex > -1
|
: ((parentTraitIndex > -1
|
||||||
? (isStatic
|
? (isStatic
|
||||||
? (((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(abc, isStatic, false, classIndex, false))
|
? (((TraitMethodGetterSetter) abc.class_info[classIndex].static_traits.traits[parentTraitIndex]).convertHeader(abcTags,abc, isStatic, false, classIndex, false))
|
||||||
: (((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(abc, isStatic, false, classIndex, false))) + " "
|
: (((TraitMethodGetterSetter) abc.instance_info[classIndex].instance_traits.traits[parentTraitIndex]).convertHeader(abcTags,abc, isStatic, false, classIndex, false))) + " "
|
||||||
: "")
|
: "")
|
||||||
+ (((TraitMethodGetterSetter) traits.traits[traitIndex]).convertHeader(abc, isStatic, false, classIndex, false))));
|
+ (((TraitMethodGetterSetter) traits.traits[traitIndex]).convertHeader(abcTags,abc, isStatic, false, classIndex, false))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTraitIndex() {
|
public int getTraitIndex() {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +32,7 @@ public class MethodNameMultinameUsage extends MethodMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " name";
|
return super.toString(abcTags,abc) + " name";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +32,7 @@ public class MethodParamsMultinameUsage extends MethodMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " params";
|
return super.toString(abcTags,abc) + " params";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.jpexs.asdec.abc.usages;
|
|||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
import com.jpexs.asdec.abc.types.traits.Traits;
|
import com.jpexs.asdec.abc.types.traits.Traits;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +32,7 @@ public class MethodReturnTypeMultinameUsage extends MethodMultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return super.toString(abc) + " return type";
|
return super.toString(abcTags,abc) + " return type";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.usages;
|
package com.jpexs.asdec.abc.usages;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -24,5 +26,5 @@ import com.jpexs.asdec.abc.ABC;
|
|||||||
*/
|
*/
|
||||||
public abstract class MultinameUsage {
|
public abstract class MultinameUsage {
|
||||||
|
|
||||||
public abstract String toString(ABC abc);
|
public abstract String toString(List<DoABCTag> abcTags,ABC abc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
package com.jpexs.asdec.abc.usages;
|
package com.jpexs.asdec.abc.usages;
|
||||||
|
|
||||||
import com.jpexs.asdec.abc.ABC;
|
import com.jpexs.asdec.abc.ABC;
|
||||||
|
import com.jpexs.asdec.tags.DoABCTag;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -31,7 +33,7 @@ public class TypeNameMultinameUsage extends MultinameUsage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(ABC abc) {
|
public String toString(List<DoABCTag> abcTags,ABC abc) {
|
||||||
return "TypeName " + abc.constants.constant_multiname[typename_index].toString(abc.constants);
|
return "TypeName " + abc.constants.constant_multiname[typename_index].toString(abc.constants);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user