custom namespaces fix

This commit is contained in:
Jindra Petřík
2015-07-12 12:23:11 +02:00
parent bfee75d72b
commit 6d52d3fbb2
3 changed files with 9 additions and 14 deletions

View File

@@ -861,11 +861,11 @@ public class ABC {
if (getNamespaceMap().containsKey(value)) {
return getNamespaceMap().get(value);
} else {
String ns = getDeobfuscation().builtInNs(value);
DottedChain ns = getDeobfuscation().builtInNs(value);
if (ns == null) {
return new DottedChain("");
} else {
return new DottedChain(ns);
return ns;
}
}
}

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.graph.DottedChain;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -91,15 +92,15 @@ public class AVM2Deobfuscation {
return isValid;
}
public String builtInNs(String ns) {
public DottedChain builtInNs(String ns) {
if (ns == null) {
return null;
}
if (ns.equals("http://www.adobe.com/2006/actionscript/flash/proxy")) {
return "flash.utils.flash_proxy";
return new DottedChain("flash", "utils", "flash_proxy");
}
if (ns.equals("http://adobe.com/AS3/2006/builtin")) {
return "-";
return new DottedChain("-");
}
return null;
}

View File

@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.helpers.Helper;
import java.io.Serializable;
import java.util.List;
@@ -78,7 +79,8 @@ public abstract class Trait implements Cloneable, Serializable {
if (m.namespace_index == -1) {
break;
}
nsname = abcTag.getABC().nsValueToName(abc.constants.getNamespace(m.namespace_index).getName(abc.constants, true)).getLast();
DottedChain dc = abcTag.getABC().nsValueToName(abc.constants.getNamespace(m.namespace_index).getName(abc.constants, true));
nsname = dc.getLast();
if (nsname == null) {
break;
@@ -90,14 +92,6 @@ public abstract class Trait implements Cloneable, Serializable {
Namespace ns = m.getNamespace(abc.constants);
if (nsname.isEmpty() || (nsname.equals("-"))) {
if (ns != null) {
if (ns.kind == Namespace.KIND_NAMESPACE) {
nsname = ns.getName(abc.constants, true);
}
}
}
if (nsname != null) {
String identifier = IdentifiersDeobfuscation.printIdentifier(true, nsname);
if (identifier != null && !identifier.isEmpty()) {