mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 15:20:51 +00:00
Print SafeStr list at the bottom (AS3)
This commit is contained in:
@@ -23,8 +23,10 @@ import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Dotted chain class. Represents a chain of names separated by dots.
|
||||
@@ -450,13 +452,14 @@ public class DottedChain implements Serializable, Comparable<DottedChain> {
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swf SWF
|
||||
* @param as3 Whether to print as AS3
|
||||
* @param raw Whether to print raw (without deobfuscation)
|
||||
* @param withSuffix Whether to print with suffix
|
||||
* @return String
|
||||
*/
|
||||
protected String toString(SWF swf, boolean as3, boolean raw, boolean withSuffix) {
|
||||
protected String toString(Set<String> usedDeobfuscations, SWF swf, boolean as3, boolean raw, boolean withSuffix) {
|
||||
if (parts.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
@@ -471,7 +474,7 @@ public class DottedChain implements Serializable, Comparable<DottedChain> {
|
||||
}
|
||||
String part = parts.get(i).name;
|
||||
boolean lastStar = i == parts.size() - 1 && "*".equals(part);
|
||||
ret.append((raw || lastStar) ? part : IdentifiersDeobfuscation.printIdentifier(swf, as3, part));
|
||||
ret.append((raw || lastStar) ? part : IdentifiersDeobfuscation.printIdentifier(swf, usedDeobfuscations, as3, part));
|
||||
if (withSuffix) {
|
||||
ret.append(parts.get(i).namespaceSuffix);
|
||||
}
|
||||
@@ -497,7 +500,7 @@ public class DottedChain implements Serializable, Comparable<DottedChain> {
|
||||
ret.append(File.separator);
|
||||
}
|
||||
|
||||
ret.append(Helper.makeFileName(IdentifiersDeobfuscation.printIdentifier(swf, true, parts.get(i).name)));
|
||||
ret.append(Helper.makeFileName(IdentifiersDeobfuscation.printIdentifier(swf, new LinkedHashSet<>(), true, parts.get(i).name)));
|
||||
}
|
||||
return ret.toString();
|
||||
}
|
||||
@@ -519,11 +522,12 @@ public class DottedChain implements Serializable, Comparable<DottedChain> {
|
||||
* To printable string.
|
||||
*
|
||||
* @param swf SWF
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param as3 Whether to print as AS3
|
||||
* @return Printable string
|
||||
*/
|
||||
public String toPrintableString(SWF swf, boolean as3) {
|
||||
return toString(swf, as3, false, true);
|
||||
public String toPrintableString(Set<String> usedDeobfuscations, SWF swf, boolean as3) {
|
||||
return toString(usedDeobfuscations, swf, as3, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,7 +537,7 @@ public class DottedChain implements Serializable, Comparable<DottedChain> {
|
||||
* @return Raw string
|
||||
*/
|
||||
public String toRawString() { //Is SUFFIX correctly handled?
|
||||
return toString(null, false/*ignored*/, true, true);
|
||||
return toString(new LinkedHashSet<>(), null, false/*ignored*/, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,9 +163,9 @@ public class TypeItem extends GraphTargetItem {
|
||||
boolean as3 = localData.constantsAvm2 != null;
|
||||
|
||||
if (localData.fullyQualifiedNames.contains(DottedChain.parseWithSuffix(fullTypeName.getLast()))) {
|
||||
writer.hilightSpecial(fullTypeName.toPrintableString(localData.swf, as3), HighlightSpecialType.TYPE_NAME, fullTypeName.toRawString());
|
||||
writer.hilightSpecial(fullTypeName.toPrintableString(localData.usedDeobfuscations, localData.swf, as3), HighlightSpecialType.TYPE_NAME, fullTypeName.toRawString());
|
||||
} else {
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(localData.swf, as3, fullTypeName.getLast()), HighlightSpecialType.TYPE_NAME, fullTypeName.toRawString());
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(localData.swf, localData.usedDeobfuscations, as3, fullTypeName.getLast()), HighlightSpecialType.TYPE_NAME, fullTypeName.toRawString());
|
||||
}
|
||||
|
||||
return writer;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -41,6 +42,11 @@ public class LocalData {
|
||||
*/
|
||||
public static LocalData empty = new LocalData();
|
||||
|
||||
/**
|
||||
* Used deobfuscations
|
||||
*/
|
||||
public Set<String> usedDeobfuscations;
|
||||
|
||||
/**
|
||||
* SWF
|
||||
*/
|
||||
@@ -100,12 +106,15 @@ public class LocalData {
|
||||
* Creates a new local data
|
||||
*
|
||||
* @param constants Constant pool
|
||||
* @param swf SWF
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @return Local data
|
||||
*/
|
||||
public static LocalData create(ConstantPool constants, SWF swf) {
|
||||
public static LocalData create(ConstantPool constants, SWF swf, Set<String> usedDeobfuscations) {
|
||||
LocalData localData = new LocalData();
|
||||
localData.constants = constants;
|
||||
localData.swf = swf;
|
||||
localData.usedDeobfuscations = usedDeobfuscations;
|
||||
return localData;
|
||||
}
|
||||
|
||||
@@ -119,9 +128,10 @@ public class LocalData {
|
||||
* @param seenMethods Seen methods
|
||||
* @param exportMode Export mode
|
||||
* @param swfVersion SWF version
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @return Local data
|
||||
*/
|
||||
public static LocalData create(List<MethodBody> callStack, AbcIndexing abcIndex, ABC abc, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, Set<Integer> seenMethods, ScriptExportMode exportMode, int swfVersion) {
|
||||
public static LocalData create(List<MethodBody> callStack, AbcIndexing abcIndex, ABC abc, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, Set<Integer> seenMethods, ScriptExportMode exportMode, int swfVersion, Set<String> usedDeobfuscations) {
|
||||
LocalData localData = new LocalData();
|
||||
localData.abc = abc;
|
||||
localData.constantsAvm2 = abc.constants;
|
||||
@@ -133,6 +143,7 @@ public class LocalData {
|
||||
localData.exportMode = exportMode;
|
||||
localData.swfVersion = swfVersion;
|
||||
localData.swf = abc.getSwf();
|
||||
localData.usedDeobfuscations = usedDeobfuscations;
|
||||
return localData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user