missing localizations 2

This commit is contained in:
Honfika
2014-01-03 15:56:12 +01:00
parent f91b63334c
commit 09fb0cf795
4 changed files with 34 additions and 41 deletions

View File

@@ -156,26 +156,12 @@ public class ScriptPack implements TreeElementItem {
} catch (TimeoutException ex) {
writer.continueMeasure();
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(String.format(AppStrings.translate("decompilationError.timeout"), Helper.formatTimeToText(Configuration.decompilationTimeoutFile.get()))).newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"").
appendNoHilight(AppStrings.translate("decompilationError.timeout.description")).
appendNoHilight("\");").newLine();
Helper.appendTimeoutComment(writer, Configuration.decompilationTimeoutFile.get());
return;
} catch (ExecutionException ex) {
writer.continueMeasure();
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError.obfuscated")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError.errorType")).
appendNoHilight(": " + ex.getClass().getSimpleName()).newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"").
appendNoHilight(AppStrings.translate("decompilationError.error.description")).
appendNoHilight("\");").newLine();
Helper.appendErrorComment(writer, ex);
return;
}
writer.continueMeasure();

View File

@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.avm2.ConstantPool;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.ExportMode;
import com.jpexs.decompiler.graph.Graph;
@@ -177,19 +178,10 @@ public class MethodBody implements Cloneable, Serializable {
writer.endMethod();
} else if (convertException instanceof TimeoutException) {
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", convertException);
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * Decompilation error").newLine();
writer.appendNoHilight(" * Timeout (" + Helper.formatTimeToText(timeout) + ") was reached").newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"Not decompiled due to timeout\");").newLine();
Helper.appendTimeoutComment(writer, Configuration.decompilationTimeoutFile.get());
} else {
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", convertException);
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * Decompilation error").newLine();
writer.appendNoHilight(" * Code may be obfuscated").newLine();
writer.appendNoHilight(" * Error type: " + convertException.getClass().getSimpleName()).newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"Not decompiled due to error\");").newLine();
Helper.appendErrorComment(writer, convertException);
}
writer.unindent();
}

View File

@@ -47,6 +47,7 @@ import com.jpexs.decompiler.flash.action.swf5.*;
import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.flash.helpers.NulWriter;
@@ -729,19 +730,10 @@ public class Action implements GraphSourceItem {
Graph.graphToString(tree, writer, new LocalData());
} else if (convertException instanceof TimeoutException) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error", convertException);
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * Decompilation error").newLine();
writer.appendNoHilight(" * Timeout (" + Helper.formatTimeToText(timeout) + ") was reached").newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"Not decompiled due to timeout\");").newLine();
Helper.appendTimeoutComment(writer, Configuration.decompilationTimeoutFile.get());
} else {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error", convertException);
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * Decompilation error").newLine();
writer.appendNoHilight(" * Code may be obfuscated").newLine();
writer.appendNoHilight(" * Error type: " + convertException.getClass().getSimpleName()).newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"Not decompiled due to error\");").newLine();
Helper.appendErrorComment(writer, convertException);
}
asm.getActionSourceSuffix(writer);
}
@@ -888,9 +880,10 @@ public class Action implements GraphSourceItem {
out = new ArrayList<>();
out.add(new CommentItem(new String[] {
"",
" * Decompilation error",
" * Code may be obfuscated",
" * Error type: " + ex2.getClass().getSimpleName(),
" * " + AppStrings.translate("decompilationError"),
" * " + AppStrings.translate("decompilationError.obfuscated"),
" * " + AppStrings.translate("decompilationError.errorType") + ": " +
ex2.getClass().getSimpleName(),
""}));
}
outs.add(out);

View File

@@ -709,4 +709,26 @@ public class Helper {
}
}
}
public static void appendTimeoutComment(GraphTextWriter writer, int timeout) {
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(String.format(AppStrings.translate("decompilationError.timeout"), Helper.formatTimeToText(timeout))).newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"").
appendNoHilight(AppStrings.translate("decompilationError.timeout.description")).
appendNoHilight("\");").newLine();
}
public static void appendErrorComment(GraphTextWriter writer, Throwable ex) {
writer.appendNoHilight("/*").newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError.obfuscated")).newLine();
writer.appendNoHilight(" * ").appendNoHilight(AppStrings.translate("decompilationError.errorType")).
appendNoHilight(": " + ex.getClass().getSimpleName()).newLine();
writer.appendNoHilight(" */").newLine();
writer.appendNoHilight("throw new IllegalOperationError(\"").
appendNoHilight(AppStrings.translate("decompilationError.error.description")).
appendNoHilight("\");").newLine();
}
}