logger classes fixed, added new events (swf, abc, method body parsed)

This commit is contained in:
2014-09-01 13:33:35 +02:00
parent c27eeafce4
commit 8325d07b24
26 changed files with 186 additions and 120 deletions
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.action;
import com.jpexs.decompiler.flash.DisassemblyListener;
@@ -23,7 +24,6 @@ import com.jpexs.decompiler.flash.action.swf4.ActionIf;
import com.jpexs.decompiler.flash.action.swf4.ActionJump;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.helpers.EmptySWFDecompilerListener;
import com.jpexs.decompiler.flash.helpers.FileTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItemContainer;
import java.io.File;
@@ -183,7 +183,7 @@ public class ActionList extends ArrayList<Action> {
try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) {
Action.actionsToString(new ArrayList<DisassemblyListener>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE, writer);
} catch (IOException ex) {
Logger.getLogger(EmptySWFDecompilerListener.class.getName()).log(Level.SEVERE, null, ex);
Logger.getLogger(ActionList.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -72,7 +72,7 @@ import java.util.logging.Logger;
*/
public class ActionListReader {
private static final Logger logger = Logger.getLogger(SWFInputStream.class.getName());
private static final Logger logger = Logger.getLogger(ActionListReader.class.getName());
/**
* Reads list of actions from the stream. Reading ends with
@@ -108,7 +108,7 @@ public class ActionListReader {
} else if (cause instanceof InterruptedException) {
throw (IOException) cause;
} else {
Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
return new ActionList();
@@ -166,15 +166,8 @@ public class ActionListReader {
jump.setJumpOffset((int) (entryAction.getAddress() - jump.getTotalActionLength()));
}
if (SWFDecompilerPlugin.listener != null) {
try {
SWFDecompilerPlugin.listener.actionListParsed(actions, sis.getSwf());
actions = fixActionList(actions, null, version);
} catch (Throwable e) {
Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, e);
//View.showMessageDialog(null, "Failed to call plugin method actionListParsed. Exception: " + e.getMessage());
}
if (SWFDecompilerPlugin.fireActionListParsed(actions, sis.getSwf())) {
actions = fixActionList(actions, null, version);
}
if (deobfuscationMode == 0) {
@@ -183,7 +176,7 @@ public class ActionListReader {
updateActionLengths(actions, version);
} catch (OutOfMemoryError | StackOverflowError | TranslateException ex) {
// keep orignal (not deobfuscated) actions
Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
} else if (deobfuscationMode == 1) {
try {
@@ -191,7 +184,7 @@ public class ActionListReader {
new ActionDeobfuscator().actionListParsed(actions, sis.getSwf());
} catch (OutOfMemoryError | StackOverflowError | TranslateException ex) {
// keep orignal (not deobfuscated) actions
Logger.getLogger(ActionListReader.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -12,12 +12,15 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.deobfuscation;
import com.jpexs.decompiler.flash.DisassemblyListener;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.flash.action.ActionListReader;
@@ -469,6 +472,18 @@ public class ActionDeobfuscator implements SWFDecompilerListener {
return results;
}
@Override
public void swfParsed(SWF swf) {
}
@Override
public void abcParsed(ABC abc, SWF swf) {
}
@Override
public void methodBodyParsed(MethodBody body, SWF swf) {
}
class ExecutionResult {
public int idx = -1;
@@ -12,10 +12,13 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.deobfuscation;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.flash.action.ActionLocalData;
@@ -185,6 +188,18 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
}
}
@Override
public void swfParsed(SWF swf) {
}
@Override
public void abcParsed(ABC abc, SWF swf) {
}
@Override
public void methodBodyParsed(MethodBody body, SWF swf) {
}
class ExecutionResult {
public int idx = -1;