diff --git a/build_common.xml b/build_common.xml
index 065749bee..b3e28472f 100644
--- a/build_common.xml
+++ b/build_common.xml
@@ -325,6 +325,11 @@
+
+
+
+
+
@@ -386,7 +391,7 @@
-
+
diff --git a/lib/ffdec_lib.jar b/lib/ffdec_lib.jar
index a64b0677d..b24ec5e1e 100644
Binary files a/lib/ffdec_lib.jar and b/lib/ffdec_lib.jar differ
diff --git a/libsrc/ffdec_lib/build_common.xml b/libsrc/ffdec_lib/build_common.xml
index b43486160..00d673d0f 100644
--- a/libsrc/ffdec_lib/build_common.xml
+++ b/libsrc/ffdec_lib/build_common.xml
@@ -221,4 +221,8 @@
+
+
+
+
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java
index f7b1a87b2..f12e266c3 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc;
import com.jpexs.decompiler.flash.EventListener;
@@ -299,7 +300,7 @@ public class ABC {
int mIndex = body.code.code.get(ip).operands[0];
if (mIndex > 0) {
Multiname m = constants.getMultiname(mIndex);
- if (m.getNameWithNamespace(constants).equals("flash.utils.getDefinitionByName")) {
+ if (m.getNameWithNamespace(constants,true).equals("flash.utils.getDefinitionByName")) {
if (ip > 0) {
if (body.code.code.get(ip - 1).definition instanceof PushStringIns) {
int strIndex = body.code.code.get(ip - 1).operands[0];
@@ -693,11 +694,11 @@ public class ABC {
public MethodBody findBodyByClassAndName(String className, String methodName) {
for (int i = 0; i < instance_info.size(); i++) {
- if (className.equals(constants.getMultiname(instance_info.get(i).name_index).getName(constants, new ArrayList()))) {
+ if (className.equals(constants.getMultiname(instance_info.get(i).name_index).getName(constants, new ArrayList(),true))) {
for (Trait t : instance_info.get(i).instance_traits.traits) {
if (t instanceof TraitMethodGetterSetter) {
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
- if (methodName.equals(t2.getName(this).getName(constants, new ArrayList()))) {
+ if (methodName.equals(t2.getName(this).getName(constants, new ArrayList(),true))) {
for (MethodBody body : bodies) {
if (body.method_info == t2.method_info) {
return body;
@@ -710,11 +711,11 @@ public class ABC {
}
}
for (int i = 0; i < class_info.size(); i++) {
- if (className.equals(constants.getMultiname(instance_info.get(i).name_index).getName(constants, new ArrayList()))) {
+ if (className.equals(constants.getMultiname(instance_info.get(i).name_index).getName(constants, new ArrayList(),true))) {
for (Trait t : class_info.get(i).static_traits.traits) {
if (t instanceof TraitMethodGetterSetter) {
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
- if (methodName.equals(t2.getName(this).getName(constants, new ArrayList()))) {
+ if (methodName.equals(t2.getName(this).getName(constants, new ArrayList(),true))) {
for (MethodBody body : bodies) {
if (body.method_info == t2.method_info) {
return body;
@@ -793,7 +794,7 @@ public class ABC {
TraitSlotConst s = ((TraitSlotConst) t);
if (s.isNamespace()) {
String key = constants.getNamespace(s.value_index).getName(constants); //assume not null
- String val = constants.getMultiname(s.name_index).getNameWithNamespace(constants);
+ String val = constants.getMultiname(s.name_index).getNameWithNamespace(constants,true);
namespaceMap.put(key, val);
}
}
@@ -954,7 +955,7 @@ public class ABC {
if (classId > -1) {
for (Trait t : instance_info.get(classId).instance_traits.traits) {
if (t instanceof TraitMethodGetterSetter) {
- if (t.getName(this).getName(constants, new ArrayList()).equals(methodName)) {
+ if (t.getName(this).getName(constants, new ArrayList(),true).equals(methodName)) {
return ((TraitMethodGetterSetter) t).method_info;
}
}
@@ -967,7 +968,7 @@ public class ABC {
if (classId > -1) {
for (Trait t : instance_info.get(classId).instance_traits.traits) {
if (t instanceof TraitMethodGetterSetter) {
- if (t.getName(this).getName(constants, new ArrayList()).equals(methodName)) {
+ if (t.getName(this).getName(constants, new ArrayList(),true).equals(methodName)) {
return findBodyIndex(((TraitMethodGetterSetter) t).method_info);
}
}
@@ -983,7 +984,7 @@ public class ABC {
public int findClassByName(String name) {
for (int c = 0; c < instance_info.size(); c++) {
- String s = constants.getMultiname(instance_info.get(c).name_index).getNameWithNamespace(constants);
+ String s = constants.getMultiname(instance_info.get(c).name_index).getNameWithNamespace(constants,true);
if (name.equals(s)) {
return c;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
index 14baa2857..6729c6a99 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc;
import com.jpexs.decompiler.flash.SWF;
@@ -86,7 +87,7 @@ public class ScriptPack implements TreeElementItem {
Multiname name = abc.script_info.get(scriptIndex).traits.traits.get(t).getName(abc);
Namespace ns = name.getNamespace(abc.constants);
if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) {
- scriptName = name.getName(abc.constants, new ArrayList());
+ scriptName = name.getName(abc.constants, new ArrayList(),false);
}
}
return scriptName;
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
index 1a16a6ea6..f38fbfdf3 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -1464,7 +1465,7 @@ public class AVM2Code implements Serializable {
if (code.get(ip + plus + 2).definition instanceof SwapIns) {
if (code.get(ip + plus + 4).definition instanceof PopScopeIns) {
if (code.get(ip + plus + 3).definition instanceof SetPropertyIns) {
- functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(constants, fullyQualifiedNames);
+ functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(constants, fullyQualifiedNames,true);
scopeStack.pop();//with
output.remove(output.size() - 1); //with
ip = ip + plus + 4; //+1 below
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java
index f58e198ee..c73cf61fe 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/ConstantPool.java
@@ -12,16 +12,20 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
import com.jpexs.decompiler.flash.abc.types.NamespaceSet;
+import com.jpexs.decompiler.flash.action.Deobfuscation;
import com.jpexs.helpers.utf8.Utf8PrintWriter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class ConstantPool {
@@ -34,7 +38,7 @@ public class ConstantPool {
public List constant_namespace = new ArrayList<>();
public List constant_namespace_set = new ArrayList<>();
public List constant_multiname = new ArrayList<>();
-
+
public synchronized int addInt(long value) {
constant_int.add(value);
return constant_int.size() - 1;
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java
index 8ad08c3d1..9951e7b44 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -118,7 +119,7 @@ public class InstructionDefinition implements Serializable {
if (constants.getMultiname(multinameIndex).needsName()) {
name = stack.get(pos).toString();
} else {
- name = GraphTextWriter.hilighOffset(constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames), ins.offset);
+ name = GraphTextWriter.hilighOffset(constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames,false), ins.offset);
}
return name + ns;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java
index a9897d72e..5bf2913a7 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -95,7 +96,7 @@ public class ConstructIns extends InstructionDefinition {
}
if (obj instanceof GetLexAVM2Item) {
GetLexAVM2Item glt = (GetLexAVM2Item) obj;
- isXML = glt.propertyName.getName(constants, fullyQualifiedNames).equals("XML");
+ isXML = glt.propertyName.getName(constants, fullyQualifiedNames,true).equals("XML");
}
if (isXML) {
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java
index 8f5c6d548..25150567d 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.construction;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -44,7 +45,7 @@ public class NewClassIns extends InstructionDefinition {
HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
stack.pop().toString(writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
String baseType = writer.toString();
- stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(constants, fullyQualifiedNames) + ".class extends " + baseType));
+ stack.push(new UnparsedAVM2Item(ins, "new " + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(constants, fullyQualifiedNames,false) + ".class extends " + baseType));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java
index a22e48a9d..d6f8bb6e0 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.instructions.other;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -97,7 +98,7 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
if (slotname != null) {
if (value instanceof LocalRegAVM2Item) {
LocalRegAVM2Item lr = (LocalRegAVM2Item) value;
- String slotNameStr = slotname.getName(constants, fullyQualifiedNames);
+ String slotNameStr = slotname.getName(constants, fullyQualifiedNames, true);
if (localRegNames.containsKey(lr.regIndex)) {
if (localRegNames.get(lr.regIndex).equals(slotNameStr)) {
return; //Register with same name to slot
@@ -167,7 +168,7 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
for (int t = 0; t < body.traits.traits.size(); t++) {
if (body.traits.traits.get(t) instanceof TraitSlotConst) {
if (((TraitSlotConst) body.traits.traits.get(t)).slot_id == slotIndex) {
- slotname = body.traits.traits.get(t).getName(abc).getName(abc.constants, fullyQualifiedNames);
+ slotname = body.traits.traits.get(t).getName(abc).getName(abc.constants, fullyQualifiedNames, true);
}
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java
index 6694e6e31..7b7158b9d 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/AVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -20,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.instructions.stack.PopIns;
import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator;
+import com.jpexs.decompiler.flash.action.Deobfuscation;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.CompilationException;
@@ -96,7 +98,7 @@ public abstract class AVM2Item extends GraphTargetItem {
public static String localRegName(HashMap localRegNames, int reg) {
if (localRegNames.containsKey(reg)) {
- return localRegNames.get(reg);
+ return Deobfuscation.printIdentifier(localRegNames.get(reg));
} else {
if (reg == 0) {
return "this";
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ClassAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ClassAVM2Item.java
index c878b8267..ab39cf8fd 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ClassAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ClassAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.types.Multiname;
@@ -32,7 +33,7 @@ public class ClassAVM2Item extends AVM2Item {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
- return writer.append(className.getName(localData.constantsAvm2, localData.fullyQualifiedNames));
+ return writer.append(className.getName(localData.constantsAvm2, localData.fullyQualifiedNames,false));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java
index e37d5c77f..6d8c0e55d 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/FullMultinameAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
@@ -61,7 +62,7 @@ public class FullMultinameAVM2Item extends AVM2Item {
if (name != null) {
cname = name.toString(LocalData.create(constants, localRegNames, fullyQualifiedNames));
} else {
- cname = (constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames));
+ cname = (constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames,true));
}
String cns = "";
if (namespace != null) {
@@ -93,7 +94,7 @@ public class FullMultinameAVM2Item extends AVM2Item {
} else {
ConstantPool constants = localData.constantsAvm2;
List fullyQualifiedNames = localData.fullyQualifiedNames;
- writer.append(constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames));
+ writer.append(constants.getMultiname(multinameIndex).getName(constants, fullyQualifiedNames,false));
}
return writer;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetLexAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetLexAVM2Item.java
index d6f0aff4d..c5321128f 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetLexAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetLexAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -33,7 +34,7 @@ public class GetLexAVM2Item extends AVM2Item {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
- return writer.append(propertyName.getName(localData.constantsAvm2, localData.fullyQualifiedNames));
+ return writer.append(propertyName.getName(localData.constantsAvm2, localData.fullyQualifiedNames,false));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSlotAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSlotAVM2Item.java
index dd342cea3..2f91ef03d 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSlotAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/GetSlotAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -38,7 +39,7 @@ public class GetSlotAVM2Item extends AVM2Item {
if (slotName == null) {
return writer.append("/*UnknownSlot*/");
}
- return writer.append(slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames));
+ return writer.append(slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames,false));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/SetSlotAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/SetSlotAVM2Item.java
index a040653db..b52ca6a71 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/SetSlotAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/SetSlotAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
@@ -64,7 +65,7 @@ public class SetSlotAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assign
if (slotName == null) {
return writer.append("/*UnknownSlot*/");
}
- return writer.append(slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames));
+ return writer.append(slotName.getName(localData.constantsAvm2, localData.fullyQualifiedNames,false));
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java
index e1e506fe8..6df1adb5f 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -1629,9 +1630,9 @@ public class AVM2SourceGenerator implements SourceGenerator {
TraitSlotConst tsc = (TraitSlotConst) mbody.traits.traits.get(i);
GraphTargetItem type = TypeItem.UNBOUNDED;
if (tsc.type_index > 0) {
- type = new TypeItem(abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants));
+ type = new TypeItem(abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants,true));
}
- NameAVM2Item d = new NameAVM2Item(type, 0, tsc.getName(abc).getName(abc.constants, new ArrayList()), NameAVM2Item.getDefaultValue("" + type), true, new ArrayList());
+ NameAVM2Item d = new NameAVM2Item(type, 0, tsc.getName(abc).getName(abc.constants, new ArrayList(),true), NameAVM2Item.getDefaultValue("" + type), true, new ArrayList());
d.setSlotNumber(tsc.slot_id);
d.setSlotScope(slotScope);
mbody.code.code.addAll(0, toInsList(d.toSourceIgnoreReturnValue(localData, this)));
@@ -1818,7 +1819,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
for (ScriptInfo si : a.script_info) {
for (Trait t : si.traits.traits) {
Multiname m = t.getName(a);
- if (fullCustom.equals(m.getNameWithNamespace(a.constants))) {
+ if (fullCustom.equals(m.getNameWithNamespace(a.constants,true))) {
if (t instanceof TraitSlotConst) {
if (((TraitSlotConst) t).isNamespace()) {
return ((TraitSlotConst) t).value_index;
@@ -2132,7 +2133,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
indices.add(
abc.constants.getMultinameId(
new Multiname(Multiname.QNAME,
- abc.constants.getStringId(superName.getName(a.constants, new ArrayList()), true),
+ abc.constants.getStringId(superName.getName(a.constants, new ArrayList(),true), true),
abc.constants.getNamespaceId(new Namespace(superName.getNamespace(a.constants).kind, abc.constants.getStringId(superName.getNamespace(a.constants).getName(a.constants), true)), 0, true), 0, 0, new ArrayList()), true)
);
}
@@ -2188,7 +2189,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
for (Trait t : ii.traits.traits) {
if (eq(pkg, t.getName(abc).getNamespace(abc.constants).getName(abc.constants))) {
- if (propertyName.equals(t.getName(abc).getName(abc.constants, new ArrayList()))) {
+ if (propertyName.equals(t.getName(abc).getName(abc.constants, new ArrayList(),true))) {
outName.setVal(obj);
outNs.setVal(pkg);
outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants));
@@ -2211,7 +2212,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
continue;
}
Multiname clsName = ii.getName(abc.constants);
- if (obj.equals(clsName.getName(abc.constants, new ArrayList()))) {
+ if (obj.equals(clsName.getName(abc.constants, new ArrayList(),true))) {
if (eq(pkg, clsName.getNamespace(abc.constants).getName(abc.constants))) {
//class found
@@ -2219,7 +2220,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (t.getName(abc) == null) { //in traits phase 2
continue;
}
- if (propertyName.equals(t.getName(abc).getName(abc.constants, new ArrayList()))) {
+ if (propertyName.equals(t.getName(abc).getName(abc.constants, new ArrayList(),true))) {
outName.setVal(obj);
outNs.setVal(pkg);
outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants));
@@ -2239,7 +2240,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (t.getName(abc) == null) { //in traits phase 2
continue;
}
- if (propertyName.equals(t.getName(abc).getName(abc.constants, new ArrayList()))) {
+ if (propertyName.equals(t.getName(abc).getName(abc.constants, new ArrayList(),true))) {
outName.setVal(obj);
outNs.setVal(pkg);
outPropNs.setVal(t.getName(abc).getNamespace(abc.constants).getName(abc.constants));
@@ -2257,7 +2258,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
Multiname superName = abc.constants.constant_multiname.get(ii.super_index);
if (superName != null) {
- return searchPrototypeChain(instanceOnly, abcs, superName.getNamespace(abc.constants).getName(abc.constants), superName.getName(abc.constants, new ArrayList()), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue);
+ return searchPrototypeChain(instanceOnly, abcs, superName.getNamespace(abc.constants).getName(abc.constants), superName.getName(abc.constants, new ArrayList(),true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue);
} else {
return false;
}
@@ -2270,7 +2271,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
public static void parentNames(ABC abc, List allABCs, int name_index, List indices, List names, List namespaces, List outABCs) {
indices.add(name_index);
- names.add(abc.constants.constant_multiname.get(name_index).getName(abc.constants, new ArrayList()));
+ names.add(abc.constants.constant_multiname.get(name_index).getName(abc.constants, new ArrayList(),true));
namespaces.add(abc.constants.constant_multiname.get(name_index).getNamespace(abc.constants).getName(abc.constants));
Multiname mname = abc.constants.constant_multiname.get(name_index);
@@ -2283,7 +2284,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
for (ABC a : abcs) {
for (int i = 0; i < a.instance_info.size(); i++) {
Multiname m = a.constants.constant_multiname.get(a.instance_info.get(i).name_index);
- if (m.getName(a.constants, new ArrayList()).equals(mname.getName(abc.constants, new ArrayList()))) {
+ if (m.getName(a.constants, new ArrayList(),true).equals(mname.getName(abc.constants, new ArrayList(),true))) {
if (m.getNamespace(a.constants).hasName(a.constants, mname.getNamespace(abc.constants).getName(abc.constants))) {
//Multiname superName = a.constants.constant_multiname.get(a.instance_info.get(i).super_index);
@@ -2379,7 +2380,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
for (InstanceInfo ii : abc.instance_info) {
Multiname mname = abc.constants.constant_multiname.get(ii.name_index);
- if (mname != null && name.equals(mname.getName(abc.constants, new ArrayList()))) {
+ if (mname != null && name.equals(mname.getName(abc.constants, new ArrayList(),true))) {
if (mname.getNamespace(abc.constants).hasName(pkg, abc.constants)) {
name_index = ii.name_index;
break;
@@ -2388,7 +2389,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
for (int i = 1; i < abc.constants.constant_multiname.size(); i++) {
Multiname mname = abc.constants.constant_multiname.get(i);
- if (mname != null && name.equals(mname.getName(abc.constants, new ArrayList()))) {
+ if (mname != null && name.equals(mname.getName(abc.constants, new ArrayList(),true))) {
if (mname.getNamespace(abc.constants) != null && pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants))) {
name_index = i;
break;
@@ -2398,7 +2399,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (name_index == 0) {
if (pkg.isEmpty() && localData.currentScript != null /*FIXME!*/) {
for (Trait t : localData.currentScript.traits.traits) {
- if (t.getName(abc).getName(abc.constants, new ArrayList()).equals(name)) {
+ if (t.getName(abc).getName(abc.constants, new ArrayList(),true).equals(name)) {
name_index = t.name_index;
break;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java
index 2b151406b..5aa5354b7 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScriptParser.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SWC;
@@ -125,7 +126,7 @@ import java.util.logging.Logger;
public class ActionScriptParser {
private long uniqLast = 0;
- private final boolean debugMode = false;
+ private final boolean debugMode = true;
private static final String AS3_NAMESPACE = "http://adobe.com/AS3/2006/builtin";
private final ABC abc;
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java
index ec92311e1..d594d754b 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/PropertyAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -108,7 +109,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
}
return new ApplyTypeAVM2Item(null, obj, params);
} else {
- return new TypeItem(m.getNameWithNamespace(constants));
+ return new TypeItem(m.getNameWithNamespace(constants,true));
}
}
@@ -218,7 +219,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
Reference outPropNsIndex = new Reference<>(0);
Reference outPropType = new Reference<>(null);
Reference outPropValue = new Reference<>(null);
- if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, m.getNamespace(a.constants).getName(a.constants), m.getName(a.constants, new ArrayList()), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) {
+ if (AVM2SourceGenerator.searchPrototypeChain(false, abcs, m.getNamespace(a.constants).getName(a.constants), m.getName(a.constants, new ArrayList(),true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) {
objType = new TypeItem("".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal());
propType = outPropType.getVal();
propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME,
@@ -238,7 +239,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
for (MethodBody b : callStack) {
for (int i = 0; i < b.traits.traits.size(); i++) {
Trait t = b.traits.traits.get(i);
- if (t.getName(abc).getName(abc.constants, new ArrayList()).equals(propertyName)) {
+ if (t.getName(abc).getName(abc.constants, new ArrayList(),true).equals(propertyName)) {
if (t instanceof TraitSlotConst) {
TraitSlotConst tsc = (TraitSlotConst) t;
objType = new TypeItem("Function");
@@ -261,7 +262,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
int name_index = 0;
for (int m = 1; m < abc.constants.constant_multiname.size(); m++) {
Multiname mname = abc.constants.constant_multiname.get(m);
- if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList()).equals(propertyName) && mname.namespace_index == nsindex) {
+ if (mname.kind == Multiname.QNAME && mname.getName(abc.constants, new ArrayList(),true).equals(propertyName) && mname.namespace_index == nsindex) {
name_index = m;
break;
}
@@ -336,7 +337,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
Reference outPropType = new Reference<>(null);
Reference outPropValue = new Reference<>(null);
- if (propertyName != null && AVM2SourceGenerator.searchPrototypeChain(false, abcs, nsname, n.getName(a.constants, new ArrayList()), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) {
+ if (propertyName != null && AVM2SourceGenerator.searchPrototypeChain(false, abcs, nsname, n.getName(a.constants, new ArrayList(),true), propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue)) {
objType = new TypeItem("".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal());
propType = outPropType.getVal();
propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME,
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java
index 33d8ed9e6..5ffb91b1f 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/UnresolvedAVM2Item.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.avm2.parser.script;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
@@ -363,7 +364,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
if (a.instance_info.get(c).deleted) {
continue;
}
- if (a.instance_info.get(c).name_index > 0 && fname.equals(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants))) {
+ if (a.instance_info.get(c).name_index > 0 && fname.equals(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants,true))) {
if (!subtypes.isEmpty() && parts.size() > i + 1) {
continue;
}
@@ -407,12 +408,12 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
}
if ((a.instance_info.get(c).getName(a.constants) != null && a == abc && a.instance_info.get(c).getName(a.constants).namespace_index == ni)
|| (ons.kind != Namespace.KIND_PRIVATE && a.instance_info.get(c).getName(a.constants) != null && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants) != null && a.instance_info.get(c).getName(a.constants).getNamespace(a.constants).hasName(ons.getName(abc.constants), a.constants))) {
- String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, new ArrayList());
+ String cname = a.instance_info.get(c).getName(a.constants).getName(a.constants, new ArrayList(),true);
if (parts.get(0).equals(cname)) {
if (!subtypes.isEmpty() && parts.size() > 1) {
continue;
}
- TypeItem ret = new TypeItem(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants));
+ TypeItem ret = new TypeItem(a.instance_info.get(c).getName(a.constants).getNameWithNamespace(a.constants,true));
/*for (String s : subtypes) {
UnresolvedAVM2Item su = new UnresolvedAVM2Item(new ArrayList(), importedClasses, true, null, line, s, null, openedNamespaces);
su.resolve(thisType, paramTypes, paramNames, abc, otherAbcs, callStack, variables);
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java
index faae86210..578b2938a 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
@@ -55,13 +56,13 @@ public class ABCException implements Serializable {
if (name_index == 0) {
return "";
}
- return constants.getMultiname(name_index).getName(constants, fullyQualifiedNames);
+ return constants.getMultiname(name_index).getName(constants, fullyQualifiedNames,false);
}
public String getTypeName(ConstantPool constants, List fullyQualifiedNames) {
if (type_index == 0) {
return "*";
}
- return constants.getMultiname(type_index).getName(constants, fullyQualifiedNames);
+ return constants.getMultiname(type_index).getName(constants, fullyQualifiedNames,false);
}
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java
index f8fb8a956..83cf7cb1e 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -54,7 +55,7 @@ public class InstanceInfo {
public String getClassHeaderStr(ABC abc, List fullyQualifiedNames) {
String supIndexStr = "";
if (super_index > 0) {
- supIndexStr = " extends " + abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index
+ supIndexStr = " extends " + abc.constants.getMultiname(super_index).getName(abc.constants, fullyQualifiedNames,false);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index
}
String implStr = "";
if (interfaces.length > 0) {
@@ -67,7 +68,7 @@ public class InstanceInfo {
if (i > 0) {
implStr += ", ";
}
- implStr += abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames);
+ implStr += abc.constants.getMultiname(interfaces[i]).getName(abc.constants, fullyQualifiedNames,false);
}
}
String modifiers;
@@ -87,7 +88,7 @@ public class InstanceInfo {
if (isInterface()) {
objType = "interface ";
}
- return modifiers + objType + abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList()/* No full names here*/) + supIndexStr + implStr;
+ return modifiers + objType + abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList()/* No full names here*/,false) + supIndexStr + implStr;
}
public Multiname getName(ConstantPool constants) {
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java
index fb53d4d26..80bacddd1 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java
@@ -12,13 +12,15 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.construction.NewFunctionIns;
+import com.jpexs.decompiler.flash.action.Deobfuscation;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.helpers.Helper;
@@ -274,9 +276,9 @@ public class MethodInfo {
writer.appendNoHilight(", ");
}
if (!localRegNames.isEmpty()) {
- writer.appendNoHilight(localRegNames.get(i + 1));
+ writer.appendNoHilight(Deobfuscation.printIdentifier(localRegNames.get(i + 1)));
} else if ((paramNames.length > i) && (paramNames[i] != 0) && Configuration.paramNamesEnable.get()) {
- writer.appendNoHilight(constants.getString(paramNames[i]));
+ writer.appendNoHilight(Deobfuscation.printIdentifier(constants.getString(paramNames[i])));
} else {
writer.appendNoHilight("param" + (i + 1));
}
@@ -284,7 +286,7 @@ public class MethodInfo {
if (param_types[i] == 0) {
writer.hilightSpecial("*", "param", i);
} else {
- writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames), "param", i);
+ writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(constants, fullyQualifiedNames,false), "param", i);
}
if (optional != null) {
if (i >= param_types.length - optional.length) {
@@ -311,7 +313,7 @@ public class MethodInfo {
}
public GraphTextWriter getReturnTypeStr(GraphTextWriter writer, ConstantPool constants, List fullyQualifiedNames) {
- return writer.hilightSpecial(ret_type == 0 ? "*" : constants.getMultiname(ret_type).getName(constants, fullyQualifiedNames), "returns");
+ return writer.hilightSpecial(ret_type == 0 ? "*" : constants.getMultiname(ret_type).getName(constants, fullyQualifiedNames,false), "returns");
}
public void setBody(MethodBody body) {
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java
index 924543a52..b679439fd 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java
@@ -12,10 +12,12 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
+import com.jpexs.decompiler.flash.action.Deobfuscation;
import com.jpexs.helpers.Helper;
import java.util.List;
@@ -226,11 +228,11 @@ public class Multiname {
return null;
}
- private String typeNameToStr(ConstantPool constants, List fullyQualifiedNames) {
+ private String typeNameToStr(ConstantPool constants, List fullyQualifiedNames, boolean raw) {
if (constants.getMultiname(qname_index).name_index == name_index) {
return "ambiguousTypeName";
}
- String typeNameStr = constants.getMultiname(qname_index).getName(constants, fullyQualifiedNames);
+ String typeNameStr = constants.getMultiname(qname_index).getName(constants, fullyQualifiedNames,raw);
if (!params.isEmpty()) {
typeNameStr += ".<";
for (int i = 0; i < params.size(); i++) {
@@ -240,7 +242,7 @@ public class Multiname {
if (params.get(i) == 0) {
typeNameStr += "*";
} else {
- typeNameStr += constants.getMultiname(params.get(i)).getName(constants, fullyQualifiedNames);
+ typeNameStr += constants.getMultiname(params.get(i)).getName(constants, fullyQualifiedNames,raw);
}
}
typeNameStr += ">";
@@ -248,9 +250,9 @@ public class Multiname {
return typeNameStr;
}
- public String getName(ConstantPool constants, List fullyQualifiedNames) {
+ public String getName(ConstantPool constants, List fullyQualifiedNames, boolean raw) {
if (kind == TYPENAME) {
- return typeNameToStr(constants, fullyQualifiedNames);
+ return typeNameToStr(constants, fullyQualifiedNames,raw);
}
if (name_index == -1) {
return "";
@@ -260,13 +262,13 @@ public class Multiname {
} else {
String name = constants.getString(name_index);
if ((fullyQualifiedNames != null) && fullyQualifiedNames.contains(name)) {
- return getNameWithNamespace(constants);
+ return getNameWithNamespace(constants,raw);
}
- return (isAttribute() ? "@" : "") + name;
+ return (isAttribute() ? "@" : "") + (raw?name:Deobfuscation.printIdentifier(name));
}
}
- public String getNameWithNamespace(ConstantPool constants) {
+ public String getNameWithNamespace(ConstantPool constants,boolean raw) {
String ret = "";
Namespace ns = getNamespace(constants);
if (ns != null) {
@@ -275,7 +277,7 @@ public class Multiname {
ret += nsname + ".";
}
}
- ret += getName(constants, null);
+ ret += getName(constants, null, raw);
return ret;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java
index c6ad16325..1bc75a884 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java
@@ -12,11 +12,13 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
+import com.jpexs.decompiler.flash.action.Deobfuscation;
public class Namespace {
@@ -99,7 +101,7 @@ public class Namespace {
if (name_index == 0) {
return null;
}
- return constants.getString(name_index);
+ return Deobfuscation.printNamespace(constants.getString(name_index));
}
public boolean hasName(ConstantPool constants, String name) {
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java
index aba35998d..3dfc3375b 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -50,7 +51,7 @@ public class ScriptInfo {
if ((ns.kind == Namespace.KIND_PACKAGE_INTERNAL)
|| (ns.kind == Namespace.KIND_PACKAGE)) {
String packageName = ns.getName(abc.constants); //assume not null package
- String objectName = name.getName(abc.constants, new ArrayList());
+ String objectName = name.getName(abc.constants, new ArrayList(),false);
List traitIndices = new ArrayList<>();
traitIndices.add(j);
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
index 1b6a007ad..047ca6743 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -174,7 +175,7 @@ public abstract class Trait implements Serializable {
Multiname name = getName(abc);
Namespace ns = name.getNamespace(abc.constants);
String packageName = ns.getName(abc.constants);
- String objectName = name.getName(abc.constants, new ArrayList());
+ String objectName = name.getName(abc.constants, new ArrayList(),false);
return packageName + "." + objectName; //assume not null name
}
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
index 2977d6471..cb41ec544 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -202,7 +203,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
return;
}
Namespace ns = m.getNamespace(abc.constants);
- String name = m.getName(abc.constants, fullyQualifiedNames);
+ String name = m.getName(abc.constants, fullyQualifiedNames,false);
NamespaceSet nss = m.getNamespaceSet(abc.constants);
if (ns != null) {
parseUsagesFromNS(abcTags, abc, imports, uses, m.namespace_index, ignorePackage, name);
@@ -233,7 +234,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
return;
}
Namespace ns = m.getNamespace(abc.constants);
- String name = m.getName(abc.constants, fullyQualifiedNames);
+ String name = m.getName(abc.constants, fullyQualifiedNames,false);
NamespaceSet nss = m.getNamespaceSet(abc.constants);
if (ns != null) {
parseImportsUsagesFromNS(abcTags, abc, imports, uses, m.namespace_index, ignorePackage, name);
@@ -458,7 +459,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
writer.newLine();
writer.startTrait(abc.class_info.get(class_info).static_traits.traits.size() + abc.instance_info.get(class_info).instance_traits.traits.size() + 1);
writer.appendNoHilight("{").newLine();
- abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".staticinitializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
+ abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".staticinitializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
writer.appendNoHilight("}").newLine();
writer.endTrait();
}
@@ -487,7 +488,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
writer.startTrait(abc.class_info.get(class_info).static_traits.traits.size() + abc.instance_info.get(class_info).instance_traits.traits.size());
writer.appendNoHilight(modifier);
writer.appendNoHilight("function ");
- writer.appendNoHilight(abc.constants.getMultiname(abc.instance_info.get(class_info).name_index).getName(abc.constants, new ArrayList()/*do not want full names here*/));
+ writer.appendNoHilight(abc.constants.getMultiname(abc.instance_info.get(class_info).name_index).getName(abc.constants, new ArrayList()/*do not want full names here*/,false));
writer.appendNoHilight("(");
bodyIndex = abc.findBodyIndex(abc.instance_info.get(class_info).iinit_index);
if (bodyIndex != -1) {
@@ -497,16 +498,16 @@ public class TraitClass extends Trait implements TraitWithSlot {
}
writer.appendNoHilight(")").startBlock();
if (bodyIndex != -1) {
- abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".initializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
+ abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".initializer", exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
}
writer.endBlock().newLine();
writer.endTrait();
}
//static variables,constants & methods
- abc.class_info.get(class_info).static_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
+ abc.class_info.get(class_info).static_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
- abc.instance_info.get(class_info).instance_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
+ abc.instance_info.get(class_info).instance_traits.toString(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
writer.endBlock(); // class
writer.endClass();
@@ -522,7 +523,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
int bodyIndex = abc.findBodyIndex(abc.class_info.get(class_info).cinit_index);
if (bodyIndex != -1) {
writer.mark();
- abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".staticinitializer", exportMode, true, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), true, writer, fullyQualifiedNames, abc.class_info.get(class_info).static_traits, true);
+ abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".staticinitializer", exportMode, true, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), true, writer, fullyQualifiedNames, abc.class_info.get(class_info).static_traits, true);
classInitializerIsEmpty = !writer.getMark();
}
@@ -530,14 +531,14 @@ public class TraitClass extends Trait implements TraitWithSlot {
if (!abc.instance_info.get(class_info).isInterface()) {
bodyIndex = abc.findBodyIndex(abc.instance_info.get(class_info).iinit_index);
if (bodyIndex != -1) {
- abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames) + ".initializer", exportMode, false, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, abc.instance_info.get(class_info).instance_traits, true);
+ abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false) + ".initializer", exportMode, false, scriptIndex, class_info, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, abc.instance_info.get(class_info).instance_traits, true);
}
}
//static variables,constants & methods
- abc.class_info.get(class_info).static_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
+ abc.class_info.get(class_info).static_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
- abc.instance_info.get(class_info).instance_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
+ abc.instance_info.get(class_info).instance_traits.convert(this, path +/*packageName +*/ "/" + abc.instance_info.get(class_info).getName(abc.constants).getName(abc.constants, fullyQualifiedNames,false), abcTags, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel);
}
@Override
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
index 9d406d4fa..2ae0e7e10 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -58,7 +59,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
}
writer.appendNoHilight(modifier);
writer.hilightSpecial("function ", "traittype");
- writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames), "traitname");
+ writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames,false), "traitname");
writer.appendNoHilight("(");
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
writer.appendNoHilight(") : ");
@@ -79,7 +80,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
writer.appendNoHilight(" {").newLine();
int bodyIndex = abc.findBodyIndex(method_info);
if (bodyIndex != -1) {
- abc.bodies.get(bodyIndex).toString(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames), exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
+ abc.bodies.get(bodyIndex).toString(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames,false), exportMode, abc, this, abc.constants, abc.method_info, writer, fullyQualifiedNames);
}
writer.newLine();
writer.appendNoHilight("}");
@@ -94,7 +95,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
if (!abc.instance_info.get(classIndex).isInterface()) {
int bodyIndex = abc.findBodyIndex(method_info);
if (bodyIndex != -1) {
- abc.bodies.get(bodyIndex).convert(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames), exportMode, isStatic, scriptIndex, classIndex, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, null, true);
+ abc.bodies.get(bodyIndex).convert(path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames,false), exportMode, isStatic, scriptIndex, classIndex, abc, this, abc.constants, abc.method_info, new ScopeStack(), false, writer, fullyQualifiedNames, null, true);
}
}
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
index b23b297e4..dc9e87868 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
@@ -12,11 +12,13 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
+import com.jpexs.decompiler.flash.action.Deobfuscation;
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
@@ -66,7 +68,7 @@ public class TraitMethodGetterSetter extends Trait {
writer.appendNoHilight(modifier);
writer.hilightSpecial("function " + addKind, "traittype");
- writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames), "traitname");
+ writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames,false), "traitname");
writer.appendNoHilight("(");
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
writer.appendNoHilight(") : ");
@@ -76,7 +78,7 @@ public class TraitMethodGetterSetter extends Trait {
@Override
public void convert(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
- path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames);
+ path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames,false);
convertHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
int bodyIndex = abc.findBodyIndex(method_info);
if (!(classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1)) {
@@ -88,7 +90,7 @@ public class TraitMethodGetterSetter extends Trait {
@Override
public GraphTextWriter toString(Trait parent, String path, List abcTags, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List fullyQualifiedNames, boolean parallel) throws InterruptedException {
- path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames);
+ path = path + "." + getName(abc).getName(abc.constants, fullyQualifiedNames,false);
toStringHeader(parent, path, abcTags, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
int bodyIndex = abc.findBodyIndex(method_info);
if (classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1) {
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java
index 9500f720b..945d0a1f3 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.types.traits;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -60,7 +61,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
public String getType(ConstantPool constants, List fullyQualifiedNames) {
String typeStr = "*";
if (type_index > 0) {
- typeStr = constants.getMultiname(type_index).getName(constants, fullyQualifiedNames);
+ typeStr = constants.getMultiname(type_index).getName(constants, fullyQualifiedNames, false);
}
return typeStr;
}
@@ -85,7 +86,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
slotconst = "namespace";
}
writer.hilightSpecial(slotconst + " ", "traittype");
- writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames), "traitname");
+ writer.hilightSpecial(getName(abc).getName(abc.constants, fullyQualifiedNames, false), "traitname");
writer.hilightSpecial(typeStr, "traittypename");
return writer;
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/ClassNameMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/ClassNameMultinameUsage.java
index 948358256..db13ec67e 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/ClassNameMultinameUsage.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/ClassNameMultinameUsage.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.usages;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -31,6 +32,6 @@ public class ClassNameMultinameUsage extends InsideClassMultinameUsage implement
@Override
public String toString() {
- return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants);
+ return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants,false);
}
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/InsideClassMultinameUsage.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/InsideClassMultinameUsage.java
index b3753f6a8..2f71af1a0 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/InsideClassMultinameUsage.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/usages/InsideClassMultinameUsage.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.abc.usages;
import com.jpexs.decompiler.flash.abc.ABC;
@@ -36,7 +37,7 @@ public abstract class InsideClassMultinameUsage extends MultinameUsage {
@Override
public String toString() {
- return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants);
+ return "class " + abc.constants.getMultiname(abc.instance_info.get(classIndex).name_index).getNameWithNamespace(abc.constants,false);
}
public int getMultinameIndex() {
diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Deobfuscation.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Deobfuscation.java
index 962875a0e..16106fa27 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Deobfuscation.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Deobfuscation.java
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
+import com.jpexs.helpers.Cache;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -174,7 +175,7 @@ public class Deobfuscation {
}
return null;
}
-
+
public static boolean isValidName(String s,String ...exceptions) {
boolean isValid = true;
@@ -250,9 +251,59 @@ public class Deobfuscation {
}
public static String makeObfuscatedIdentifier(String s){
- return "§"+escapeOIdentifier(s)+"§";
+ return "\u00A7"+escapeOIdentifier(s)+"\u00A7";
+ }
+
+
+ private static Cache nameCache = Cache.getInstance(false);
+
+ /**
+ * Ensures identifier is valid and if not, uses paragraph syntax
+ * @param s Identifier
+ * @param validExceptions Exceptions which are valid (e.g. some reserved words)
+ * @return
+ */
+ public static String printIdentifier(String s,String ...validExceptions){
+ if(s.startsWith("\u00A7")&&s.endsWith("\u00A7")){ //Assuming already printed - TODO:detect better
+ return s;
+ }
+ if(nameCache.contains(s)){
+ return nameCache.get(s);
+ }
+ if(isValidName(s, validExceptions)){
+ nameCache.put(s, s);
+ return s;
+ }
+ String ret = makeObfuscatedIdentifier(s);
+ nameCache.put(s, ret);
+ return ret;
}
+ public static String printNamespace(String pkg,String ...validNameExceptions){
+ if(nameCache.contains(pkg)){
+ return nameCache.get(pkg);
+ }
+ if(pkg.equals("")){
+ nameCache.put(pkg, pkg);
+ return pkg;
+ }
+ String[] parts = null;
+ if (pkg.contains(".")) {
+ parts = pkg.split("\\.");
+ } else {
+ parts = new String[]{pkg};
+ }
+ String ret="";
+ for(int i=0;i0){
+ ret+=".";
+ }
+ ret += printIdentifier(parts[i], validNameExceptions);
+ }
+ nameCache.put(pkg, ret);
+ return ret;
+ }
+
public static String escapeOIdentifier(String s) {
StringBuilder ret = new StringBuilder(s.length());
@@ -273,7 +324,7 @@ public class Deobfuscation {
} else if (c == '\\') {
ret.append("\\\\");
} else if (c == '\u00A7') {
- ret.append("\\\\u00A7");
+ ret.append("\\\u00A7");
} else {
ret.append(c);
}
diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java
index d16adc439..2a78e7e9e 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Cache.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.helpers;
import java.io.File;
@@ -89,14 +90,14 @@ public class Cache {
}
public boolean contains(Object key) {
- if (storageType == STORAGE_FILES) {
+ if (storageType == STORAGE_FILES) {
return cacheFiles.containsKey(key);
} else if (storageType == STORAGE_MEMORY) {
return cacheMemory.containsKey(key);
}
return false;
}
-
+
public void clear() {
cacheMemory.clear();
for (File f : cacheFiles.values()) {
diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java
index f3ff29894..dc14e9019 100644
--- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java
+++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library.
*/
+ * License along with this library.
+ */
package com.jpexs.decompiler.flash.generators;
import com.jpexs.decompiler.flash.SWF;
@@ -56,7 +57,7 @@ public class AS3Generator {
StringBuilder s = new StringBuilder();
for (Trait t : abc.instance_info.get(classId).instance_traits.traits) {
if (t instanceof TraitMethodGetterSetter) {
- String name = t.getName(abc).getName(abc.constants, new ArrayList());
+ String name = t.getName(abc).getName(abc.constants, new ArrayList(),true);
if (name.startsWith("test")) {
s.append("@Test\r\npublic void ");
s.append(name);
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java
index 5439ba10f..78d3dddb3 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java
@@ -322,7 +322,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
String name = "";
if (abc != null) {
if (classIndex > -1) {
- name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants);
+ name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants,false);
}
}
currentTrait = null;
@@ -333,7 +333,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
currentTrait = abc.findTraitByTraitId(classIndex, lastTraitIndex);
isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex);
if (currentTrait != null) {
- name += ":" + currentTrait.getName(abc).getName(abc.constants, new ArrayList());
+ name += ":" + currentTrait.getName(abc).getName(abc.constants, new ArrayList(),false);
}
}
}
@@ -371,11 +371,11 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
String name = "";
currentTrait = null;
if (abc != null) {
- name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants);
+ name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants,false);
currentTrait = abc.findTraitByTraitId(classIndex, lastTraitIndex);
isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex);
if (currentTrait != null) {
- name += ":" + currentTrait.getName(abc).getName(abc.constants, new ArrayList());
+ name += ":" + currentTrait.getName(abc).getName(abc.constants, new ArrayList(),false);
}
}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java
index 356098e84..c848ad36f 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java
@@ -1,215 +1,215 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.gui.abc;
-
-import com.jpexs.decompiler.flash.AppStrings;
-import com.jpexs.decompiler.flash.abc.types.traits.Trait;
-import com.jpexs.decompiler.flash.gui.HeaderLabel;
-import com.jpexs.decompiler.flash.gui.View;
-import com.jpexs.helpers.CancellableWorker;
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.FlowLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingConstants;
-import javax.swing.border.BevelBorder;
-
-/**
- *
- * @author JPEXS
- */
-public class DetailPanel extends JPanel implements ActionListener {
-
- static final String ACTION_SAVE_DETAIL = "SAVEDETAIL";
- static final String ACTION_EDIT_DETAIL = "EDITDETAIL";
- static final String ACTION_CANCEL_DETAIL = "CANCELDETAIL";
-
- public MethodTraitDetailPanel methodTraitPanel;
- public JPanel unsupportedTraitPanel;
- public SlotConstTraitDetailPanel slotConstTraitPanel;
- public static final String METHOD_TRAIT_CARD = AppStrings.translate("abc.detail.methodtrait");
- public static final String UNSUPPORTED_TRAIT_CARD = AppStrings.translate("abc.detail.unsupported");
- public static final String SLOT_CONST_TRAIT_CARD = AppStrings.translate("abc.detail.slotconsttrait");
- private final JPanel innerPanel;
- public JButton saveButton = new JButton(AppStrings.translate("button.save"), View.getIcon("save16"));
- public JButton editButton = new JButton(AppStrings.translate("button.edit"), View.getIcon("edit16"));
- public JButton cancelButton = new JButton(AppStrings.translate("button.cancel"), View.getIcon("cancel16"));
- private final HashMap cardMap = new HashMap<>();
- private String selectedCard;
- private final JLabel selectedLabel;
- private boolean editMode = false;
- private final JPanel buttonsPanel;
- private final ABCPanel abcPanel;
- private final JLabel traitNameLabel;
-
- public DetailPanel(ABCPanel abcPanel) {
- this.abcPanel = abcPanel;
- innerPanel = new JPanel();
- CardLayout layout = new CardLayout();
- innerPanel.setLayout(layout);
- methodTraitPanel = new MethodTraitDetailPanel(abcPanel);
- cardMap.put(METHOD_TRAIT_CARD, methodTraitPanel);
-
- unsupportedTraitPanel = new JPanel(new BorderLayout());
- JLabel unsup = new JLabel(AppStrings.translate("info.selecttrait"), SwingConstants.CENTER);
- unsupportedTraitPanel.add(unsup, BorderLayout.CENTER);
-
- cardMap.put(UNSUPPORTED_TRAIT_CARD, unsupportedTraitPanel);
-
- slotConstTraitPanel = new SlotConstTraitDetailPanel(abcPanel.decompiledTextArea);
- cardMap.put(SLOT_CONST_TRAIT_CARD, slotConstTraitPanel);
-
- for (String key : cardMap.keySet()) {
- innerPanel.add(cardMap.get(key), key);
- }
-
- setLayout(new BorderLayout());
- add(innerPanel, BorderLayout.CENTER);
-
- editButton.setMargin(new Insets(3, 3, 3, 10));
- saveButton.setMargin(new Insets(3, 3, 3, 10));
- cancelButton.setMargin(new Insets(3, 3, 3, 10));
-
- buttonsPanel = new JPanel();
- buttonsPanel.setLayout(new FlowLayout());
- saveButton.setActionCommand(ACTION_SAVE_DETAIL);
- saveButton.addActionListener(this);
- editButton.setActionCommand(ACTION_EDIT_DETAIL);
- editButton.addActionListener(this);
- cancelButton.setActionCommand(ACTION_CANCEL_DETAIL);
- cancelButton.addActionListener(this);
- buttonsPanel.setBorder(new BevelBorder(BevelBorder.RAISED));
- buttonsPanel.add(editButton);
- buttonsPanel.add(saveButton);
- buttonsPanel.add(cancelButton);
- add(buttonsPanel, BorderLayout.SOUTH);
- selectedCard = UNSUPPORTED_TRAIT_CARD;
- layout.show(innerPanel, UNSUPPORTED_TRAIT_CARD);
- buttonsPanel.setVisible(false);
- selectedLabel = new HeaderLabel("");
- selectedLabel.setText(selectedCard);
- //selectedLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
- selectedLabel.setHorizontalAlignment(SwingConstants.CENTER);
- JPanel topPanel = new JPanel(new BorderLayout());
- topPanel.add(selectedLabel, BorderLayout.NORTH);
- traitNameLabel = new JLabel("");
- JPanel traitInfoPanel = new JPanel();
- traitInfoPanel.setLayout(new BoxLayout(traitInfoPanel, BoxLayout.LINE_AXIS));
- //traitInfoPanel.add(new JLabel(" " + translate("abc.detail.traitname")));
- traitInfoPanel.add(traitNameLabel);
- topPanel.add(traitInfoPanel, BorderLayout.CENTER);
- add(topPanel, BorderLayout.NORTH);
- }
-
- public void setEditMode(boolean val) {
- slotConstTraitPanel.setEditMode(val);
- methodTraitPanel.setEditMode(val);
- saveButton.setVisible(val);
- editButton.setVisible(!val);
- cancelButton.setVisible(val);
- editMode = val;
- if (val) {
- selectedLabel.setIcon(View.getIcon("editing16"));
- } else {
- selectedLabel.setIcon(null);
- }
- }
-
- public void showCard(final String name, final Trait trait) {
- View.execInEventDispatch(new Runnable() {
-
- @Override
- public void run() {
- CardLayout layout = (CardLayout) innerPanel.getLayout();
- layout.show(innerPanel, name);
- boolean b = cardMap.get(name) instanceof TraitDetail;
- buttonsPanel.setVisible(b);
-
- TraitDetail newDetail = null;
- if (b) {
- newDetail = (TraitDetail) cardMap.get(name);
- }
- for (JComponent v : cardMap.values()) {
- if (v instanceof TraitDetail) {
- if (v != newDetail) {
- TraitDetail oldDetail = (TraitDetail) v;
- oldDetail.setActive(false);
- }
- }
- }
- if (newDetail != null) {
- newDetail.setActive(true);
- }
-
- selectedCard = name;
- selectedLabel.setText(selectedCard);
- if (trait == null) {
- traitNameLabel.setText("-");
- } else {
- traitNameLabel.setText(trait.getName(abcPanel.abc).getName(abcPanel.abc.constants, new ArrayList()));
- }
- }
- });
-
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- switch (e.getActionCommand()) {
- case ACTION_EDIT_DETAIL:
- setEditMode(true);
- methodTraitPanel.methodCodePanel.focusEditor();
- break;
- case ACTION_CANCEL_DETAIL:
- setEditMode(false);
- abcPanel.decompiledTextArea.resetEditing();
- break;
- case ACTION_SAVE_DETAIL:
- if (cardMap.get(selectedCard) instanceof TraitDetail) {
- if (((TraitDetail) cardMap.get(selectedCard)).save()) {
- CancellableWorker worker = new CancellableWorker() {
-
- @Override
- public Void doInBackground() throws Exception {
- int lasttrait = abcPanel.decompiledTextArea.lastTraitIndex;
- abcPanel.decompiledTextArea.reloadClass();
- abcPanel.decompiledTextArea.gotoTrait(lasttrait);
- return null;
- }
-
- @Override
- protected void done() {
- setEditMode(false);
- View.showMessageDialog(null, AppStrings.translate("message.trait.saved"));
- }
- };
- worker.execute();
- }
- }
- break;
- }
- }
-}
+/*
+ * Copyright (C) 2010-2014 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 .
+ */
+package com.jpexs.decompiler.flash.gui.abc;
+
+import com.jpexs.decompiler.flash.AppStrings;
+import com.jpexs.decompiler.flash.abc.types.traits.Trait;
+import com.jpexs.decompiler.flash.gui.HeaderLabel;
+import com.jpexs.decompiler.flash.gui.View;
+import com.jpexs.helpers.CancellableWorker;
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.FlowLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.BevelBorder;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class DetailPanel extends JPanel implements ActionListener {
+
+ static final String ACTION_SAVE_DETAIL = "SAVEDETAIL";
+ static final String ACTION_EDIT_DETAIL = "EDITDETAIL";
+ static final String ACTION_CANCEL_DETAIL = "CANCELDETAIL";
+
+ public MethodTraitDetailPanel methodTraitPanel;
+ public JPanel unsupportedTraitPanel;
+ public SlotConstTraitDetailPanel slotConstTraitPanel;
+ public static final String METHOD_TRAIT_CARD = AppStrings.translate("abc.detail.methodtrait");
+ public static final String UNSUPPORTED_TRAIT_CARD = AppStrings.translate("abc.detail.unsupported");
+ public static final String SLOT_CONST_TRAIT_CARD = AppStrings.translate("abc.detail.slotconsttrait");
+ private final JPanel innerPanel;
+ public JButton saveButton = new JButton(AppStrings.translate("button.save"), View.getIcon("save16"));
+ public JButton editButton = new JButton(AppStrings.translate("button.edit"), View.getIcon("edit16"));
+ public JButton cancelButton = new JButton(AppStrings.translate("button.cancel"), View.getIcon("cancel16"));
+ private final HashMap cardMap = new HashMap<>();
+ private String selectedCard;
+ private final JLabel selectedLabel;
+ private boolean editMode = false;
+ private final JPanel buttonsPanel;
+ private final ABCPanel abcPanel;
+ private final JLabel traitNameLabel;
+
+ public DetailPanel(ABCPanel abcPanel) {
+ this.abcPanel = abcPanel;
+ innerPanel = new JPanel();
+ CardLayout layout = new CardLayout();
+ innerPanel.setLayout(layout);
+ methodTraitPanel = new MethodTraitDetailPanel(abcPanel);
+ cardMap.put(METHOD_TRAIT_CARD, methodTraitPanel);
+
+ unsupportedTraitPanel = new JPanel(new BorderLayout());
+ JLabel unsup = new JLabel(AppStrings.translate("info.selecttrait"), SwingConstants.CENTER);
+ unsupportedTraitPanel.add(unsup, BorderLayout.CENTER);
+
+ cardMap.put(UNSUPPORTED_TRAIT_CARD, unsupportedTraitPanel);
+
+ slotConstTraitPanel = new SlotConstTraitDetailPanel(abcPanel.decompiledTextArea);
+ cardMap.put(SLOT_CONST_TRAIT_CARD, slotConstTraitPanel);
+
+ for (String key : cardMap.keySet()) {
+ innerPanel.add(cardMap.get(key), key);
+ }
+
+ setLayout(new BorderLayout());
+ add(innerPanel, BorderLayout.CENTER);
+
+ editButton.setMargin(new Insets(3, 3, 3, 10));
+ saveButton.setMargin(new Insets(3, 3, 3, 10));
+ cancelButton.setMargin(new Insets(3, 3, 3, 10));
+
+ buttonsPanel = new JPanel();
+ buttonsPanel.setLayout(new FlowLayout());
+ saveButton.setActionCommand(ACTION_SAVE_DETAIL);
+ saveButton.addActionListener(this);
+ editButton.setActionCommand(ACTION_EDIT_DETAIL);
+ editButton.addActionListener(this);
+ cancelButton.setActionCommand(ACTION_CANCEL_DETAIL);
+ cancelButton.addActionListener(this);
+ buttonsPanel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ buttonsPanel.add(editButton);
+ buttonsPanel.add(saveButton);
+ buttonsPanel.add(cancelButton);
+ add(buttonsPanel, BorderLayout.SOUTH);
+ selectedCard = UNSUPPORTED_TRAIT_CARD;
+ layout.show(innerPanel, UNSUPPORTED_TRAIT_CARD);
+ buttonsPanel.setVisible(false);
+ selectedLabel = new HeaderLabel("");
+ selectedLabel.setText(selectedCard);
+ //selectedLabel.setBorder(new BevelBorder(BevelBorder.RAISED));
+ selectedLabel.setHorizontalAlignment(SwingConstants.CENTER);
+ JPanel topPanel = new JPanel(new BorderLayout());
+ topPanel.add(selectedLabel, BorderLayout.NORTH);
+ traitNameLabel = new JLabel("");
+ JPanel traitInfoPanel = new JPanel();
+ traitInfoPanel.setLayout(new BoxLayout(traitInfoPanel, BoxLayout.LINE_AXIS));
+ //traitInfoPanel.add(new JLabel(" " + translate("abc.detail.traitname")));
+ traitInfoPanel.add(traitNameLabel);
+ topPanel.add(traitInfoPanel, BorderLayout.CENTER);
+ add(topPanel, BorderLayout.NORTH);
+ }
+
+ public void setEditMode(boolean val) {
+ slotConstTraitPanel.setEditMode(val);
+ methodTraitPanel.setEditMode(val);
+ saveButton.setVisible(val);
+ editButton.setVisible(!val);
+ cancelButton.setVisible(val);
+ editMode = val;
+ if (val) {
+ selectedLabel.setIcon(View.getIcon("editing16"));
+ } else {
+ selectedLabel.setIcon(null);
+ }
+ }
+
+ public void showCard(final String name, final Trait trait) {
+ View.execInEventDispatch(new Runnable() {
+
+ @Override
+ public void run() {
+ CardLayout layout = (CardLayout) innerPanel.getLayout();
+ layout.show(innerPanel, name);
+ boolean b = cardMap.get(name) instanceof TraitDetail;
+ buttonsPanel.setVisible(b);
+
+ TraitDetail newDetail = null;
+ if (b) {
+ newDetail = (TraitDetail) cardMap.get(name);
+ }
+ for (JComponent v : cardMap.values()) {
+ if (v instanceof TraitDetail) {
+ if (v != newDetail) {
+ TraitDetail oldDetail = (TraitDetail) v;
+ oldDetail.setActive(false);
+ }
+ }
+ }
+ if (newDetail != null) {
+ newDetail.setActive(true);
+ }
+
+ selectedCard = name;
+ selectedLabel.setText(selectedCard);
+ if (trait == null) {
+ traitNameLabel.setText("-");
+ } else {
+ traitNameLabel.setText(trait.getName(abcPanel.abc).getName(abcPanel.abc.constants, new ArrayList(),false));
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ switch (e.getActionCommand()) {
+ case ACTION_EDIT_DETAIL:
+ setEditMode(true);
+ methodTraitPanel.methodCodePanel.focusEditor();
+ break;
+ case ACTION_CANCEL_DETAIL:
+ setEditMode(false);
+ abcPanel.decompiledTextArea.resetEditing();
+ break;
+ case ACTION_SAVE_DETAIL:
+ if (cardMap.get(selectedCard) instanceof TraitDetail) {
+ if (((TraitDetail) cardMap.get(selectedCard)).save()) {
+ CancellableWorker worker = new CancellableWorker() {
+
+ @Override
+ public Void doInBackground() throws Exception {
+ int lasttrait = abcPanel.decompiledTextArea.lastTraitIndex;
+ abcPanel.decompiledTextArea.reloadClass();
+ abcPanel.decompiledTextArea.gotoTrait(lasttrait);
+ return null;
+ }
+
+ @Override
+ protected void done() {
+ setEditMode(false);
+ View.showMessageDialog(null, AppStrings.translate("message.trait.saved"));
+ }
+ };
+ worker.execute();
+ }
+ }
+ break;
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java b/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java
index b6b776e51..4253bf7f7 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/TraitsListItem.java
@@ -1,142 +1,142 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.gui.abc;
-
-import com.jpexs.decompiler.flash.AppStrings;
-import com.jpexs.decompiler.flash.abc.ABC;
-import com.jpexs.decompiler.flash.abc.types.traits.Trait;
-import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
-import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
-import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
-import com.jpexs.decompiler.flash.helpers.NulWriter;
-import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author JPEXS
- */
-public class TraitsListItem {
-
- private final Type type;
- private final boolean isStatic;
- private final List abcTags;
- private final ABC abc;
- private final int classIndex;
- private final int index;
- private final int scriptIndex;
- public String STR_INSTANCE_INITIALIZER = AppStrings.translate("abc.traitslist.instanceinitializer");
- public String STR_CLASS_INITIALIZER = AppStrings.translate("abc.traitslist.classinitializer");
-
- public TraitsListItem(Type type, int index, boolean isStatic, List abcTags, ABC abc, int classIndex, int scriptIndex) {
- this.type = type;
- this.index = index;
- this.isStatic = isStatic;
- this.abcTags = abcTags;
- this.abc = abc;
- this.classIndex = classIndex;
- this.scriptIndex = scriptIndex;
- }
-
- public int getGlobalTraitId() {
- if (type == Type.INITIALIZER) {
- if (!isStatic) {
- return abc.class_info.get(classIndex).static_traits.traits.size() + abc.instance_info.get(classIndex).instance_traits.traits.size();
- } else {
- return abc.class_info.get(classIndex).static_traits.traits.size() + abc.instance_info.get(classIndex).instance_traits.traits.size() + 1;
- }
- }
- if (isStatic) {
- return index;
- } else {
- return abc.class_info.get(classIndex).static_traits.traits.size() + index;
- }
- }
-
- public String toStringName() {
- if ((type != Type.INITIALIZER) && isStatic) {
- return abc.class_info.get(classIndex).static_traits.traits.get(index).getName(abc).getName(abc.constants, new ArrayList());
- } else if ((type != Type.INITIALIZER) && (!isStatic)) {
- return abc.instance_info.get(classIndex).instance_traits.traits.get(index).getName(abc).getName(abc.constants, new ArrayList());
- } else if (!isStatic) {
- return "__" + STR_INSTANCE_INITIALIZER;
- } else {
- return "__" + STR_CLASS_INITIALIZER;
- }
- }
-
- @Override
- public String toString() {
- String s = "";
- try {
- if ((type != Type.INITIALIZER) && isStatic) {
- abc.class_info.get(classIndex).static_traits.traits.get(index).convertHeader(null, "", abcTags, abc, true, ScriptExportMode.AS, scriptIndex, classIndex, new NulWriter(), new ArrayList(), false);
- HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
- abc.class_info.get(classIndex).static_traits.traits.get(index).toStringHeader(null, "", abcTags, abc, true, ScriptExportMode.AS, scriptIndex, classIndex, writer, new ArrayList(), false);
- s = writer.toString();
- } else if ((type != Type.INITIALIZER) && (!isStatic)) {
- abc.instance_info.get(classIndex).instance_traits.traits.get(index).convertHeader(null, "", abcTags, abc, false, ScriptExportMode.AS, scriptIndex, classIndex, new NulWriter(), new ArrayList(), false);
- HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
- abc.instance_info.get(classIndex).instance_traits.traits.get(index).toStringHeader(null, "", abcTags, abc, false, ScriptExportMode.AS, scriptIndex, classIndex, writer, new ArrayList(), false);
- s = writer.toString();
- } else if (!isStatic) {
- s = STR_INSTANCE_INITIALIZER;
- } else {
- s = STR_CLASS_INITIALIZER;
- }
- } catch (InterruptedException ex) {
- Logger.getLogger(TraitsListItem.class.getName()).log(Level.SEVERE, null, ex);
- }
- s = s.replaceAll("[ \r\n]+", " ");
- return s;
- }
-
- public Type getType() {
- return type;
- }
-
- public boolean isStatic() {
- return isStatic;
- }
-
- public enum Type {
-
- METHOD,
- VAR,
- CONST,
- INITIALIZER;
-
- public static Type getTypeForTrait(Trait t) {
- if (t instanceof TraitMethodGetterSetter) {
- return METHOD;
- }
- if (t instanceof TraitSlotConst) {
- if (((TraitSlotConst) t).isConst()) {
- return CONST;
- } else {
- return VAR;
- }
- }
- return null;
- }
- }
-}
+/*
+ * Copyright (C) 2010-2014 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 .
+ */
+package com.jpexs.decompiler.flash.gui.abc;
+
+import com.jpexs.decompiler.flash.AppStrings;
+import com.jpexs.decompiler.flash.abc.ABC;
+import com.jpexs.decompiler.flash.abc.types.traits.Trait;
+import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
+import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
+import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
+import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
+import com.jpexs.decompiler.flash.helpers.NulWriter;
+import com.jpexs.decompiler.flash.tags.ABCContainerTag;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class TraitsListItem {
+
+ private final Type type;
+ private final boolean isStatic;
+ private final List abcTags;
+ private final ABC abc;
+ private final int classIndex;
+ private final int index;
+ private final int scriptIndex;
+ public String STR_INSTANCE_INITIALIZER = AppStrings.translate("abc.traitslist.instanceinitializer");
+ public String STR_CLASS_INITIALIZER = AppStrings.translate("abc.traitslist.classinitializer");
+
+ public TraitsListItem(Type type, int index, boolean isStatic, List abcTags, ABC abc, int classIndex, int scriptIndex) {
+ this.type = type;
+ this.index = index;
+ this.isStatic = isStatic;
+ this.abcTags = abcTags;
+ this.abc = abc;
+ this.classIndex = classIndex;
+ this.scriptIndex = scriptIndex;
+ }
+
+ public int getGlobalTraitId() {
+ if (type == Type.INITIALIZER) {
+ if (!isStatic) {
+ return abc.class_info.get(classIndex).static_traits.traits.size() + abc.instance_info.get(classIndex).instance_traits.traits.size();
+ } else {
+ return abc.class_info.get(classIndex).static_traits.traits.size() + abc.instance_info.get(classIndex).instance_traits.traits.size() + 1;
+ }
+ }
+ if (isStatic) {
+ return index;
+ } else {
+ return abc.class_info.get(classIndex).static_traits.traits.size() + index;
+ }
+ }
+
+ public String toStringName() {
+ if ((type != Type.INITIALIZER) && isStatic) {
+ return abc.class_info.get(classIndex).static_traits.traits.get(index).getName(abc).getName(abc.constants, new ArrayList(),false);
+ } else if ((type != Type.INITIALIZER) && (!isStatic)) {
+ return abc.instance_info.get(classIndex).instance_traits.traits.get(index).getName(abc).getName(abc.constants, new ArrayList(),false);
+ } else if (!isStatic) {
+ return "__" + STR_INSTANCE_INITIALIZER;
+ } else {
+ return "__" + STR_CLASS_INITIALIZER;
+ }
+ }
+
+ @Override
+ public String toString() {
+ String s = "";
+ try {
+ if ((type != Type.INITIALIZER) && isStatic) {
+ abc.class_info.get(classIndex).static_traits.traits.get(index).convertHeader(null, "", abcTags, abc, true, ScriptExportMode.AS, scriptIndex, classIndex, new NulWriter(), new ArrayList(), false);
+ HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
+ abc.class_info.get(classIndex).static_traits.traits.get(index).toStringHeader(null, "", abcTags, abc, true, ScriptExportMode.AS, scriptIndex, classIndex, writer, new ArrayList(), false);
+ s = writer.toString();
+ } else if ((type != Type.INITIALIZER) && (!isStatic)) {
+ abc.instance_info.get(classIndex).instance_traits.traits.get(index).convertHeader(null, "", abcTags, abc, false, ScriptExportMode.AS, scriptIndex, classIndex, new NulWriter(), new ArrayList(), false);
+ HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
+ abc.instance_info.get(classIndex).instance_traits.traits.get(index).toStringHeader(null, "", abcTags, abc, false, ScriptExportMode.AS, scriptIndex, classIndex, writer, new ArrayList(), false);
+ s = writer.toString();
+ } else if (!isStatic) {
+ s = STR_INSTANCE_INITIALIZER;
+ } else {
+ s = STR_CLASS_INITIALIZER;
+ }
+ } catch (InterruptedException ex) {
+ Logger.getLogger(TraitsListItem.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ s = s.replaceAll("[ \r\n]+", " ");
+ return s;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public boolean isStatic() {
+ return isStatic;
+ }
+
+ public enum Type {
+
+ METHOD,
+ VAR,
+ CONST,
+ INITIALIZER;
+
+ public static Type getTypeForTrait(Trait t) {
+ if (t instanceof TraitMethodGetterSetter) {
+ return METHOD;
+ }
+ if (t instanceof TraitSlotConst) {
+ if (((TraitSlotConst) t).isConst()) {
+ return CONST;
+ } else {
+ return VAR;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java b/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
index 862c924b3..42f1effcc 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
@@ -93,7 +93,7 @@ public class UsageFrame extends AppDialog implements ActionListener, MouseListen
cont.add(new JScrollPane(usageList), BorderLayout.CENTER);
cont.add(buttonsPanel, BorderLayout.SOUTH);
setSize(400, 300);
- setTitle((definitions ? translate("dialog.title.declaration") : translate("dialog.title")) + abc.constants.getMultiname(multinameIndex).getNameWithNamespace(abc.constants));
+ setTitle((definitions ? translate("dialog.title.declaration") : translate("dialog.title")) + abc.constants.getMultiname(multinameIndex).getNameWithNamespace(abc.constants,false));
View.centerScreen(this);
View.setWindowIcon(this);
}
@@ -134,7 +134,7 @@ public class UsageFrame extends AppDialog implements ActionListener, MouseListen
settrait.run();
} else {
abcPanel.decompiledTextArea.addScriptListener(settrait);
- abcPanel.hilightScript(abcPanel.swf, abcPanel.abc.instance_info.get(icu.classIndex).getName(abcPanel.abc.constants).getNameWithNamespace(abcPanel.abc.constants));
+ abcPanel.hilightScript(abcPanel.swf, abcPanel.abc.instance_info.get(icu.classIndex).getName(abcPanel.abc.constants).getNameWithNamespace(abcPanel.abc.constants,false));
}
}
}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java b/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java
index 4e7a647e6..899e9a35a 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/tablemodels/MultinameTableModel.java
@@ -1,184 +1,184 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.gui.abc.tablemodels;
-
-import com.jpexs.decompiler.flash.abc.ABC;
-import java.util.ArrayList;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.TableModel;
-
-public class MultinameTableModel implements TableModel {
-
- private final ABC abc;
- private static final String[] columnNames = new String[]{"Index", "Kind", "Name", "Namespace", "NamespaceSet"};
- private static final Class[] classes = new Class[]{Long.class, String.class, String.class, String.class, String.class};
-
- public MultinameTableModel(ABC abc) {
- this.abc = abc;
- }
-
- /**
- * Returns the number of rows in the model. A JTable uses this
- * method to determine how many rows it should display. This method should
- * be quick, as it is called frequently during rendering.
- *
- * @return the number of rows in the model
- * @see #getColumnCount
- */
- @Override
- public int getRowCount() {
- if (abc == null) {
- return 0;
- }
- return abc.constants.getMultinameCount();
- }
-
- /**
- * Returns the number of columns in the model. A JTable uses
- * this method to determine how many columns it should create and display by
- * default.
- *
- * @return the number of columns in the model
- * @see #getRowCount
- */
- @Override
- public int getColumnCount() {
- return 5;
- }
-
- /**
- * Returns the name of the column at columnIndex. This is used
- * to initialize the table's column header name. Note: this name does not
- * need to be unique; two columns in a table can have the same name.
- *
- * @param columnIndex the index of the column
- * @return the name of the column
- */
- @Override
- public String getColumnName(int columnIndex) {
- return columnNames[columnIndex];
- }
-
- /**
- * Returns the most specific superclass for all the cell values in the
- * column. This is used by the JTable to set up a default
- * renderer and editor for the column.
- *
- * @param columnIndex the index of the column
- * @return the common ancestor class of the object values in the model.
- */
- @Override
- public Class> getColumnClass(int columnIndex) {
- return classes[columnIndex];
- }
-
- /**
- * Returns true if the cell at rowIndex and
- * columnIndex is editable. Otherwise, setValueAt
- * on the cell will not change the value of that cell.
- *
- * @param rowIndex the row whose value to be queried
- * @param columnIndex the column whose value to be queried
- * @return true if the cell is editable
- * @see #setValueAt
- */
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return false;
- }
-
- /**
- * Returns the value for the cell at columnIndex and
- * rowIndex.
- *
- * @param rowIndex the row whose value is to be queried
- * @param columnIndex the column whose value is to be queried
- * @return the value Object at the specified cell
- */
- @Override
- public Object getValueAt(int rowIndex, int columnIndex) {
- switch (columnIndex) {
- case 0:
- return rowIndex;
- case 1:
- if (rowIndex == 0) {
- return "";
- }
- return abc.constants.getMultiname(rowIndex).getKindStr();
- case 2:
- if (rowIndex == 0) {
- return "";
- }
- if (abc.constants.getMultiname(rowIndex).name_index == -1) {
- return "";
- }
- return abc.constants.getMultiname(rowIndex).getName(abc.constants, new ArrayList());
- case 3:
- if (rowIndex == 0) {
- return "";
- }
- if (abc.constants.getMultiname(rowIndex).namespace_index <= 0) {
- return "-";
- }
- return abc.constants.getMultiname(rowIndex).getNamespace(abc.constants).getNameWithKind(abc.constants);
- case 4:
- if (rowIndex == 0) {
- return "";
- }
- if (abc.constants.getMultiname(rowIndex).namespace_set_index <= 0) {
- return "-";
- }
- return abc.constants.getMultiname(rowIndex).getNamespaceSet(abc.constants).toString(abc.constants);
- default:
- return null;
- }
- }
-
- /**
- * Sets the value in the cell at columnIndex and
- * rowIndex to aValue.
- *
- * @param aValue the new value
- * @param rowIndex the row whose value is to be changed
- * @param columnIndex the column whose value is to be changed
- * @see #getValueAt
- * @see #isCellEditable
- */
- @Override
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- }
-
- /**
- * Adds a listener to the list that is notified each time a change to the
- * data model occurs.
- *
- * @param l the TableModelListener
- */
- @Override
- public void addTableModelListener(TableModelListener l) {
- }
-
- /**
- * Removes a listener from the list that is notified each time a change to
- * the data model occurs.
- *
- * @param l the TableModelListener
- */
- @Override
- public void removeTableModelListener(TableModelListener l) {
- }
-}
+/*
+ * Copyright (C) 2010-2014 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 .
+ */
+package com.jpexs.decompiler.flash.gui.abc.tablemodels;
+
+import com.jpexs.decompiler.flash.abc.ABC;
+import java.util.ArrayList;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableModel;
+
+public class MultinameTableModel implements TableModel {
+
+ private final ABC abc;
+ private static final String[] columnNames = new String[]{"Index", "Kind", "Name", "Namespace", "NamespaceSet"};
+ private static final Class[] classes = new Class[]{Long.class, String.class, String.class, String.class, String.class};
+
+ public MultinameTableModel(ABC abc) {
+ this.abc = abc;
+ }
+
+ /**
+ * Returns the number of rows in the model. A JTable uses this
+ * method to determine how many rows it should display. This method should
+ * be quick, as it is called frequently during rendering.
+ *
+ * @return the number of rows in the model
+ * @see #getColumnCount
+ */
+ @Override
+ public int getRowCount() {
+ if (abc == null) {
+ return 0;
+ }
+ return abc.constants.getMultinameCount();
+ }
+
+ /**
+ * Returns the number of columns in the model. A JTable uses
+ * this method to determine how many columns it should create and display by
+ * default.
+ *
+ * @return the number of columns in the model
+ * @see #getRowCount
+ */
+ @Override
+ public int getColumnCount() {
+ return 5;
+ }
+
+ /**
+ * Returns the name of the column at columnIndex. This is used
+ * to initialize the table's column header name. Note: this name does not
+ * need to be unique; two columns in a table can have the same name.
+ *
+ * @param columnIndex the index of the column
+ * @return the name of the column
+ */
+ @Override
+ public String getColumnName(int columnIndex) {
+ return columnNames[columnIndex];
+ }
+
+ /**
+ * Returns the most specific superclass for all the cell values in the
+ * column. This is used by the JTable to set up a default
+ * renderer and editor for the column.
+ *
+ * @param columnIndex the index of the column
+ * @return the common ancestor class of the object values in the model.
+ */
+ @Override
+ public Class> getColumnClass(int columnIndex) {
+ return classes[columnIndex];
+ }
+
+ /**
+ * Returns true if the cell at rowIndex and
+ * columnIndex is editable. Otherwise, setValueAt
+ * on the cell will not change the value of that cell.
+ *
+ * @param rowIndex the row whose value to be queried
+ * @param columnIndex the column whose value to be queried
+ * @return true if the cell is editable
+ * @see #setValueAt
+ */
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return false;
+ }
+
+ /**
+ * Returns the value for the cell at columnIndex and
+ * rowIndex.
+ *
+ * @param rowIndex the row whose value is to be queried
+ * @param columnIndex the column whose value is to be queried
+ * @return the value Object at the specified cell
+ */
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return rowIndex;
+ case 1:
+ if (rowIndex == 0) {
+ return "";
+ }
+ return abc.constants.getMultiname(rowIndex).getKindStr();
+ case 2:
+ if (rowIndex == 0) {
+ return "";
+ }
+ if (abc.constants.getMultiname(rowIndex).name_index == -1) {
+ return "";
+ }
+ return abc.constants.getMultiname(rowIndex).getName(abc.constants, new ArrayList(),true);
+ case 3:
+ if (rowIndex == 0) {
+ return "";
+ }
+ if (abc.constants.getMultiname(rowIndex).namespace_index <= 0) {
+ return "-";
+ }
+ return abc.constants.getMultiname(rowIndex).getNamespace(abc.constants).getNameWithKind(abc.constants);
+ case 4:
+ if (rowIndex == 0) {
+ return "";
+ }
+ if (abc.constants.getMultiname(rowIndex).namespace_set_index <= 0) {
+ return "-";
+ }
+ return abc.constants.getMultiname(rowIndex).getNamespaceSet(abc.constants).toString(abc.constants);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Sets the value in the cell at columnIndex and
+ * rowIndex to aValue.
+ *
+ * @param aValue the new value
+ * @param rowIndex the row whose value is to be changed
+ * @param columnIndex the column whose value is to be changed
+ * @see #getValueAt
+ * @see #isCellEditable
+ */
+ @Override
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+ }
+
+ /**
+ * Adds a listener to the list that is notified each time a change to the
+ * data model occurs.
+ *
+ * @param l the TableModelListener
+ */
+ @Override
+ public void addTableModelListener(TableModelListener l) {
+ }
+
+ /**
+ * Removes a listener from the list that is notified each time a change to
+ * the data model occurs.
+ *
+ * @param l the TableModelListener
+ */
+ @Override
+ public void removeTableModelListener(TableModelListener l) {
+ }
+}