Class writing, call graph, eclipse project
This commit is contained in:
@@ -3,14 +3,16 @@ package info.sigterm.deob;
|
||||
import info.sigterm.deob.pool.NameAndType;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Methods
|
||||
{
|
||||
ClassFile classFile;
|
||||
|
||||
private int count;
|
||||
private Method[] methods;
|
||||
private List<Method> methods = new ArrayList<>();
|
||||
|
||||
Methods(ClassFile cf) throws IOException
|
||||
{
|
||||
@@ -18,11 +20,23 @@ public class Methods
|
||||
|
||||
DataInputStream is = cf.getStream();
|
||||
|
||||
count = is.readUnsignedShort();
|
||||
methods = new Method[count];
|
||||
int count = is.readUnsignedShort();
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
methods[i] = new Method(this);
|
||||
methods.add(new Method(this));
|
||||
}
|
||||
|
||||
public void write(DataOutputStream out) throws IOException
|
||||
{
|
||||
out.writeShort(methods.size());
|
||||
for (Method m : methods)
|
||||
m.write(out);
|
||||
}
|
||||
|
||||
public void removeMethod(Method m)
|
||||
{
|
||||
m.remove();
|
||||
methods.remove(methods);
|
||||
}
|
||||
|
||||
public ClassFile getClassFile()
|
||||
@@ -30,6 +44,11 @@ public class Methods
|
||||
return classFile;
|
||||
}
|
||||
|
||||
public List<Method> getMethods()
|
||||
{
|
||||
return methods;
|
||||
}
|
||||
|
||||
public Method findMethod(NameAndType nat)
|
||||
{
|
||||
for (Method m : methods)
|
||||
@@ -51,4 +70,10 @@ public class Methods
|
||||
for (Method m : methods)
|
||||
m.buildInstructionGraph();
|
||||
}
|
||||
|
||||
public void buildCallGraph()
|
||||
{
|
||||
for (Method m : methods)
|
||||
m.buildCallGraph();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user