Model: Implement MethodBase.GetMethodBody()

This commit is contained in:
Katy Coe
2020-06-22 17:35:23 +02:00
parent 5f0360dc0a
commit 2791721dd1

View File

@@ -81,7 +81,15 @@ namespace Il2CppInspector.Reflection
public bool IsGenericMethod { get; }
public bool IsGenericMethodDefinition => (genericMethodDefinition == null) && genericArguments.Any();
// TODO: GetMethodBody()
// Get the machine code of the method body
public byte[] GetMethodBody() {
if (!VirtualAddress.HasValue)
return null;
var image = Assembly.Model.Package.BinaryImage;
image.Position = image.MapVATR(VirtualAddress.Value.Start);
return image.ReadBytes((int) (VirtualAddress.Value.End - VirtualAddress.Value.Start));
}
public string CSharpName =>
// Operator overload or user-defined conversion operator