mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 17:10:57 +00:00
cleanup with "Inspect and Transform"
This commit is contained in:
@@ -56,7 +56,7 @@ public class ChromeCache implements CacheImplementation {
|
||||
for (EntryStore en : entries) {
|
||||
if (en.state == EntryStore.ENTRY_NORMAL) {
|
||||
String key = en.getKey();
|
||||
if (key != null && !key.trim().equals("")) {
|
||||
if (key != null && !key.trim().isEmpty()) {
|
||||
ret.add(en);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ import javax.imageio.ImageIO;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SWF {
|
||||
public final class SWF {
|
||||
|
||||
/**
|
||||
* Default version of SWF file format
|
||||
@@ -479,52 +479,56 @@ public class SWF {
|
||||
byte[] hdr = new byte[3];
|
||||
fis.read(hdr);
|
||||
String shdr = new String(hdr, "utf-8");
|
||||
if (shdr.equals("CWS")) {
|
||||
int version = fis.read();
|
||||
SWFInputStream sis = new SWFInputStream(fis, version, 4);
|
||||
long fileSize = sis.readUI32();
|
||||
SWFOutputStream sos = new SWFOutputStream(fos, version);
|
||||
sos.write("FWS".getBytes("utf-8"));
|
||||
sos.writeUI8(version);
|
||||
sos.writeUI32(fileSize);
|
||||
InflaterInputStream iis = new InflaterInputStream(fis);
|
||||
int i;
|
||||
while ((i = iis.read()) != -1) {
|
||||
fos.write(i);
|
||||
}
|
||||
|
||||
fis.close();
|
||||
fos.close();
|
||||
} else if (shdr.equals("ZWS")) {
|
||||
int version = fis.read();
|
||||
SWFInputStream sis = new SWFInputStream(fis, version, 4);
|
||||
long fileSize = sis.readUI32();
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
sis.readUI32(); //outSize
|
||||
int propertiesSize = 5;
|
||||
byte[] lzmaProperties = new byte[propertiesSize];
|
||||
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
|
||||
throw new IOException("LZMA:input .lzma file is too short");
|
||||
}
|
||||
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
|
||||
if (!decoder.SetDecoderProperties(lzmaProperties)) {
|
||||
throw new IOException("LZMA:Incorrect stream properties");
|
||||
}
|
||||
|
||||
if (!decoder.Code(sis, baos, fileSize - 8)) {
|
||||
throw new IOException("LZMA:Error in data stream");
|
||||
}
|
||||
try (SWFOutputStream sos = new SWFOutputStream(fos, version)) {
|
||||
sos.write("FWS".getBytes("utf-8"));
|
||||
sos.write(version);
|
||||
sos.writeUI32(fileSize);
|
||||
sos.write(baos.toByteArray());
|
||||
}
|
||||
fis.close();
|
||||
fos.close();
|
||||
} else {
|
||||
return false;
|
||||
switch (shdr) {
|
||||
case "CWS":
|
||||
{
|
||||
int version = fis.read();
|
||||
SWFInputStream sis = new SWFInputStream(fis, version, 4);
|
||||
long fileSize = sis.readUI32();
|
||||
SWFOutputStream sos = new SWFOutputStream(fos, version);
|
||||
sos.write("FWS".getBytes("utf-8"));
|
||||
sos.writeUI8(version);
|
||||
sos.writeUI32(fileSize);
|
||||
InflaterInputStream iis = new InflaterInputStream(fis);
|
||||
int i;
|
||||
while ((i = iis.read()) != -1) {
|
||||
fos.write(i);
|
||||
}
|
||||
fis.close();
|
||||
fos.close();
|
||||
break;
|
||||
}
|
||||
case "ZWS":
|
||||
{
|
||||
int version = fis.read();
|
||||
SWFInputStream sis = new SWFInputStream(fis, version, 4);
|
||||
long fileSize = sis.readUI32();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
sis.readUI32();
|
||||
int propertiesSize = 5;
|
||||
byte[] lzmaProperties = new byte[propertiesSize];
|
||||
if (sis.read(lzmaProperties, 0, propertiesSize) != propertiesSize) {
|
||||
throw new IOException("LZMA:input .lzma file is too short");
|
||||
}
|
||||
SevenZip.Compression.LZMA.Decoder decoder = new SevenZip.Compression.LZMA.Decoder();
|
||||
if (!decoder.SetDecoderProperties(lzmaProperties)) {
|
||||
throw new IOException("LZMA:Incorrect stream properties");
|
||||
}
|
||||
if (!decoder.Code(sis, baos, fileSize - 8)) {
|
||||
throw new IOException("LZMA:Error in data stream");
|
||||
}
|
||||
try (SWFOutputStream sos = new SWFOutputStream(fos, version)) {
|
||||
sos.write("FWS".getBytes("utf-8"));
|
||||
sos.write(version);
|
||||
sos.writeUI32(fileSize);
|
||||
sos.write(baos.toByteArray());
|
||||
}
|
||||
fis.close();
|
||||
fos.close();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
return false;
|
||||
@@ -842,7 +846,7 @@ public class SWF {
|
||||
expName = "";
|
||||
}
|
||||
if (expName.contains(".")) {
|
||||
expName = expName.substring(expName.lastIndexOf(".") + 1);
|
||||
expName = expName.substring(expName.lastIndexOf('.') + 1);
|
||||
}
|
||||
if ((ct.getClass().getName() + "_" + expName).compareTo(addNode.tag.getClass().getName() + "_" + pathParts[pos]) > 0) {
|
||||
break;
|
||||
@@ -1023,7 +1027,7 @@ public class SWF {
|
||||
private static void writeLE(OutputStream os, long val, int size) throws IOException {
|
||||
for (int i = 0; i < size; i++) {
|
||||
os.write((int) (val & 0xff));
|
||||
val = val >> 8;
|
||||
val >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1528,17 +1532,17 @@ public class SWF {
|
||||
}
|
||||
if (allVariableNamesStr.contains(ret)) {
|
||||
exists = true;
|
||||
rndSize = rndSize + 1;
|
||||
rndSize += 1;
|
||||
continue loopfoo;
|
||||
}
|
||||
if (isReserved(ret)) {
|
||||
exists = true;
|
||||
rndSize = rndSize + 1;
|
||||
rndSize += 1;
|
||||
continue;
|
||||
}
|
||||
if (deobfuscated.containsValue(ret)) {
|
||||
exists = true;
|
||||
rndSize = rndSize + 1;
|
||||
rndSize += 1;
|
||||
continue;
|
||||
}
|
||||
} while (exists);
|
||||
@@ -1856,13 +1860,13 @@ public class SWF {
|
||||
String pkg = null;
|
||||
String name = "";
|
||||
if (n.contains(".")) {
|
||||
pkg = n.substring(0, n.lastIndexOf("."));
|
||||
name = n.substring(n.lastIndexOf(".") + 1);
|
||||
pkg = n.substring(0, n.lastIndexOf('.'));
|
||||
name = n.substring(n.lastIndexOf('.') + 1);
|
||||
} else {
|
||||
name = n;
|
||||
}
|
||||
boolean changed = false;
|
||||
if ((pkg != null) && (!pkg.equals(""))) {
|
||||
if ((pkg != null) && (!pkg.isEmpty())) {
|
||||
String changedPkg = deobfuscatePackage(pkg, renameType, selected);
|
||||
if (changedPkg != null) {
|
||||
changed = true;
|
||||
@@ -2092,7 +2096,7 @@ public class SWF {
|
||||
informListeners("rename", "function " + fc + "/" + allFunctions.size());
|
||||
if (fun instanceof ActionDefineFunction) {
|
||||
ActionDefineFunction f = (ActionDefineFunction) fun;
|
||||
if (f.functionName.equals("")) { //anonymous function, leave as is
|
||||
if (f.functionName.isEmpty()) { //anonymous function, leave as is
|
||||
continue;
|
||||
}
|
||||
String changed = deobfuscateName(f.functionName, false, "function", renameType, selected);
|
||||
@@ -2103,7 +2107,7 @@ public class SWF {
|
||||
}
|
||||
if (fun instanceof ActionDefineFunction2) {
|
||||
ActionDefineFunction2 f = (ActionDefineFunction2) fun;
|
||||
if (f.functionName.equals("")) { //anonymous function, leave as is
|
||||
if (f.functionName.isEmpty()) { //anonymous function, leave as is
|
||||
continue;
|
||||
}
|
||||
String changed = deobfuscateName(f.functionName, false, "function", renameType, selected);
|
||||
@@ -2524,7 +2528,6 @@ public class SWF {
|
||||
f++;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public void removeTagFromTimeline(Tag toRemove, List<Tag> timeline) {
|
||||
|
||||
@@ -471,7 +471,7 @@ public class SWFInputStream extends InputStream {
|
||||
}
|
||||
for (int bit = 0; bit < nBits; bit++) {
|
||||
int nb = (tempByte >> (7 - bitPos)) & 1;
|
||||
ret = ret + (nb << (nBits - 1 - bit));
|
||||
ret += (nb << (nBits - 1 - bit));
|
||||
bitPos++;
|
||||
if (bitPos == 8) {
|
||||
bitPos = 0;
|
||||
|
||||
@@ -236,7 +236,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
int sign = bits >> 31;
|
||||
int exponent = (bits >> 22) & 0xff;
|
||||
int mantisa = bits & 0x3FFFFF;
|
||||
mantisa = mantisa >> 13;
|
||||
mantisa >>= 13;
|
||||
writeUI16((sign << 15) + (exponent << 10) + mantisa);
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
*/
|
||||
public void writeEncodedU32(long value) throws IOException {
|
||||
boolean loop = true;
|
||||
value = value & 0xFFFFFFFF;
|
||||
value &= 0xFFFFFFFF;
|
||||
do {
|
||||
int ret = (int) (value & 0x7F);
|
||||
if (value < 0x80) {
|
||||
@@ -258,7 +258,7 @@ public class SWFOutputStream extends OutputStream {
|
||||
ret += 0x80;
|
||||
}
|
||||
write(ret);
|
||||
value = value >> 7;
|
||||
value >>= 7;
|
||||
} while (loop);
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ public class TagNode {
|
||||
File dir = new File(outdir);
|
||||
List<File> ret = new ArrayList<>();
|
||||
if (!outdir.endsWith(File.separator)) {
|
||||
outdir = outdir + File.separator;
|
||||
outdir += File.separator;
|
||||
}
|
||||
List<String> existingNames = new ArrayList<>();
|
||||
for (TagNode node : nodeList) {
|
||||
|
||||
@@ -274,10 +274,10 @@ public class ABC {
|
||||
String pkg = "";
|
||||
String name = fullname;
|
||||
if (fullname.contains(".")) {
|
||||
pkg = fullname.substring(0, fullname.lastIndexOf("."));
|
||||
name = fullname.substring(fullname.lastIndexOf(".") + 1);
|
||||
pkg = fullname.substring(0, fullname.lastIndexOf('.'));
|
||||
name = fullname.substring(fullname.lastIndexOf('.') + 1);
|
||||
}
|
||||
if (!pkg.equals("")) {
|
||||
if (!pkg.isEmpty()) {
|
||||
int pkgStrIndex = constants.getStringId(pkg, true);
|
||||
pkgStrIndex = deobfuscatePackageName(stringUsageTypes, stringUsages, namesMap, pkgStrIndex, renameType);
|
||||
pkg = constants.constant_string[pkgStrIndex];
|
||||
@@ -286,7 +286,7 @@ public class ABC {
|
||||
nameStrIndex = deobfuscateName(stringUsageTypes, stringUsages, namespaceUsages, namesMap, nameStrIndex, true, renameType);
|
||||
name = constants.constant_string[nameStrIndex];
|
||||
String fullChanged = "";
|
||||
if (!pkg.equals("")) {
|
||||
if (!pkg.isEmpty()) {
|
||||
fullChanged = pkg + ".";
|
||||
}
|
||||
fullChanged += name;
|
||||
@@ -823,18 +823,18 @@ public class ABC {
|
||||
for (int i = 1; i < constants.constant_string.length; i++) {
|
||||
if (constants.constant_string[i].equals(ret)) {
|
||||
exists = true;
|
||||
rndSize = rndSize + 1;
|
||||
rndSize += 1;
|
||||
continue loopfoo;
|
||||
}
|
||||
}
|
||||
if (isReserved(ret)) {
|
||||
exists = true;
|
||||
rndSize = rndSize + 1;
|
||||
rndSize += 1;
|
||||
continue;
|
||||
}
|
||||
if (deobfuscated.containsValue(ret)) {
|
||||
exists = true;
|
||||
rndSize = rndSize + 1;
|
||||
rndSize += 1;
|
||||
continue;
|
||||
}
|
||||
} while (exists);
|
||||
|
||||
@@ -109,8 +109,8 @@ public class ABCInputStream extends InputStream {
|
||||
do {
|
||||
i = read();
|
||||
nextByte = (i >> 7) == 1;
|
||||
i = i & 0x7f;
|
||||
ret = ret + (i << bytePos);
|
||||
i &= 0x7f;
|
||||
ret += (i << bytePos);
|
||||
byteCount++;
|
||||
bytePos += 7;
|
||||
} while (nextByte);
|
||||
@@ -125,7 +125,7 @@ public class ABCInputStream extends InputStream {
|
||||
int ret = (read()) + (read() << 8) + (read() << 16);
|
||||
|
||||
if ((ret >> 23) == 1) {
|
||||
ret = ret | 0xff000000;
|
||||
ret |= 0xff000000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -144,8 +144,8 @@ public class ABCInputStream extends InputStream {
|
||||
do {
|
||||
i = read();
|
||||
nextByte = (i >> 7) == 1;
|
||||
i = i & 0x7f;
|
||||
ret = ret + (i << bytePos);
|
||||
i &= 0x7f;
|
||||
ret += (i << bytePos);
|
||||
byteCount++;
|
||||
bytePos += 7;
|
||||
if (bytePos == 35) {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ABCOutputStream extends OutputStream {
|
||||
|
||||
public void writeU32(long value) throws IOException {
|
||||
boolean loop = true;
|
||||
value = value & 0xFFFFFFFF;
|
||||
value &= 0xFFFFFFFF;
|
||||
do {
|
||||
int ret = (int) (value & 0x7F);
|
||||
if (value < 0x80) {
|
||||
@@ -70,17 +70,17 @@ public class ABCOutputStream extends OutputStream {
|
||||
ret += 0x80;
|
||||
}
|
||||
write(ret);
|
||||
value = value >> 7;
|
||||
value >>= 7;
|
||||
} while (loop);
|
||||
}
|
||||
|
||||
public void writeS24(long value) throws IOException {
|
||||
int ret = (int) (value & 0xff);
|
||||
write(ret);
|
||||
value = value >> 8;
|
||||
value >>= 8;
|
||||
ret = (int) (value & 0xff);
|
||||
write(ret);
|
||||
value = value >> 8;
|
||||
value >>= 8;
|
||||
ret = (int) (value & 0xff);
|
||||
write(ret);
|
||||
}
|
||||
@@ -107,13 +107,13 @@ public class ABCOutputStream extends OutputStream {
|
||||
}
|
||||
|
||||
if (bitcount == 35) {
|
||||
ret = ret & 0xf;
|
||||
ret &= 0xf;
|
||||
}
|
||||
write(ret);
|
||||
if (bitcount == 35) {
|
||||
break;
|
||||
}
|
||||
value = value >> 7;
|
||||
value >>= 7;
|
||||
} while (loop);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ClassPath {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (packageStr == null || packageStr.equals("")) ? className : packageStr + "." + className;
|
||||
return (packageStr == null || packageStr.isEmpty()) ? className : packageStr + "." + className;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ScriptPack {
|
||||
return packageName.equals("") ? scriptName : packageName + "." + scriptName;
|
||||
}*/
|
||||
private static String makeDirPath(String packageName) {
|
||||
if (packageName.equals("")) {
|
||||
if (packageName.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String[] pathParts;
|
||||
|
||||
@@ -254,7 +254,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem {
|
||||
if (ignored) {
|
||||
return " ;ignored";
|
||||
}
|
||||
if ((comment == null) || comment.equals("")) {
|
||||
if ((comment == null) || comment.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return " ;" + comment;
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ public class SetPropertyIns extends InstructionDefinition implements SetTypeIns
|
||||
int multinameIndex = ins.operands[0];
|
||||
String multiname = resolveMultinameNoPop(0, stack, abc.constants, multinameIndex, ins, fullyQualifiedNames);
|
||||
GraphTargetItem obj = stack.get(1 + resolvedCount(abc.constants, multinameIndex)); //pod vrcholem
|
||||
if ((!obj.toString().equals(""))) {
|
||||
if ((!obj.toString().isEmpty())) {
|
||||
multiname = "." + multiname;
|
||||
}
|
||||
return obj + multiname;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
|
||||
} else if (value instanceof Long) {
|
||||
bval = ((Long) value).longValue() != 0;
|
||||
} else if (value instanceof String) {
|
||||
bval = !((String) value).equals("");
|
||||
bval = !((String) value).isEmpty();
|
||||
} else {
|
||||
bval = true;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class FullMultinameAVM2Item extends AVM2Item {
|
||||
cns = ns.getName(constants);
|
||||
}
|
||||
}
|
||||
return cname.equals("XML") && cns.equals("");
|
||||
return cname.equals("XML") && cns.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,7 @@ public class NewFunctionAVM2Item extends AVM2Item {
|
||||
@Override
|
||||
protected GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
MethodBody body = abc.findBody(methodIndex);
|
||||
writer.append("function" + (!functionName.equals("") ? " " + functionName : ""));
|
||||
writer.append("function" + (!functionName.isEmpty() ? " " + functionName : ""));
|
||||
writer.startMethod(methodIndex);
|
||||
writer.appendNoHilight("(");
|
||||
methodInfo[methodIndex].getParamStr(writer, constants, body, abc, fullyQualifiedNames);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MethodInfoParser {
|
||||
nstype = nstype + symbValue.type + ":";
|
||||
}
|
||||
} while (symbValue.type >= 8 && symbValue.type <= 13);
|
||||
if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
|
||||
if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
|
||||
throw new ParseException("Namespace expected", lexer.yyline());
|
||||
}
|
||||
int id = 0;
|
||||
@@ -95,7 +95,7 @@ public class MethodInfoParser {
|
||||
value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs);
|
||||
} else if (nstype.equals("8:")) {
|
||||
value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs);
|
||||
} else if (nstype.equals("")) {
|
||||
} else if (nstype.isEmpty()) {
|
||||
value = new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace);
|
||||
} else {
|
||||
throw new ParseException("Invalid type of namespace", lexer.yyline());
|
||||
@@ -194,7 +194,7 @@ public class MethodInfoParser {
|
||||
nstype = nstype + symbValue.type + ":";
|
||||
}
|
||||
} while (symbValue.type >= 8 && symbValue.type <= 13);
|
||||
if ((!nstype.equals("")) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
|
||||
if ((!nstype.isEmpty()) && (symbValue.type != ParsedSymbol.TYPE_NAMESPACE)) {
|
||||
throw new ParseException("Namespace expected", lexer.yyline());
|
||||
}
|
||||
int id = 0;
|
||||
@@ -233,7 +233,7 @@ public class MethodInfoParser {
|
||||
optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_StaticProtectedNs));
|
||||
} else if (nstype.equals("8:")) {
|
||||
optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_PrivateNs));
|
||||
} else if (nstype.equals("")) {
|
||||
} else if (nstype.isEmpty()) {
|
||||
optionalValues.add(new ValueKind((int) (long) (Long) symbValue.value, ValueKind.CONSTANT_Namespace));
|
||||
} else {
|
||||
throw new ParseException("Invalid type of namespace", lexer.yyline());
|
||||
|
||||
@@ -72,7 +72,7 @@ public class InstanceInfo {
|
||||
String modifiers;
|
||||
Namespace ns = abc.constants.constant_multiname[name_index].getNamespace(abc.constants);
|
||||
modifiers = ns.getPrefix(abc);
|
||||
if (!modifiers.equals("")) {
|
||||
if (!modifiers.isEmpty()) {
|
||||
modifiers += " ";
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class InstanceInfo {
|
||||
modifiers += "final ";
|
||||
}
|
||||
if (isDynamic()) {
|
||||
modifiers = modifiers + "dynamic ";
|
||||
modifiers += "dynamic ";
|
||||
}
|
||||
String objType = "class ";
|
||||
if (isInterface()) {
|
||||
|
||||
@@ -257,7 +257,7 @@ public class Multiname {
|
||||
Namespace ns = getNamespace(constants);
|
||||
if (ns != null) {
|
||||
String nsname = ns.getName(constants);
|
||||
if (!nsname.equals("")) {
|
||||
if (!nsname.isEmpty()) {
|
||||
ret += nsname + ".";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class Namespace {
|
||||
public String getNameWithKind(ConstantPool constants) {
|
||||
String kindStr = getKindStr();
|
||||
String nameStr = constants.constant_string[name_index];
|
||||
return kindStr + (nameStr.equals("") ? "" : " " + nameStr);
|
||||
return kindStr + (nameStr.isEmpty() ? "" : " " + nameStr);
|
||||
}
|
||||
|
||||
public String getPrefix(ABC abc) {
|
||||
|
||||
@@ -63,9 +63,9 @@ public abstract class Trait implements Serializable {
|
||||
break;
|
||||
}
|
||||
if (nsname.contains(".")) {
|
||||
nsname = nsname.substring(nsname.lastIndexOf(".") + 1);
|
||||
nsname = nsname.substring(nsname.lastIndexOf('.') + 1);
|
||||
}
|
||||
if (!nsname.equals("")) {
|
||||
if (!nsname.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public abstract class Trait implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
if ((!nsname.equals("")) && (!nsname.equals("-"))) {
|
||||
if ((!nsname.isEmpty()) && (!nsname.equals("-"))) {
|
||||
} else {
|
||||
if (ns != null) {
|
||||
if (ns.kind == Namespace.KIND_NAMESPACE) {
|
||||
@@ -86,7 +86,7 @@ public abstract class Trait implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
if ((!nsname.contains(":")) && (!nsname.equals(""))) {
|
||||
if ((!nsname.contains(":")) && (!nsname.isEmpty())) {
|
||||
ret += " " + nsname;
|
||||
}
|
||||
if (ns != null) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
private boolean parseUsagesFromNS(List<ABCContainerTag> abcTags, ABC abc, List<String> imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
|
||||
Namespace ns = abc.constants.constant_namespace[namespace_index];
|
||||
if (name.equals("")) {
|
||||
if (name.isEmpty()) {
|
||||
name = "*";
|
||||
}
|
||||
String newimport = ns.getName(abc.constants);
|
||||
@@ -87,7 +87,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
if (newname.equals("-")) {
|
||||
return true;
|
||||
}
|
||||
if (!newname.equals("")) {
|
||||
if (!newname.isEmpty()) {
|
||||
newimport = newname;
|
||||
break;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
newimport = oldimport;
|
||||
newimport += "." + name;
|
||||
}
|
||||
if (newimport.equals("")) {
|
||||
if (newimport.isEmpty()) {
|
||||
newimport = null;
|
||||
}
|
||||
if (newimport != null) {
|
||||
@@ -110,11 +110,11 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
String pkg = "";
|
||||
if (newimport.contains(".")) {
|
||||
pkg = newimport.substring(0, newimport.lastIndexOf("."));
|
||||
pkg = newimport.substring(0, newimport.lastIndexOf('.'));
|
||||
}
|
||||
String usname = newimport;
|
||||
if (usname.contains(".")) {
|
||||
usname = usname.substring(usname.lastIndexOf(".") + 1);
|
||||
usname = usname.substring(usname.lastIndexOf('.') + 1);
|
||||
}
|
||||
if (ns.kind == Namespace.KIND_PACKAGE) {
|
||||
if (!pkg.equals(ignorePackage)) {
|
||||
@@ -140,7 +140,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
private void parseImportsUsagesFromNS(List<ABCContainerTag> abcTags, ABC abc, List<String> imports, List<String> uses, int namespace_index, String ignorePackage, String name) {
|
||||
Namespace ns = abc.constants.constant_namespace[namespace_index];
|
||||
if (name.equals("")) {
|
||||
if (name.isEmpty()) {
|
||||
name = "*";
|
||||
}
|
||||
String newimport = ns.getName(abc.constants);
|
||||
@@ -158,7 +158,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
return;
|
||||
}
|
||||
if (!imports.contains(newimport)) {
|
||||
String pkg = newimport.substring(0, newimport.lastIndexOf("."));
|
||||
String pkg = newimport.substring(0, newimport.lastIndexOf('.'));
|
||||
if (!pkg.equals(ignorePackage)) {
|
||||
imports.add(newimport);
|
||||
}
|
||||
@@ -348,8 +348,8 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
String pkg = "";
|
||||
String name = spath;
|
||||
if (spath.contains(".")) {
|
||||
pkg = spath.substring(0, spath.lastIndexOf("."));
|
||||
name = spath.substring(spath.lastIndexOf(".") + 1);
|
||||
pkg = spath.substring(0, spath.lastIndexOf('.'));
|
||||
name = spath.substring(spath.lastIndexOf('.') + 1);
|
||||
}
|
||||
if (pkg.equals(packageName)) {
|
||||
namesInThisPackage.add(name);
|
||||
@@ -371,10 +371,10 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
String name = ipath;
|
||||
String pkg = "";
|
||||
if (name.contains(".")) {
|
||||
pkg = name.substring(0, name.lastIndexOf("."));
|
||||
name = name.substring(name.lastIndexOf(".") + 1);
|
||||
pkg = name.substring(0, name.lastIndexOf('.'));
|
||||
name = name.substring(name.lastIndexOf('.') + 1);
|
||||
}
|
||||
if (importnames.contains(name) || ((!pkg.equals("")) && isBuiltInClass(name))) {
|
||||
if (importnames.contains(name) || ((!pkg.isEmpty()) && isBuiltInClass(name))) {
|
||||
fullyQualifiedNames.add(name);
|
||||
} else {
|
||||
importnames.add(name);
|
||||
@@ -397,8 +397,8 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
for (int i = 0; i < imports.size(); i++) {
|
||||
String imp = imports.get(i);
|
||||
String pkg = imp.substring(0, imp.lastIndexOf("."));
|
||||
String name = imp.substring(imp.lastIndexOf(".") + 1);
|
||||
String pkg = imp.substring(0, imp.lastIndexOf('.'));
|
||||
String name = imp.substring(imp.lastIndexOf('.') + 1);
|
||||
if (name.equals("*")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class Traits implements Serializable {
|
||||
int h = t;
|
||||
if (classIndex != -1) {
|
||||
if (!isStatic) {
|
||||
h = h + abc.class_info[classIndex].static_traits.traits.length;
|
||||
h += abc.class_info[classIndex].static_traits.traits.length;
|
||||
}
|
||||
}
|
||||
if (trait instanceof TraitClass) {
|
||||
|
||||
@@ -123,7 +123,7 @@ public class Action implements GraphSourceItem {
|
||||
"_ymouse"
|
||||
};
|
||||
public static final List<String> propertyNamesList = Arrays.asList(propertyNames);
|
||||
private static Logger logger = Logger.getLogger(Action.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(Action.class.getName());
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ActionGraph extends Graph {
|
||||
GraphTargetItem it = list.get(t);
|
||||
if (it instanceof SetTargetActionItem) {
|
||||
SetTargetActionItem st = (SetTargetActionItem) it;
|
||||
if (st.target.equals("")) {
|
||||
if (st.target.isEmpty()) {
|
||||
if (targetStart > -1) {
|
||||
targetEnd = t;
|
||||
break;
|
||||
|
||||
@@ -627,7 +627,7 @@ public class ActionListReader {
|
||||
}
|
||||
}
|
||||
|
||||
ip = ip + actionLengthWithHeader;
|
||||
ip += actionLengthWithHeader;
|
||||
|
||||
if (a.isExit()) {
|
||||
break;
|
||||
@@ -731,13 +731,16 @@ public class ActionListReader {
|
||||
System.out.print("newip " + nip + ", ");
|
||||
System.out.print("Action: jump(j),ignore(i),compute(c)?");
|
||||
String next = sc.next();
|
||||
if (next.equals("j")) {
|
||||
newip = pos + aif.getJumpOffset();
|
||||
pos = newip;
|
||||
|
||||
} else if (next.equals("i")) {
|
||||
} else if (next.equals("c")) {
|
||||
goaif = true;
|
||||
switch (next) {
|
||||
case "j":
|
||||
newip = pos + aif.getJumpOffset();
|
||||
pos = newip;
|
||||
break;
|
||||
case "i":
|
||||
break;
|
||||
case "c":
|
||||
goaif = true;
|
||||
break;
|
||||
}
|
||||
} else if (top.isCompileTime() && (!top.hasSideEffect())) {
|
||||
((ActionIf) a).compileTime = true;
|
||||
@@ -843,7 +846,7 @@ public class ActionListReader {
|
||||
if (newip > -1) {
|
||||
ip = newip;
|
||||
} else {
|
||||
ip = ip + info;
|
||||
ip += info;
|
||||
}
|
||||
pos = ip;
|
||||
if (goaif) {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class FunctionActionItem extends ActionItem {
|
||||
if (calculatedFunctionName != null) {
|
||||
writer.append(" ");
|
||||
calculatedFunctionName.toStringNoQuotes(writer, localData);
|
||||
} else if (!functionName.equals("")) {
|
||||
} else if (!functionName.isEmpty()) {
|
||||
writer.append(" ");
|
||||
writer.append(functionName);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class FunctionActionItem extends ActionItem {
|
||||
writer.append(", ");
|
||||
}
|
||||
String pname = paramNames.get(p);
|
||||
if (pname == null || pname.equals("")) {
|
||||
if (pname == null || pname.isEmpty()) {
|
||||
pname = new RegisterNumber(regStart + p).translate();
|
||||
}
|
||||
writer.append(pname);
|
||||
|
||||
@@ -1413,7 +1413,7 @@ public final class ActionScriptLexer {
|
||||
String s = yytext();
|
||||
s = s.substring(1, s.length() - 1);
|
||||
if (s.contains(" ")) {
|
||||
s = s.substring(0, s.indexOf(" "));
|
||||
s = s.substring(0, s.indexOf(' '));
|
||||
}
|
||||
xmlTagName = s;
|
||||
string.append(yytext());
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ActionGetURL extends Action {
|
||||
@Override
|
||||
public void translate(Stack<GraphTargetItem> stack, List<GraphTargetItem> output, java.util.HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
String fsCommandPrefix = "FSCommand:";
|
||||
if (urlString.startsWith(fsCommandPrefix) && targetString.equals("")) {
|
||||
if (urlString.startsWith(fsCommandPrefix) && targetString.isEmpty()) {
|
||||
String command = urlString.substring(fsCommandPrefix.length());
|
||||
output.add(new FSCommandActionItem(this, command));
|
||||
return;
|
||||
@@ -91,7 +91,7 @@ public class ActionGetURL extends Action {
|
||||
if (targetString.startsWith(levelPrefix)) {
|
||||
try {
|
||||
int num = Integer.valueOf(targetString.substring(levelPrefix.length()));
|
||||
if (urlString.equals("")) {
|
||||
if (urlString.isEmpty()) {
|
||||
output.add(new UnLoadMovieNumActionItem(this, new DirectValueActionItem((Long) (long) (int) num)));
|
||||
} else {
|
||||
DirectValueActionItem urlStringDi = new DirectValueActionItem(null, 0, urlString, new ArrayList<String>());
|
||||
@@ -103,7 +103,7 @@ public class ActionGetURL extends Action {
|
||||
|
||||
}
|
||||
|
||||
if (urlString.equals("")) {
|
||||
if (urlString.isEmpty()) {
|
||||
DirectValueActionItem targetStringDi = new DirectValueActionItem(null, 0, targetString, new ArrayList<String>());
|
||||
output.add(new UnLoadMovieActionItem(this, targetStringDi));
|
||||
} else {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class RegisterNumber implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (name == null || name.trim().equals("")) {
|
||||
if (name == null || name.trim().isEmpty()) {
|
||||
return toStringNoName();
|
||||
}
|
||||
return name;
|
||||
@@ -62,7 +62,7 @@ public class RegisterNumber implements Serializable {
|
||||
}
|
||||
|
||||
public String translate() {
|
||||
if (name == null || name.trim().equals("")) {
|
||||
if (name == null || name.trim().isEmpty()) {
|
||||
return "_loc" + number + "_";
|
||||
}
|
||||
return name;
|
||||
|
||||
@@ -116,31 +116,39 @@ public class CommandLineArgumentParser {
|
||||
AbortRetryIgnoreHandler handler = null;
|
||||
|
||||
String nextParam;
|
||||
OUTER:
|
||||
while (true) {
|
||||
nextParam = args.remove();
|
||||
if (nextParam.equals("-config")) {
|
||||
parseConfig(args);
|
||||
if (args.isEmpty()) {
|
||||
Main.saveConfig();
|
||||
System.out.println("Configuration saved");
|
||||
return null;
|
||||
}
|
||||
} else if (nextParam.equals("-onerror")) {
|
||||
handler = parseOnError(args);
|
||||
} else if (nextParam.equals("-timeout")) {
|
||||
parseTimeout(args);
|
||||
} else if (nextParam.equals("-affinity")) {
|
||||
parseAffinity(args);
|
||||
} else if (nextParam.equals("-priority")) {
|
||||
parsePriority(args);
|
||||
} else if (nextParam.equals("-verbose")) {
|
||||
traceLevel = Level.FINE;
|
||||
} else if (nextParam.equals("-debug")) {
|
||||
Configuration.debugMode = true;
|
||||
} else {
|
||||
break;
|
||||
switch (nextParam) {
|
||||
case "-config":
|
||||
parseConfig(args);
|
||||
if (args.isEmpty()) {
|
||||
Main.saveConfig();
|
||||
System.out.println("Configuration saved");
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
case "-onerror":
|
||||
handler = parseOnError(args);
|
||||
break;
|
||||
case "-timeout":
|
||||
parseTimeout(args);
|
||||
break;
|
||||
case "-affinity":
|
||||
parseAffinity(args);
|
||||
break;
|
||||
case "-priority":
|
||||
parsePriority(args);
|
||||
break;
|
||||
case "-verbose":
|
||||
traceLevel = Level.FINE;
|
||||
break;
|
||||
case "-debug":
|
||||
Configuration.debugMode = true;
|
||||
break;
|
||||
default:
|
||||
break OUTER;
|
||||
}
|
||||
|
||||
if (args.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -237,14 +245,15 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
|
||||
private static ExportMode strToExportFormat(String exportFormatStr) {
|
||||
if (exportFormatStr.equals("pcode")) {
|
||||
return ExportMode.PCODE;
|
||||
} else if (exportFormatStr.equals("pcodehex")) {
|
||||
return ExportMode.PCODEWITHHEX;
|
||||
} else if (exportFormatStr.equals("hex")) {
|
||||
return ExportMode.HEX;
|
||||
} else {
|
||||
return ExportMode.SOURCE;
|
||||
switch (exportFormatStr) {
|
||||
case "pcode":
|
||||
return ExportMode.PCODE;
|
||||
case "pcodehex":
|
||||
return ExportMode.PCODEWITHHEX;
|
||||
case "hex":
|
||||
return ExportMode.HEX;
|
||||
default:
|
||||
return ExportMode.SOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ public class EcmaScript {
|
||||
}
|
||||
if (o instanceof String) {
|
||||
String s = (String) o;
|
||||
return !s.equals("");
|
||||
return !s.isEmpty();
|
||||
}
|
||||
return true; //other Object
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class EcmaScript {
|
||||
return 0L;
|
||||
}
|
||||
Long posInt = (long) (double) (Math.signum(n) * Math.floor(Math.abs(n)));
|
||||
posInt = posInt % (1 << 32);
|
||||
posInt %= (1 << 32);
|
||||
return posInt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import javax.swing.JColorChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
public final class ImagePanel extends JPanel implements ActionListener, FlashDisplay {
|
||||
|
||||
public JLabel label = new JLabel();
|
||||
public DrawableTag drawable;
|
||||
|
||||
@@ -197,7 +197,7 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener {
|
||||
String search = searchField.getText();
|
||||
List<CacheEntry> filtered = new ArrayList<>();
|
||||
for (CacheEntry en : entries) {
|
||||
if (search.equals("") || en.getRequestURL().contains(search)) {
|
||||
if (search.isEmpty() || en.getRequestURL().contains(search)) {
|
||||
filtered.add(en);
|
||||
}
|
||||
}
|
||||
@@ -208,11 +208,11 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener {
|
||||
String ret = en.getRequestURL();
|
||||
//Strip parameters
|
||||
if (ret.contains("?")) {
|
||||
ret = ret.substring(0, ret.indexOf("?"));
|
||||
ret = ret.substring(0, ret.indexOf('?'));
|
||||
}
|
||||
//Strip path
|
||||
if (ret.contains("/")) {
|
||||
ret = ret.substring(ret.lastIndexOf("/") + 1);
|
||||
ret = ret.substring(ret.lastIndexOf('/') + 1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -993,8 +993,8 @@ public class Main {
|
||||
}
|
||||
} else {
|
||||
if (s.contains("=")) {
|
||||
String key = s.substring(0, s.indexOf("="));
|
||||
String val = s.substring(s.indexOf("=") + 1);
|
||||
String key = s.substring(0, s.indexOf('='));
|
||||
String val = s.substring(s.indexOf('=') + 1);
|
||||
if ("updateSystem".equals(header)) {
|
||||
if (key.equals("majorVersion")) {
|
||||
updateMajor = Integer.parseInt(val);
|
||||
@@ -1029,8 +1029,8 @@ public class Main {
|
||||
ver.updateLink = val;
|
||||
}
|
||||
if (key.equals("change[]")) {
|
||||
String changeType = val.substring(0, val.indexOf("|"));
|
||||
String change = val.substring(val.indexOf("|") + 1);
|
||||
String changeType = val.substring(0, val.indexOf('|'));
|
||||
String change = val.substring(val.indexOf('|') + 1);
|
||||
if (!ver.changes.containsKey(changeType)) {
|
||||
ver.changes.put(changeType, new ArrayList<String>());
|
||||
}
|
||||
@@ -1041,7 +1041,7 @@ public class Main {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s.equals("")) {
|
||||
if (s.isEmpty()) {
|
||||
start = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationM
|
||||
*
|
||||
* @author Jindra
|
||||
*/
|
||||
public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed {
|
||||
public final class MainFrame extends AppRibbonFrame implements ActionListener, TreeSelectionListener, Freed {
|
||||
|
||||
private SWF swf;
|
||||
public ABCPanel abcPanel;
|
||||
@@ -340,7 +340,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
}
|
||||
|
||||
public void setWorkStatus(String s, Runnable cancelCallback) {
|
||||
if (s.equals("")) {
|
||||
if (s.isEmpty()) {
|
||||
loadingPanel.setVisible(false);
|
||||
} else {
|
||||
loadingPanel.setVisible(true);
|
||||
@@ -573,10 +573,10 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
|
||||
int state = 0;
|
||||
if (maximizedHorizontal) {
|
||||
state = state | JFrame.MAXIMIZED_HORIZ;
|
||||
state |= JFrame.MAXIMIZED_HORIZ;
|
||||
}
|
||||
if (maximizedVertical) {
|
||||
state = state | JFrame.MAXIMIZED_VERT;
|
||||
state |= JFrame.MAXIMIZED_VERT;
|
||||
}
|
||||
setExtendedState(state);
|
||||
|
||||
@@ -914,9 +914,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
files.clear();
|
||||
|
||||
File[] fs = ftemp.listFiles();
|
||||
for (File f : fs) {
|
||||
files.add(f);
|
||||
}
|
||||
files.addAll(Arrays.asList(fs));
|
||||
|
||||
Main.stopWork();
|
||||
} catch (IOException ex) {
|
||||
@@ -2188,7 +2186,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
ret.addAll(swf.exportTexts(handler, selFile + File.separator + "texts", texts, isFormatted));
|
||||
ret.addAll(swf.exportMovies(handler, selFile + File.separator + "movies", movies));
|
||||
ret.addAll(swf.exportSounds(handler, selFile + File.separator + "sounds", sounds, isMp3OrWav, isMp3OrWav));
|
||||
ret.addAll(swf.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData));
|
||||
ret.addAll(SWF.exportBinaryData(handler, selFile + File.separator + "binaryData", binaryData));
|
||||
if (abcPanel != null) {
|
||||
for (int i = 0; i < tlsList.size(); i++) {
|
||||
ScriptPack tls = tlsList.get(i);
|
||||
@@ -2406,7 +2404,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
searchDialog.setVisible(true);
|
||||
if (searchDialog.result) {
|
||||
final String txt = searchDialog.searchField.getText();
|
||||
if (!txt.equals("")) {
|
||||
if (!txt.isEmpty()) {
|
||||
if (abcPanel != null) {
|
||||
(new Thread() {
|
||||
@Override
|
||||
@@ -3241,8 +3239,8 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
mat.translateX = mat.translateX + width / 2 - r.getWidth() / 2;
|
||||
mat.translateY = mat.translateY + height / 2 - r.getHeight() / 2;
|
||||
} else {
|
||||
mat.translateX = mat.translateX + width / 2;
|
||||
mat.translateY = mat.translateY + height / 2;
|
||||
mat.translateX += width / 2;
|
||||
mat.translateY += height / 2;
|
||||
}
|
||||
sos2.writeTag(new PlaceObject2Tag(null, false, false, false, false, false, true, false, true, depth, chid, mat, null, 0, null, 0, null));
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Fr
|
||||
public JLabel scriptNameLabel;
|
||||
|
||||
public boolean search(String txt, boolean ignoreCase, boolean regexp) {
|
||||
if ((txt != null) && (!txt.equals(""))) {
|
||||
if ((txt != null) && (!txt.isEmpty())) {
|
||||
searchIgnoreCase = ignoreCase;
|
||||
searchRegexp = regexp;
|
||||
ClassesListTreeModel clModel = (ClassesListTreeModel) classTree.getModel();
|
||||
|
||||
@@ -35,7 +35,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
import javax.swing.tree.TreePath;
|
||||
import javax.swing.tree.TreeSelectionModel;
|
||||
|
||||
public class ClassesListTree extends JTree implements TreeSelectionListener {
|
||||
public final class ClassesListTree extends JTree implements TreeSelectionListener {
|
||||
|
||||
private List<ABCContainerTag> abcList;
|
||||
public List<MyEntry<ClassPath, ScriptPack>> treeList;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class ClassesListTreeModel implements TreeModel {
|
||||
public ClassesListTreeModel(List<MyEntry<ClassPath, ScriptPack>> list, String filter) {
|
||||
for (MyEntry<ClassPath, ScriptPack> item : list) {
|
||||
if (filter != null) {
|
||||
if (!filter.equals("")) {
|
||||
if (!filter.isEmpty()) {
|
||||
if (!item.key.toString().contains(filter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener {
|
||||
for (int i = 0; i < accessStrings.length; i++) {
|
||||
String pref = Namespace.kindToPrefix(modifiers[i]);
|
||||
String name = Namespace.kindToStr(modifiers[i]);
|
||||
accessStrings[i] = (pref.equals("") ? "" : pref + " ") + "(" + name + ")";
|
||||
accessStrings[i] = (pref.isEmpty() ? "" : pref + " ") + "(" + name + ")";
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ public class NewTraitDialog extends AppDialog implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case "OK":
|
||||
if (nameField.getText().trim().equals("")) {
|
||||
if (nameField.getText().trim().isEmpty()) {
|
||||
View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
import javax.swing.ListModel;
|
||||
import javax.swing.event.ListDataListener;
|
||||
|
||||
public class TraitsListModel implements ListModel {
|
||||
public final class TraitsListModel implements ListModel {
|
||||
|
||||
private List<TraitsListItem> items;
|
||||
private List<ABCContainerTag> abcTags;
|
||||
|
||||
@@ -53,14 +53,12 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.logging.Level;
|
||||
@@ -208,10 +206,10 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
}
|
||||
|
||||
public boolean search(String txt, boolean ignoreCase, boolean regexp) {
|
||||
if ((txt != null) && (!txt.equals(""))) {
|
||||
if ((txt != null) && (!txt.isEmpty())) {
|
||||
searchIgnoreCase = ignoreCase;
|
||||
searchRegexp = regexp;
|
||||
List<TagNode> list = Main.swf.createASTagList(Main.swf.tags, null);
|
||||
List<TagNode> list = SWF.createASTagList(Main.swf.tags, null);
|
||||
Map<String, ASMSource> asms = getASMs("", list);
|
||||
found = new ArrayList<>();
|
||||
Pattern pat = null;
|
||||
@@ -293,7 +291,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
|
||||
public void setHex(ExportMode exportMode) {
|
||||
if (exportMode != ExportMode.HEX) {
|
||||
if (exportMode == exportMode.PCODE) {
|
||||
if (exportMode == ExportMode.PCODE) {
|
||||
if (srcNoHex == null) {
|
||||
srcNoHex = getHilightedText(exportMode);
|
||||
}
|
||||
@@ -702,63 +700,73 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
foundPos = (foundPos + 1) % found.size();
|
||||
updateSearchPos();
|
||||
}
|
||||
if (e.getActionCommand().equals("GRAPH")) {
|
||||
if (lastCode != null) {
|
||||
try {
|
||||
GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), SWF.DEFAULT_VERSION), "");
|
||||
gf.setVisible(true);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
switch (e.getActionCommand()) {
|
||||
case "GRAPH":
|
||||
if (lastCode != null) {
|
||||
try {
|
||||
GraphFrame gf = new GraphFrame(new ActionGraph(lastCode, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), SWF.DEFAULT_VERSION), "");
|
||||
gf.setVisible(true);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (e.getActionCommand().equals("EDITACTION")) {
|
||||
setEditMode(true);
|
||||
} else if (e.getActionCommand().equals("HEX") || e.getActionCommand().equals("HEXONLY")) {
|
||||
if (e.getActionCommand().equals("HEX")) {
|
||||
hexOnlyButton.setSelected(false);
|
||||
} else {
|
||||
hexButton.setSelected(false);
|
||||
}
|
||||
setHex(getExportMode());
|
||||
} else if (e.getActionCommand().equals("CANCELACTION")) {
|
||||
setEditMode(false);
|
||||
setHex(getExportMode());
|
||||
} else if (e.getActionCommand().equals("SAVEACTION")) {
|
||||
try {
|
||||
String text = editor.getText();
|
||||
if (text.trim().startsWith("#hexdata")) {
|
||||
src.setActionBytes(Helper.getBytesFromHexaText(text));
|
||||
break;
|
||||
case "EDITACTION":
|
||||
setEditMode(true);
|
||||
break;
|
||||
case "HEX":
|
||||
case "HEXONLY":
|
||||
if (e.getActionCommand().equals("HEX")) {
|
||||
hexOnlyButton.setSelected(false);
|
||||
} else {
|
||||
src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION);
|
||||
hexButton.setSelected(false);
|
||||
}
|
||||
setSource(this.src, false);
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
saveButton.setVisible(false);
|
||||
cancelButton.setVisible(false);
|
||||
editButton.setVisible(true);
|
||||
editor.setEditable(false);
|
||||
editMode = false;
|
||||
} catch (IOException ex) {
|
||||
} catch (ParseException ex) {
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
} else if (e.getActionCommand().equals("EDITDECOMPILED")) {
|
||||
setDecompiledEditMode(true);
|
||||
} else if (e.getActionCommand().equals("CANCELDECOMPILED")) {
|
||||
setDecompiledEditMode(false);
|
||||
} else if (e.getActionCommand().equals("SAVEDECOMPILED")) {
|
||||
try {
|
||||
ActionScriptParser par = new ActionScriptParser();
|
||||
src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION);
|
||||
setSource(this.src, false);
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
setHex(getExportMode());
|
||||
break;
|
||||
case "CANCELACTION":
|
||||
setEditMode(false);
|
||||
setHex(getExportMode());
|
||||
break;
|
||||
case "SAVEACTION":
|
||||
try {
|
||||
String text = editor.getText();
|
||||
if (text.trim().startsWith("#hexdata")) {
|
||||
src.setActionBytes(Helper.getBytesFromHexaText(text));
|
||||
} else {
|
||||
src.setActions(ASMParser.parse(0, src.getPos(), true, text, SWF.DEFAULT_VERSION, false), SWF.DEFAULT_VERSION);
|
||||
}
|
||||
setSource(this.src, false);
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
saveButton.setVisible(false);
|
||||
cancelButton.setVisible(false);
|
||||
editButton.setVisible(true);
|
||||
editor.setEditable(false);
|
||||
editMode = false;
|
||||
} catch (IOException ex) {
|
||||
} catch (ParseException ex) {
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
break;
|
||||
case "EDITDECOMPILED":
|
||||
setDecompiledEditMode(true);
|
||||
break;
|
||||
case "CANCELDECOMPILED":
|
||||
setDecompiledEditMode(false);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex);
|
||||
} catch (ParseException ex) {
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
break;
|
||||
case "SAVEDECOMPILED":
|
||||
try {
|
||||
ActionScriptParser par = new ActionScriptParser();
|
||||
src.setActions(par.actionsFromString(decompiledEditor.getText()), SWF.DEFAULT_VERSION);
|
||||
setSource(this.src, false);
|
||||
|
||||
View.showMessageDialog(this, AppStrings.translate("message.action.saved"));
|
||||
setDecompiledEditMode(false);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex);
|
||||
} catch (ParseException ex) {
|
||||
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", "" + ex.line), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,11 +102,11 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
|
||||
private String formatMs(long ms) {
|
||||
long s = ms / 1000;
|
||||
ms = ms % 1000;
|
||||
ms %= 1000;
|
||||
long m = s / 60;
|
||||
s = s % 60;
|
||||
s %= 60;
|
||||
long h = m / 60;
|
||||
m = m % 60;
|
||||
m %= 60;
|
||||
return "" + (h > 0 ? h + ":" : "") + pad(m) + ":" + pad(s) + "." + pad(ms / 10);
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
|
||||
public void catched(String contentType, String url, InputStream data) {
|
||||
boolean swfOnly = false;
|
||||
if (contentType.contains(";")) {
|
||||
contentType = contentType.substring(0, contentType.indexOf(";"));
|
||||
contentType = contentType.substring(0, contentType.indexOf(';'));
|
||||
}
|
||||
if ((!sniffSWFCheckBox.isSelected()) && (contentType.equals("application/x-shockwave-flash"))) {
|
||||
return;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag {
|
||||
int a = (argb >> 24) & 0xff;
|
||||
int r = (argb >> 16) & 0xff;
|
||||
int g = (argb >> 8) & 0xff;
|
||||
int b = (argb >> 0) & 0xff;
|
||||
int b = (argb) & 0xff;
|
||||
|
||||
r = r * a / 255;
|
||||
g = g * a / 255;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag {
|
||||
//int a = (argb >> 24) & 0xff;
|
||||
int r = (argb >> 16) & 0xff;
|
||||
int g = (argb >> 8) & 0xff;
|
||||
int b = (argb >> 0) & 0xff;
|
||||
int b = (argb) & 0xff;
|
||||
bitmapData.bitmapPixelDataPix24[pos] = new PIX24();
|
||||
bitmapData.bitmapPixelDataPix24[pos].red = r;
|
||||
bitmapData.bitmapPixelDataPix24[pos].green = g;
|
||||
|
||||
@@ -112,7 +112,7 @@ public class DefineEditTextTag extends TextTag {
|
||||
continue;
|
||||
}
|
||||
if (!intag) {
|
||||
outp = outp + inp.charAt(i);
|
||||
outp += inp.charAt(i);
|
||||
}
|
||||
}
|
||||
return outp;
|
||||
@@ -154,8 +154,8 @@ public class DefineEditTextTag extends TextTag {
|
||||
+ (hasFontClass ? "fontclass " + fontClass + "\r\n" : "") + (hasMaxLength ? "maxlength " + maxLength + "\r\n" : "")
|
||||
+ "align " + alignValues[align] + "\r\n"
|
||||
+ (hasLayout ? "leftmargin " + leftMargin + "\r\nrightmargin " + rightMargin + "\r\nindent " + indent + "\r\nleading " + leading + "\r\n" : "")
|
||||
+ (!variableName.equals("") ? "variablename " + variableName + "\r\n" : "");
|
||||
ret = ret + "]";
|
||||
+ (!variableName.isEmpty() ? "variablename " + variableName + "\r\n" : "");
|
||||
ret += "]";
|
||||
if (hasText) {
|
||||
ret += initialText.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]");
|
||||
}
|
||||
@@ -196,140 +196,170 @@ public class DefineEditTextTag extends TextTag {
|
||||
case PARAMETER:
|
||||
String paramName = (String) s.values[0];
|
||||
String paramValue = (String) s.values[1];
|
||||
if (paramName.equals("xmin")) {
|
||||
try {
|
||||
bounds.Xmin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("ymin")) {
|
||||
try {
|
||||
bounds.Ymin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("xmax")) {
|
||||
try {
|
||||
bounds.Xmax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("ymax")) {
|
||||
try {
|
||||
bounds.Ymax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("wordwrap")) {
|
||||
if (paramValue.equals("1")) {
|
||||
wordWrap = true;
|
||||
}
|
||||
} else if (paramName.equals("multiline")) {
|
||||
if (paramValue.equals("1")) {
|
||||
multiline = true;
|
||||
}
|
||||
} else if (paramName.equals("password")) {
|
||||
if (paramValue.equals("1")) {
|
||||
password = true;
|
||||
}
|
||||
} else if (paramName.equals("readonly")) {
|
||||
if (paramValue.equals("1")) {
|
||||
readOnly = true;
|
||||
}
|
||||
} else if (paramName.equals("autosize")) {
|
||||
if (paramValue.equals("1")) {
|
||||
autoSize = true;
|
||||
}
|
||||
} else if (paramName.equals("noselect")) {
|
||||
if (paramValue.equals("1")) {
|
||||
noSelect = true;
|
||||
}
|
||||
} else if (paramName.equals("border")) {
|
||||
if (paramValue.equals("1")) {
|
||||
border = true;
|
||||
}
|
||||
} else if (paramName.equals("wasstatic")) {
|
||||
if (paramValue.equals("1")) {
|
||||
wasStatic = true;
|
||||
}
|
||||
} else if (paramName.equals("html")) {
|
||||
if (paramValue.equals("1")) {
|
||||
html = true;
|
||||
}
|
||||
} else if (paramName.equals("useoutlines")) {
|
||||
if (paramValue.equals("1")) {
|
||||
useOutlines = true;
|
||||
}
|
||||
} else if (paramName.equals("font")) {
|
||||
try {
|
||||
fontId = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid font value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("fontclass")) {
|
||||
fontClass = paramValue;
|
||||
} else if (paramName.equals("height")) {
|
||||
try {
|
||||
fontHeight = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid height value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("color")) {
|
||||
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
|
||||
if (m.matches()) {
|
||||
textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16));
|
||||
} else {
|
||||
throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("maxlength")) {
|
||||
try {
|
||||
maxLength = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("align")) {
|
||||
if (paramValue.equals("left")) {
|
||||
align = 0;
|
||||
} else if (paramValue.equals("right")) {
|
||||
align = 1;
|
||||
} else if (paramValue.equals("center")) {
|
||||
align = 2;
|
||||
} else if (paramValue.equals("justify")) {
|
||||
align = 3;
|
||||
} else {
|
||||
throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline());
|
||||
}
|
||||
|
||||
} else if (paramName.equals("leftmargin")) {
|
||||
try {
|
||||
leftMargin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("rightmargin")) {
|
||||
try {
|
||||
rightMargin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("indent")) {
|
||||
try {
|
||||
indent = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid indent value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("leading")) {
|
||||
try {
|
||||
leading = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid leading value. Number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("variablename")) {
|
||||
variableName = paramValue;
|
||||
} else {
|
||||
throw new ParseException("Unrecognized parameter name", lexer.yyline());
|
||||
switch (paramName) {
|
||||
case "xmin":
|
||||
try {
|
||||
bounds.Xmin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "ymin":
|
||||
try {
|
||||
bounds.Ymin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "xmax":
|
||||
try {
|
||||
bounds.Xmax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmax value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "ymax":
|
||||
try {
|
||||
bounds.Ymax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymax value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "wordwrap":
|
||||
if (paramValue.equals("1")) {
|
||||
wordWrap = true;
|
||||
}
|
||||
break;
|
||||
case "multiline":
|
||||
if (paramValue.equals("1")) {
|
||||
multiline = true;
|
||||
}
|
||||
break;
|
||||
case "password":
|
||||
if (paramValue.equals("1")) {
|
||||
password = true;
|
||||
}
|
||||
break;
|
||||
case "readonly":
|
||||
if (paramValue.equals("1")) {
|
||||
readOnly = true;
|
||||
}
|
||||
break;
|
||||
case "autosize":
|
||||
if (paramValue.equals("1")) {
|
||||
autoSize = true;
|
||||
}
|
||||
break;
|
||||
case "noselect":
|
||||
if (paramValue.equals("1")) {
|
||||
noSelect = true;
|
||||
}
|
||||
break;
|
||||
case "border":
|
||||
if (paramValue.equals("1")) {
|
||||
border = true;
|
||||
}
|
||||
break;
|
||||
case "wasstatic":
|
||||
if (paramValue.equals("1")) {
|
||||
wasStatic = true;
|
||||
}
|
||||
break;
|
||||
case "html":
|
||||
if (paramValue.equals("1")) {
|
||||
html = true;
|
||||
}
|
||||
break;
|
||||
case "useoutlines":
|
||||
if (paramValue.equals("1")) {
|
||||
useOutlines = true;
|
||||
}
|
||||
break;
|
||||
case "font":
|
||||
try {
|
||||
fontId = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid font value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "fontclass":
|
||||
fontClass = paramValue;
|
||||
break;
|
||||
case "height":
|
||||
try {
|
||||
fontHeight = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid height value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "color":
|
||||
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
|
||||
if (m.matches()) {
|
||||
textColor = new RGBA(Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16), Integer.parseInt(m.group(4), 16), Integer.parseInt(m.group(1), 16));
|
||||
} else {
|
||||
throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "maxlength":
|
||||
try {
|
||||
maxLength = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid maxLength value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "align":
|
||||
switch (paramValue) {
|
||||
case "left":
|
||||
align = 0;
|
||||
break;
|
||||
case "right":
|
||||
align = 1;
|
||||
break;
|
||||
case "center":
|
||||
align = 2;
|
||||
break;
|
||||
case "justify":
|
||||
align = 3;
|
||||
break;
|
||||
default:
|
||||
throw new ParseException("Invalid align value. Expected one of: left,right,center or justify.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "leftmargin":
|
||||
try {
|
||||
leftMargin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid leftmargin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "rightmargin":
|
||||
try {
|
||||
rightMargin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid rightmargin value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "indent":
|
||||
try {
|
||||
indent = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid indent value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "leading":
|
||||
try {
|
||||
leading = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException ne) {
|
||||
throw new ParseException("Invalid leading value. Number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "variablename":
|
||||
variableName = paramValue;
|
||||
break;
|
||||
default:
|
||||
throw new ParseException("Unrecognized parameter name", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case TEXT:
|
||||
text += (String) s.values[0];
|
||||
break;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DefineText2Tag extends TextTag implements DrawableTag {
|
||||
}
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) {
|
||||
if (!ret.equals("")) {
|
||||
if (!ret.isEmpty()) {
|
||||
ret += "\r\n";
|
||||
}
|
||||
}
|
||||
@@ -189,112 +189,125 @@ public class DefineText2Tag extends TextTag implements DrawableTag {
|
||||
throw new ParseException("Invalid color. Valid format is #aarrggbb.", lexer.yyline());
|
||||
}
|
||||
}
|
||||
if (paramName.equals("font")) {
|
||||
try {
|
||||
fontId = Integer.parseInt(paramValue);
|
||||
switch (paramName) {
|
||||
case "font":
|
||||
try {
|
||||
fontId = Integer.parseInt(paramValue);
|
||||
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == fontId) {
|
||||
font = (FontTag) t;
|
||||
break;
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == fontId) {
|
||||
font = (FontTag) t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not found", lexer.yyline());
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("height")) {
|
||||
try {
|
||||
textHeight = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("x")) {
|
||||
|
||||
try {
|
||||
x = Integer.parseInt(paramValue);
|
||||
currentX = x;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("y")) {
|
||||
|
||||
try {
|
||||
y = Integer.parseInt(paramValue);
|
||||
currentY = y;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("xmin")) {
|
||||
try {
|
||||
textBounds.Xmin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("xmax")) {
|
||||
try {
|
||||
textBounds.Xmax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("ymin")) {
|
||||
try {
|
||||
textBounds.Ymin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("ymax")) {
|
||||
try {
|
||||
textBounds.Ymax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("scalex")) {
|
||||
try {
|
||||
textMatrix.scaleX = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("scaley")) {
|
||||
try {
|
||||
textMatrix.scaleY = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("rotateskew0")) {
|
||||
try {
|
||||
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("rotateskew1")) {
|
||||
try {
|
||||
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("translatex")) {
|
||||
try {
|
||||
textMatrix.translateX = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("translatey")) {
|
||||
try {
|
||||
textMatrix.translateY = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not found", lexer.yyline());
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "height":
|
||||
try {
|
||||
textHeight = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "x":
|
||||
try {
|
||||
x = Integer.parseInt(paramValue);
|
||||
currentX = x;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "y":
|
||||
try {
|
||||
y = Integer.parseInt(paramValue);
|
||||
currentY = y;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "xmin":
|
||||
try {
|
||||
textBounds.Xmin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "xmax":
|
||||
try {
|
||||
textBounds.Xmax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "ymin":
|
||||
try {
|
||||
textBounds.Ymin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "ymax":
|
||||
try {
|
||||
textBounds.Ymax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "scalex":
|
||||
try {
|
||||
textMatrix.scaleX = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "scaley":
|
||||
try {
|
||||
textMatrix.scaleY = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "rotateskew0":
|
||||
try {
|
||||
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "rotateskew1":
|
||||
try {
|
||||
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "translatex":
|
||||
try {
|
||||
textMatrix.translateX = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "translatey":
|
||||
try {
|
||||
textMatrix.translateY = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TEXT:
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not defined", lexer.yyline());
|
||||
|
||||
@@ -96,7 +96,7 @@ public class DefineTextTag extends TextTag implements DrawableTag {
|
||||
}
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset || rec.styleFlagsHasYOffset) {
|
||||
if (!ret.equals("")) {
|
||||
if (!ret.isEmpty()) {
|
||||
ret += "\r\n";
|
||||
}
|
||||
}
|
||||
@@ -181,119 +181,133 @@ public class DefineTextTag extends TextTag implements DrawableTag {
|
||||
case PARAMETER:
|
||||
String paramName = (String) s.values[0];
|
||||
String paramValue = (String) s.values[1];
|
||||
if (paramName.equals("color")) {
|
||||
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
|
||||
if (m.matches()) {
|
||||
color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16));
|
||||
} else {
|
||||
throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("font")) {
|
||||
try {
|
||||
fontId = Integer.parseInt(paramValue);
|
||||
switch (paramName) {
|
||||
case "color":
|
||||
Matcher m = Pattern.compile("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])").matcher(paramValue);
|
||||
if (m.matches()) {
|
||||
color = new RGB(Integer.parseInt(m.group(1), 16), Integer.parseInt(m.group(2), 16), Integer.parseInt(m.group(3), 16));
|
||||
} else {
|
||||
throw new ParseException("Invalid color. Valid format is #rrggbb.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "font":
|
||||
try {
|
||||
fontId = Integer.parseInt(paramValue);
|
||||
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == fontId) {
|
||||
font = (FontTag) t;
|
||||
break;
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof FontTag) {
|
||||
if (((FontTag) t).getFontId() == fontId) {
|
||||
font = (FontTag) t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not found", lexer.yyline());
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("height")) {
|
||||
try {
|
||||
textHeight = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("x")) {
|
||||
|
||||
try {
|
||||
x = Integer.parseInt(paramValue);
|
||||
currentX = x;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("y")) {
|
||||
|
||||
try {
|
||||
y = Integer.parseInt(paramValue);
|
||||
currentY = y;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("xmin")) {
|
||||
try {
|
||||
textBounds.Xmin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("xmax")) {
|
||||
try {
|
||||
textBounds.Xmax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("ymin")) {
|
||||
try {
|
||||
textBounds.Ymin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("ymax")) {
|
||||
try {
|
||||
textBounds.Ymax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("scalex")) {
|
||||
try {
|
||||
textMatrix.scaleX = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("scaley")) {
|
||||
try {
|
||||
textMatrix.scaleY = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("rotateskew0")) {
|
||||
try {
|
||||
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("rotateskew1")) {
|
||||
try {
|
||||
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("translatex")) {
|
||||
try {
|
||||
textMatrix.translateX = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
|
||||
}
|
||||
} else if (paramName.equals("translatey")) {
|
||||
try {
|
||||
textMatrix.translateY = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not found", lexer.yyline());
|
||||
}
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font id - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "height":
|
||||
try {
|
||||
textHeight = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid font height - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "x":
|
||||
try {
|
||||
x = Integer.parseInt(paramValue);
|
||||
currentX = x;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid x position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "y":
|
||||
try {
|
||||
y = Integer.parseInt(paramValue);
|
||||
currentY = y;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid y position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "xmin":
|
||||
try {
|
||||
textBounds.Xmin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmin position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "xmax":
|
||||
try {
|
||||
textBounds.Xmax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid xmax position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "ymin":
|
||||
try {
|
||||
textBounds.Ymin = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymin position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "ymax":
|
||||
try {
|
||||
textBounds.Ymax = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid ymax position - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "scalex":
|
||||
try {
|
||||
textMatrix.scaleX = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "scaley":
|
||||
try {
|
||||
textMatrix.scaleY = Integer.parseInt(paramValue);
|
||||
textMatrix.hasScale = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid scalex value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "rotateskew0":
|
||||
try {
|
||||
textMatrix.rotateSkew0 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew0 value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "rotateskew1":
|
||||
try {
|
||||
textMatrix.rotateSkew1 = Integer.parseInt(paramValue);
|
||||
textMatrix.hasRotate = true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid rotateskew1 value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "translatex":
|
||||
try {
|
||||
textMatrix.translateX = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatex value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
case "translatey":
|
||||
try {
|
||||
textMatrix.translateY = Integer.parseInt(paramValue);
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new ParseException("Invalid translatey value - number expected.", lexer.yyline());
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TEXT:
|
||||
if (font == null) {
|
||||
throw new ParseException("Font not defined", lexer.yyline());
|
||||
|
||||
@@ -176,7 +176,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
|
||||
@Override
|
||||
public String getExportFileName(List<Tag> tags) {
|
||||
String expName = getExportName();
|
||||
if ((expName == null) || expName.equals("")) {
|
||||
if ((expName == null) || expName.isEmpty()) {
|
||||
return super.toString();
|
||||
}
|
||||
String[] pathParts;
|
||||
@@ -191,7 +191,7 @@ public class DoInitActionTag extends CharacterIdTag implements ASMSource {
|
||||
@Override
|
||||
public String toString() {
|
||||
String expName = getExportName();
|
||||
if ((expName == null) || expName.equals("")) {
|
||||
if ((expName == null) || expName.isEmpty()) {
|
||||
return super.toString();
|
||||
}
|
||||
String[] pathParts;
|
||||
|
||||
@@ -66,11 +66,11 @@ public abstract class CharacterIdTag extends Tag {
|
||||
|
||||
@Override
|
||||
public String getExportFileName(List<Tag> tags) {
|
||||
return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : "");
|
||||
return super.getName(tags) + "_" + getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : "");
|
||||
}
|
||||
|
||||
public String getCharacterExportFileName() {
|
||||
return getCharacterId() + (((exportName != null) && (!exportName.equals(""))) ? "_" + exportName : "");
|
||||
return getCharacterId() + (((exportName != null) && (!exportName.isEmpty())) ? "_" + exportName : "");
|
||||
}
|
||||
|
||||
public String getExportName() {
|
||||
|
||||
@@ -163,7 +163,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
|
||||
return fontName;
|
||||
}
|
||||
if (fontName.contains("_")) {
|
||||
String beforeUnderscore = fontName.substring(0, fontName.indexOf("_"));
|
||||
String beforeUnderscore = fontName.substring(0, fontName.indexOf('_'));
|
||||
if (fontNames.contains(beforeUnderscore)) {
|
||||
return beforeUnderscore;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
|
||||
return fontName;
|
||||
}
|
||||
if (fontName.contains("_")) {
|
||||
String beforeUnderscore = fontName.substring(0, fontName.indexOf("_"));
|
||||
String beforeUnderscore = fontName.substring(0, fontName.indexOf('_'));
|
||||
if (fontNames.contains(beforeUnderscore)) {
|
||||
return beforeUnderscore;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ import javax.swing.JPanel;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineCompactedFont extends FontTag implements DrawableTag {
|
||||
public final class DefineCompactedFont extends FontTag implements DrawableTag {
|
||||
|
||||
public static final int ID = 1005;
|
||||
public int fontId;
|
||||
|
||||
@@ -96,10 +96,7 @@ public class Filtering {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++) {
|
||||
pixels[index + x] = newColors[x];
|
||||
}
|
||||
System.arraycopy(newColors, 0, pixels, index, w);
|
||||
|
||||
index += w;
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ public class ContourType {
|
||||
moveToY = sis.readSI15();
|
||||
long numEdgesRef = sis.readUI30();
|
||||
isReference = (numEdgesRef & 1) == 1;
|
||||
numEdgesRef = numEdgesRef >> 1;
|
||||
numEdgesRef >>= 1;
|
||||
long oldPos = sis.getPos();
|
||||
if (isReference) {
|
||||
sis.setPos(numEdgesRef);
|
||||
numEdgesRef = sis.readUI30();
|
||||
numEdgesRef = numEdgesRef >> 1;
|
||||
numEdgesRef >>= 1;
|
||||
}
|
||||
|
||||
edges = new EdgeType[(int) numEdgesRef];
|
||||
|
||||
@@ -455,7 +455,6 @@ public class EdgeType {
|
||||
sos.writeUI8((((ax >> 14) & m5) | (ay << 5)));
|
||||
sos.writeUI8(((ay >> 3)));
|
||||
sos.writeUI8(((ay >> 11)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,18 +88,18 @@ public class GFxInputStream extends InputStream {
|
||||
return v;
|
||||
|
||||
case 1:
|
||||
t = t >> 2;
|
||||
t >>= 2;
|
||||
v = t | (readUI8() << 6);
|
||||
return v;
|
||||
case 2:
|
||||
t = t >> 2;
|
||||
t = t | (readUI8() << 6);
|
||||
t >>= 2;
|
||||
t |= (readUI8() << 6);
|
||||
v = t | (readUI8() << 14);
|
||||
return v;
|
||||
}
|
||||
t = t >> 2;
|
||||
t = t | (readUI8() << 6);
|
||||
t = t | (readUI8() << 14);
|
||||
t >>= 2;
|
||||
t |= (readUI8() << 6);
|
||||
t |= (readUI8() << 14);
|
||||
v = t | (readUI8() << 22);
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -857,8 +857,8 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
|
||||
maxh = r.getHeight();
|
||||
}
|
||||
}
|
||||
maxw = maxw / 20;
|
||||
maxh = maxh / 20;
|
||||
maxw /= 20;
|
||||
maxh /= 20;
|
||||
|
||||
|
||||
int cols = (int) Math.ceil(Math.sqrt(shapes.size()));
|
||||
|
||||
@@ -711,7 +711,7 @@ public class XFLConverter {
|
||||
edges.clear();
|
||||
fillsStr += "</fills>";
|
||||
strokesStr += "</strokes>";
|
||||
if (!currentLayer.equals("")) {
|
||||
if (!currentLayer.isEmpty()) {
|
||||
currentLayer += "</edges>";
|
||||
currentLayer += "</DOMShape>";
|
||||
currentLayer += "</elements>";
|
||||
@@ -1301,10 +1301,14 @@ public class XFLConverter {
|
||||
String symbolFile = "bitmap" + symbol.getCharacterId() + "." + imageTag.getImageFormat();
|
||||
files.put(symbolFile, baos.toByteArray());
|
||||
String mediaLinkStr = "<DOMBitmapItem name=\"" + symbolFile + "\" sourceLastImported=\"" + getTimestamp() + "\" externalFileSize=\"" + baos.toByteArray().length + "\"";
|
||||
if (format.equals("png") || format.equals("gif")) {
|
||||
mediaLinkStr += " useImportedJPEGData=\"false\" compressionType=\"lossless\" originalCompressionType=\"lossless\"";
|
||||
} else if (format.equals("jpg")) {
|
||||
mediaLinkStr += " isJPEG=\"true\"";
|
||||
switch (format) {
|
||||
case "png":
|
||||
case "gif":
|
||||
mediaLinkStr += " useImportedJPEGData=\"false\" compressionType=\"lossless\" originalCompressionType=\"lossless\"";
|
||||
break;
|
||||
case "jpg":
|
||||
mediaLinkStr += " isJPEG=\"true\"";
|
||||
break;
|
||||
}
|
||||
if (characterClasses.containsKey(symbol.getCharacterId())) {
|
||||
mediaLinkStr += " linkageExportForAS=\"true\" linkageClassName=\"" + characterClasses.get(symbol.getCharacterId()) + "\"";
|
||||
@@ -1670,7 +1674,7 @@ public class XFLConverter {
|
||||
ret += ">";
|
||||
|
||||
ret += soundEnvelopeStr;
|
||||
if (!actionScript.equals("")) {
|
||||
if (!actionScript.isEmpty()) {
|
||||
ret += "<Actionscript><script><![CDATA[";
|
||||
ret += actionScript;
|
||||
ret += "]]></script></Actionscript>";
|
||||
@@ -1850,12 +1854,12 @@ public class XFLConverter {
|
||||
lastElements = elements;
|
||||
}
|
||||
}
|
||||
if (!lastElements.equals("")) {
|
||||
if (!lastElements.isEmpty()) {
|
||||
frame++;
|
||||
ret += convertFrame(lastShapeTween, characters, tags, null, null, (frame - duration < 0 ? 0 : frame - duration), duration, "", lastElements);
|
||||
}
|
||||
afterStr = "</frames>" + afterStr;
|
||||
if (!ret.equals("")) {
|
||||
if (!ret.isEmpty()) {
|
||||
ret = prevStr + ret + afterStr;
|
||||
}
|
||||
return ret;
|
||||
@@ -1875,7 +1879,7 @@ public class XFLConverter {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!script.equals("")) {
|
||||
if (!script.isEmpty()) {
|
||||
script = "#initclip\r\n" + script + "#endinitclip\r\n";
|
||||
}
|
||||
for (Tag t : timeLineTags) {
|
||||
@@ -1885,7 +1889,7 @@ public class XFLConverter {
|
||||
}
|
||||
if (t instanceof ShowFrameTag) {
|
||||
|
||||
if (script.equals("")) {
|
||||
if (script.isEmpty()) {
|
||||
duration++;
|
||||
} else {
|
||||
if (duration > 0) {
|
||||
@@ -1912,7 +1916,7 @@ public class XFLConverter {
|
||||
frame++;
|
||||
}
|
||||
}
|
||||
if (!ret.equals("")) {
|
||||
if (!ret.isEmpty()) {
|
||||
ret = "<DOMLayer name=\"Script Layer\" color=\"" + randomOutlineColor() + "\">"
|
||||
+ "<frames>"
|
||||
+ ret
|
||||
@@ -1936,7 +1940,7 @@ public class XFLConverter {
|
||||
}
|
||||
if (t instanceof ShowFrameTag) {
|
||||
|
||||
if (frameLabel.equals("")) {
|
||||
if (frameLabel.isEmpty()) {
|
||||
duration++;
|
||||
} else {
|
||||
if (duration > 0) {
|
||||
@@ -1967,7 +1971,7 @@ public class XFLConverter {
|
||||
frame++;
|
||||
}
|
||||
}
|
||||
if (!ret.equals("")) {
|
||||
if (!ret.isEmpty()) {
|
||||
ret = "<DOMLayer name=\"Labels Layer\" color=\"" + randomOutlineColor() + "\">"
|
||||
+ "<frames>"
|
||||
+ ret
|
||||
@@ -2015,7 +2019,7 @@ public class XFLConverter {
|
||||
}
|
||||
ret += convertFrame(false, characters, tags, lastSoundStreamHead, lastStartSound, frame, duration, "", "");
|
||||
}
|
||||
if (!ret.equals("")) {
|
||||
if (!ret.isEmpty()) {
|
||||
ret = "<DOMLayer name=\"Layer " + layerIndex + "\" color=\"" + randomOutlineColor() + "\">"
|
||||
+ "<frames>" + ret + "</frames>"
|
||||
+ "</DOMLayer>";
|
||||
@@ -2100,7 +2104,7 @@ public class XFLConverter {
|
||||
layerPrev += ">";
|
||||
String layerAfter = "</DOMLayer>";
|
||||
String cf = convertFrames(layerPrev, layerAfter, oneInstanceShapes, tags, timelineTags, characters, d);
|
||||
if (cf.equals("")) {
|
||||
if (cf.isEmpty()) {
|
||||
index--;
|
||||
}
|
||||
ret += cf;
|
||||
@@ -2395,7 +2399,7 @@ public class XFLConverter {
|
||||
if (det.hasMaxLength) {
|
||||
ret += " maxCharacters=\"" + det.maxLength + "\"";
|
||||
}
|
||||
if (!det.variableName.equals("")) {
|
||||
if (!det.variableName.isEmpty()) {
|
||||
ret += " variableName=\"" + det.variableName + "\"";
|
||||
}
|
||||
ret += ">";
|
||||
@@ -2520,7 +2524,7 @@ public class XFLConverter {
|
||||
File f = new File(baseName);
|
||||
baseName = f.getName();
|
||||
if (baseName.contains(".")) {
|
||||
baseName = baseName.substring(0, baseName.lastIndexOf("."));
|
||||
baseName = baseName.substring(0, baseName.lastIndexOf('.'));
|
||||
}
|
||||
final HashMap<String, byte[]> files = new HashMap<>();
|
||||
final HashMap<String, byte[]> datfiles = new HashMap<>();
|
||||
@@ -2586,7 +2590,7 @@ public class XFLConverter {
|
||||
}
|
||||
String expDir = "";
|
||||
if (expPath.contains(".")) {
|
||||
expDir = expPath.substring(0, expPath.lastIndexOf("."));
|
||||
expDir = expPath.substring(0, expPath.lastIndexOf('.'));
|
||||
expDir = expDir.replace(".", File.separator);
|
||||
}
|
||||
expPath = expPath.replace(".", File.separator);
|
||||
@@ -3121,75 +3125,82 @@ public class XFLConverter {
|
||||
@Override
|
||||
public void startElement(String uri, String localName,
|
||||
String qName, Attributes attributes) throws SAXException {
|
||||
if (qName.equals("a")) {
|
||||
String href = attributes.getValue("href");
|
||||
if (href != null) {
|
||||
url = href;
|
||||
}
|
||||
String t = attributes.getValue("target");
|
||||
if (t != null) {
|
||||
target = t;
|
||||
}
|
||||
} else if (qName.equals("b")) {
|
||||
bold = true;
|
||||
} else if (qName.equals("i")) {
|
||||
italic = true;
|
||||
} else if (qName.equals("u")) {
|
||||
underline = true;
|
||||
} else if (qName.equals("li")) {
|
||||
li = true;
|
||||
} else if (qName.equals("p")) {
|
||||
String a = attributes.getValue("align");
|
||||
if (a != null) {
|
||||
alignment = a;
|
||||
}
|
||||
if (!result.equals("")) {
|
||||
putText("\r\n");
|
||||
}
|
||||
} else if (qName.equals("font")) {
|
||||
//kerning ?
|
||||
String ls = attributes.getValue("letterSpacing");
|
||||
if (ls != null) {
|
||||
letterSpacing = Double.parseDouble(ls);
|
||||
}
|
||||
String s = attributes.getValue("size");
|
||||
if (s != null) {
|
||||
size = Integer.parseInt(s);
|
||||
}
|
||||
String c = attributes.getValue("color");
|
||||
if (c != null) {
|
||||
color = c;
|
||||
}
|
||||
String f = attributes.getValue("face");
|
||||
if (f != null) {
|
||||
for (Tag t : tags) {
|
||||
if (t instanceof FontTag) {
|
||||
FontTag ft = (FontTag) t;
|
||||
String fontName = null;
|
||||
if (f.equals(ft.getFontName(tags))) {
|
||||
for (Tag u : tags) {
|
||||
if (u instanceof DefineFontNameTag) {
|
||||
if (((DefineFontNameTag) u).fontId == ft.getFontId()) {
|
||||
fontName = ((DefineFontNameTag) u).fontName;
|
||||
switch (qName) {
|
||||
case "a":
|
||||
String href = attributes.getValue("href");
|
||||
if (href != null) {
|
||||
url = href;
|
||||
}
|
||||
String t = attributes.getValue("target");
|
||||
if (t != null) {
|
||||
target = t;
|
||||
}
|
||||
break;
|
||||
case "b":
|
||||
bold = true;
|
||||
break;
|
||||
case "i":
|
||||
italic = true;
|
||||
break;
|
||||
case "u":
|
||||
underline = true;
|
||||
break;
|
||||
case "li":
|
||||
li = true;
|
||||
break;
|
||||
case "p":
|
||||
String a = attributes.getValue("align");
|
||||
if (a != null) {
|
||||
alignment = a;
|
||||
}
|
||||
if (!result.isEmpty()) {
|
||||
putText("\r\n");
|
||||
}
|
||||
break;
|
||||
case "font":
|
||||
//kerning ?
|
||||
String ls = attributes.getValue("letterSpacing");
|
||||
if (ls != null) {
|
||||
letterSpacing = Double.parseDouble(ls);
|
||||
}
|
||||
String s = attributes.getValue("size");
|
||||
if (s != null) {
|
||||
size = Integer.parseInt(s);
|
||||
}
|
||||
String c = attributes.getValue("color");
|
||||
if (c != null) {
|
||||
color = c;
|
||||
}
|
||||
String f = attributes.getValue("face");
|
||||
if (f != null) {
|
||||
for (Tag tag : tags) {
|
||||
if (tag instanceof FontTag) {
|
||||
FontTag ft = (FontTag) tag;
|
||||
String fontName = null;
|
||||
if (f.equals(ft.getFontName(tags))) {
|
||||
for (Tag u : tags) {
|
||||
if (u instanceof DefineFontNameTag) {
|
||||
if (((DefineFontNameTag) u).fontId == ft.getFontId()) {
|
||||
fontName = ((DefineFontNameTag) u).fontName;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fontName == null) {
|
||||
fontName = ft.getFontName(tags);
|
||||
}
|
||||
String installedFont;
|
||||
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
|
||||
fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName();
|
||||
} else {
|
||||
fontFace = fontName;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (fontName == null) {
|
||||
fontName = ft.getFontName(tags);
|
||||
}
|
||||
String installedFont;
|
||||
if ((installedFont = FontTag.isFontInstalled(fontName)) != null) {
|
||||
fontFace = new Font(installedFont, (italic ? Font.ITALIC : 0) | (bold ? Font.BOLD : 0) | (!italic && !bold ? Font.PLAIN : 0), size < 0 ? 10 : size).getPSName();
|
||||
} else {
|
||||
fontFace = fontName;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
//textformat,tab,br
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3268,7 +3279,7 @@ public class XFLConverter {
|
||||
|
||||
@Override
|
||||
public void endDocument() {
|
||||
if (this.result.equals("")) {
|
||||
if (this.result.isEmpty()) {
|
||||
putText("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@ public enum ExportMode {
|
||||
private static final Map<Integer, ExportMode> lookup = new HashMap<>();
|
||||
|
||||
static {
|
||||
for(ExportMode s : EnumSet.allOf(ExportMode.class))
|
||||
lookup.put(s.getCode(), s);
|
||||
for(ExportMode s : EnumSet.allOf(ExportMode.class)) {
|
||||
lookup.put(s.getCode(), s);
|
||||
}
|
||||
}
|
||||
|
||||
private int code;
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -72,7 +73,7 @@ public class Helper {
|
||||
if (i > 0) {
|
||||
s += ",";
|
||||
}
|
||||
s = s + array[i];
|
||||
s += array[i];
|
||||
}
|
||||
s += "]";
|
||||
return s;
|
||||
@@ -90,7 +91,7 @@ public class Helper {
|
||||
if (i > 0) {
|
||||
s += " ";
|
||||
}
|
||||
s = s + padZeros(Integer.toHexString(array[i] & 0xff), 2);
|
||||
s += padZeros(Integer.toHexString(array[i] & 0xff), 2);
|
||||
}
|
||||
s += "]";
|
||||
return s;
|
||||
@@ -353,9 +354,7 @@ public class Helper {
|
||||
|
||||
public static List<Object> toList(Object... rest) {
|
||||
List<Object> ret = new ArrayList<>();
|
||||
for (Object o : rest) {
|
||||
ret.add(o);
|
||||
}
|
||||
ret.addAll(Arrays.asList(rest));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -483,7 +482,7 @@ public class Helper {
|
||||
str = Pattern.compile("\\." + Pattern.quote(inv) + "\\.", Pattern.CASE_INSENSITIVE).matcher(str).replaceAll("._" + inv + ".");
|
||||
}
|
||||
str = str.substring(1, str.length() - 1); //remove dots
|
||||
if (str.equals("")) {
|
||||
if (str.isEmpty()) {
|
||||
str = "unnamed";
|
||||
}
|
||||
return str;
|
||||
@@ -527,11 +526,11 @@ public class Helper {
|
||||
|
||||
public static String formatTimeSec(long timeMs) {
|
||||
long timeS = timeMs / 1000;
|
||||
timeMs = timeMs % 1000;
|
||||
timeMs %= 1000;
|
||||
long timeM = timeS / 60;
|
||||
timeS = timeS % 60;
|
||||
timeS %= 60;
|
||||
long timeH = timeM / 60;
|
||||
timeM = timeM % 60;
|
||||
timeM %= 60;
|
||||
String timeStr = "";
|
||||
if (timeH > 0) {
|
||||
timeStr += Helper.padZeros(timeH, 2) + ":";
|
||||
@@ -548,9 +547,9 @@ public class Helper {
|
||||
|
||||
public static String formatTimeToText(int timeS) {
|
||||
long timeM = timeS / 60;
|
||||
timeS = timeS % 60;
|
||||
timeS %= 60;
|
||||
long timeH = timeM / 60;
|
||||
timeM = timeM % 60;
|
||||
timeM %= 60;
|
||||
|
||||
String timeStr = "";
|
||||
if (timeH > 0) {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.jpexs.process;
|
||||
|
||||
import com.jpexs.helpers.ProgressListener;
|
||||
import com.jpexs.process.Process;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.jpexs.process;
|
||||
|
||||
import com.jpexs.process.Process;
|
||||
import com.jpexs.process.win32.Win32ProcessTools;
|
||||
import com.sun.jna.Platform;
|
||||
import java.util.List;
|
||||
|
||||
@@ -200,7 +200,7 @@ public class Win32ProcessTools extends ProcessTools {
|
||||
int rgb = Gdi32.INSTANCE.GetPixel(hdcMem, x, y).intValue();
|
||||
int r = (rgb >> 16) & 0xff;
|
||||
int g = (rgb >> 8) & 0xff;
|
||||
int b = (rgb >> 0) & 0xff;
|
||||
int b = (rgb) & 0xff;
|
||||
rgb = (b << 16) + (g << 8) + r;
|
||||
ret.setRGB(x, y, rgb);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ public class Win32ProcessTools extends ProcessTools {
|
||||
int rgb = image.getRGB(x, y);
|
||||
int r = (rgb >> 16) & 0xff;
|
||||
int g = (rgb >> 8) & 0xff;
|
||||
int b = (rgb >> 0) & 0xff;
|
||||
int b = (rgb) & 0xff;
|
||||
r = r * alpha / 255;
|
||||
g = g * alpha / 255;
|
||||
b = b * alpha / 255;
|
||||
|
||||
@@ -253,7 +253,7 @@ public abstract class Advapi32Util {
|
||||
offset += Native.WCHAR_SIZE;
|
||||
result.add(s);
|
||||
}
|
||||
return result.toArray(new String[0]);
|
||||
return result.toArray(new String[result.size()]);
|
||||
} finally {
|
||||
rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
|
||||
if (rc != W32Errors.ERROR_SUCCESS) {
|
||||
@@ -700,7 +700,7 @@ public abstract class Advapi32Util {
|
||||
}
|
||||
keys.add(Native.toString(name));
|
||||
}
|
||||
return keys.toArray(new String[0]);
|
||||
return keys.toArray(new String[keys.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -784,7 +784,7 @@ public abstract class Advapi32Util {
|
||||
offset += Native.WCHAR_SIZE;
|
||||
result.add(s);
|
||||
}
|
||||
keyValues.put(nameString, result.toArray(new String[0]));
|
||||
keyValues.put(nameString, result.toArray(new String[result.size()]));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -830,7 +830,7 @@ public abstract class Advapi32Util {
|
||||
StringBuilder out = new StringBuilder();
|
||||
for (Entry<String, String> entry : environment.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
out.append(entry.getKey() + "=" + entry.getValue() + "\0");
|
||||
out.append(entry.getKey()).append("=").append(entry.getValue()).append("\0");
|
||||
}
|
||||
}
|
||||
return out.toString() + "\0";
|
||||
@@ -975,7 +975,7 @@ public abstract class Advapi32Util {
|
||||
offset += Native.WCHAR_SIZE;
|
||||
count--;
|
||||
}
|
||||
_strings = strings.toArray(new String[0]);
|
||||
_strings = strings.toArray(new String[strings.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public interface BaseTSD extends StdCallLibrary {
|
||||
/**
|
||||
* PULONG_PTR
|
||||
*/
|
||||
public static class ULONG_PTRByReference extends ByReference {
|
||||
public static final class ULONG_PTRByReference extends ByReference {
|
||||
|
||||
public ULONG_PTRByReference() {
|
||||
this(new ULONG_PTR(0));
|
||||
|
||||
@@ -61,7 +61,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class WORDbyReference extends ByReference {
|
||||
public static final class WORDbyReference extends ByReference {
|
||||
|
||||
public WORDbyReference() {
|
||||
this(new WORD(0));
|
||||
@@ -123,7 +123,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class DWORDbyReference extends ByReference {
|
||||
public static final class DWORDbyReference extends ByReference {
|
||||
|
||||
public DWORDbyReference() {
|
||||
this(new DWORD(0));
|
||||
@@ -156,7 +156,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class LONGbyReference extends ByReference {
|
||||
public static final class LONGbyReference extends ByReference {
|
||||
|
||||
public LONGbyReference() {
|
||||
this(new LONG(0));
|
||||
@@ -189,7 +189,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class LONGLONGbyReference extends ByReference {
|
||||
public static final class LONGLONGbyReference extends ByReference {
|
||||
|
||||
public LONGLONGbyReference() {
|
||||
this(new LONGLONG(0));
|
||||
@@ -658,7 +658,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class ULONGbyReference extends ByReference {
|
||||
public static final class ULONGbyReference extends ByReference {
|
||||
|
||||
public ULONGbyReference() {
|
||||
this(new ULONG(0));
|
||||
@@ -691,7 +691,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class ULONGLONGbyReference extends ByReference {
|
||||
public static final class ULONGLONGbyReference extends ByReference {
|
||||
|
||||
public ULONGLONGbyReference() {
|
||||
this(new ULONGLONG(0));
|
||||
@@ -899,7 +899,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class USHORTbyReference extends ByReference {
|
||||
public static final class USHORTbyReference extends ByReference {
|
||||
|
||||
public USHORTbyReference() {
|
||||
this(new USHORT(0));
|
||||
@@ -967,7 +967,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public class UINTbyReference extends ByReference {
|
||||
public static final class UINTbyReference extends ByReference {
|
||||
|
||||
public UINTbyReference() {
|
||||
this(new UINT(0));
|
||||
@@ -1009,7 +1009,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SCODEbyReference extends ByReference {
|
||||
public static final class SCODEbyReference extends ByReference {
|
||||
|
||||
public SCODEbyReference() {
|
||||
this(new SCODE(0));
|
||||
@@ -1053,7 +1053,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public static class BOOLbyReference extends ByReference {
|
||||
public static final class BOOLbyReference extends ByReference {
|
||||
|
||||
public BOOLbyReference() {
|
||||
this(new BOOL(0));
|
||||
@@ -1110,7 +1110,7 @@ public interface WinDef extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public static class CHARbyReference extends ByReference {
|
||||
public static final class CHARbyReference extends ByReference {
|
||||
|
||||
public CHARbyReference() {
|
||||
this(new CHAR(0));
|
||||
|
||||
@@ -808,7 +808,7 @@ public interface WinNT extends WinError, WinDef, WinBase, BaseTSD {
|
||||
/**
|
||||
* LPHANDLE
|
||||
*/
|
||||
public static class HANDLEByReference extends ByReference {
|
||||
public static final class HANDLEByReference extends ByReference {
|
||||
|
||||
public HANDLEByReference() {
|
||||
this(null);
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface WinReg extends StdCallLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
public static class HKEYByReference extends ByReference {
|
||||
public static final class HKEYByReference extends ByReference {
|
||||
|
||||
public HKEYByReference() {
|
||||
this(null);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AS2Generator {
|
||||
HilightedTextWriter writer = new HilightedTextWriter(false);
|
||||
Action.actionsToSource(doa, doa.getActions(swf.version), swf.version, "", writer);
|
||||
String src = writer.toString();
|
||||
if (src.trim().equals("")) {
|
||||
if (src.trim().isEmpty()) {
|
||||
doa = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user