format source code

This commit is contained in:
2015-03-31 21:32:49 +02:00
parent 9813f62cdf
commit cc5f2ff4c2
18 changed files with 2245 additions and 2018 deletions
@@ -49,7 +49,7 @@ public class IdentifiersDeobfuscation {
public static final String VALID_NEXT_CHARACTERS = VALID_FIRST_CHARACTERS + "\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}";
private static final Pattern VALID_NAME_PATTERN = Pattern.compile("^[a-zA-Z_\\$][a-zA-Z0-9_\\$]*$");
private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("^[" + VALID_FIRST_CHARACTERS + "][" + VALID_NEXT_CHARACTERS + "]*$");
public static final String FOO_CHARACTERS = "bcdfghjklmnpqrstvwz";
@@ -50,7 +50,7 @@ public class ABCInputStream implements AutoCloseable {
public static final boolean DEBUG_READ = false;
public DumpInfo dumpInfo;
private byte[] stringDataBuffer = new byte[256];
public void startBuffer() {
@@ -477,17 +477,17 @@ public class ABCInputStream implements AutoCloseable {
public String readString(String name) throws IOException {
newDumpLevel(name, "String");
int length = readU30Internal();
// avoid creating new byte array every time
if (stringDataBuffer.length < length) {
int newLength = stringDataBuffer.length * 2;
while (newLength < length) {
newLength *= 2;
}
stringDataBuffer = new byte[newLength];
}
safeRead(length, stringDataBuffer);
String r = new String(stringDataBuffer, 0, length, Utf8Helper.charset);
endDumpLevel(r);
@@ -33,11 +33,11 @@ public class ClassInfo {
public ClassInfo() {
static_traits = new Traits();
}
public ClassInfo(Traits traits) {
static_traits = traits;
}
@Override
public String toString() {
return "method_index=" + cinit_index + "\r\n" + static_traits.toString();
@@ -56,11 +56,11 @@ public class InstanceInfo {
public InstanceInfo() {
instance_traits = new Traits();
}
public InstanceInfo(Traits traits) {
instance_traits = traits;
}
@Override
public String toString() {
return "name_index=" + name_index + " super_index=" + super_index + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString();
@@ -85,13 +85,13 @@ public final class MethodBody implements Cloneable {
this.codeBytes = new byte[0];
this.exceptions = new ABCException[0];
}
public MethodBody(Traits traits, byte[] codeBytes, ABCException[] exceptions) {
this.traits = traits;
this.codeBytes = codeBytes;
this.exceptions = exceptions;
}
public synchronized void setCodeBytes(byte codeBytes[]) {
this.codeBytes = codeBytes;
this.code = null;
@@ -70,7 +70,7 @@ public class ScriptInfo {
traitIndices.addAll(otherTraits);
otherTraits.clear();
}
if (packagePrefix == null || packageName.startsWith(packagePrefix)) {
ClassPath cp = new ClassPath(packageName, objectName);
ret.add(new ScriptPack(cp, abc, scriptIndex, traitIndices));
@@ -32,7 +32,7 @@ import java.util.List;
public abstract class Trait implements Serializable {
private static final int[] EMPTY_METADATA_ARRAY = new int[0];
public int name_index;
public int kindType;
@@ -39,11 +39,11 @@ public class Traits implements Serializable {
public Traits() {
traits = new ArrayList<>();
}
public Traits(int initialCapacity) {
traits = new ArrayList<>(initialCapacity);
}
public void delete(ABC abc, boolean d) {
for (Trait t : traits) {
t.delete(abc, d);
@@ -149,7 +149,7 @@ public class FontExporter {
f.getEngine().setCopyrightYear(cop == null ? "" : cop);
f.setAuthor(ApplicationInfo.shortApplicationVerName);
f.setVersion("1.0");
SWF swf = t.getSwf();
if (swf != null && swf.swfList != null && swf.swfList.sourceInfo != null) {
String fileName = swf.swfList.sourceInfo.getFile();
@@ -278,7 +278,7 @@ public class FontExporter {
WritableFontData woffData = w.convert(font);
woffData.copyTo(fos);
}
ttfFile.delete();
}
}
@@ -308,13 +308,13 @@ public class FrameExporter {
if (evl != null) {
evl.handleExportingEvent("frame", pos + 1, fframes.size(), tim.parentTag == null ? "" : tim.parentTag.getName());
}
BufferedImage result = SWF.frameToImageGet(ftim, fframes.get(pos++), 0, null, 0, ftim.displayRect, new Matrix(), new ColorTransform(), fbackgroundColor, false, settings.zoom).getBufferedImage();
if (evl != null) {
evl.handleExportedEvent("frame", pos + 1, fframes.size(), tim.parentTag == null ? "" : tim.parentTag.getName());
}
return result;
}
};
@@ -99,11 +99,11 @@ public class SwfXmlExporter {
StringBuilder sb = new StringBuilder(data.length * 2);
for (int i = 0; i < data.length; i++) {
sb.append(String.format("%02x", data[i]));
}
}
return sb.toString();
}
private static void generateXml(Document doc, Node node, String name, Object obj, boolean isListItem, int level) {
Class cls = obj != null ? obj.getClass() : null;
@@ -114,7 +114,7 @@ public class DefineTextTag extends TextTag {
ret += "\r\n";
}*/
}
if (fnt == null) {
ret.add(AppResources.translate("fontNotFound").replace("%fontId%", Integer.toString(rec.fontId)));
} else {
@@ -57,7 +57,7 @@ public class AS2Package implements TreeItem {
result.addAll(scripts.values());
return result;
}
public TreeItem getChild(int index) {
if (index < subPackages.size()) {
for (AS2Package subPackage : subPackages.values()) {