Issue #42, AS1/2 - displaying hex

Graph button changed to icon
This commit is contained in:
Jindra Pet��k
2013-03-21 20:53:46 +01:00
parent 50cce00fe0
commit 4d1aeb00d1
17 changed files with 199 additions and 45 deletions
@@ -23,19 +23,22 @@ import com.jpexs.decompiler.flash.action.parser.ASMParser;
import com.jpexs.decompiler.flash.action.parser.FlasmLexer;
import com.jpexs.decompiler.flash.action.parser.Label;
import com.jpexs.decompiler.flash.action.parser.ParseException;
import com.jpexs.decompiler.flash.action.special.ActionContainer;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
public class ActionWith extends Action {
public class ActionWith extends Action implements ActionContainer{
public List<Action> actions;
public int size;
public int version;
public ActionWith(SWFInputStream sis, int version) throws IOException {
super(0x94, 2);
size = sis.readUI16();
this.version = version;
//actions = new ArrayList<Action>();
actions = (new SWFInputStream(new ByteArrayInputStream(sis.readBytes(size)), version)).readActionList();
}
@@ -52,6 +55,21 @@ public class ActionWith extends Action {
Action.setActionsAddresses(actions, address + 5, version);
}
@Override
public byte[] getHeaderBytes() {
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
try {
byte codeBytes[] = Action.actionsToBytes(actions, false, version);
sos.writeUI16(codeBytes.length);
sos.close();
baos2.write(surroundWithAction(baos.toByteArray(), version));
} catch (IOException e) {
}
return baos2.toByteArray();
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
@@ -69,8 +87,8 @@ public class ActionWith extends Action {
}
@Override
public String getASMSource(List<Long> knownAddreses, List<String> constantPool, int version) {
return "With {\r\n" + Action.actionsToString(actions, knownAddreses, constantPool, version) + "}";
public String getASMSource(List<Long> knownAddreses, List<String> constantPool, int version, boolean hex) {
return "With {\r\n" + Action.actionsToString(actions, knownAddreses, constantPool, version,hex) + "}";
}
@Override
@@ -82,4 +100,6 @@ public class ActionWith extends Action {
public List<Action> getAllIfsOrJumps() {
return Action.getActionsAllIfsOrJumps(actions);
}
}