Added ThrowsError() and IsEmpty() extension methods for MethodInfo.

This commit is contained in:
scepheo 2014-11-24 19:51:27 +00:00
parent 9c02bf77ba
commit 2c79016725
1 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,18 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
return !info.GetCustomAttributes(false).OfType<FeatureNotImplemented>().Any();
}
public static bool ThrowsError(this MethodInfo info)
{
var il = info.GetMethodBody().GetILAsByteArray();
return (il[il.Length - 1] == 0x7A);
}
public static bool IsEmpty(this MethodInfo info)
{
var il = info.GetMethodBody().GetILAsByteArray();
return (il.Length == 1 && il[0] == 0x2A);
}
public static bool IsImplemented(this PropertyInfo info)
{
return !info.GetCustomAttributes(false).OfType<FeatureNotImplemented>().Any();