2014-04-25 01:19:57 +00:00
|
|
|
|
using System;
|
2014-11-24 00:38:29 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
2014-04-25 01:19:57 +00:00
|
|
|
|
|
2014-05-31 14:29:27 +00:00
|
|
|
|
namespace BizHawk.Emulation.Common.IEmulatorExtensions
|
2014-04-25 01:19:57 +00:00
|
|
|
|
{
|
|
|
|
|
public static class Extensions
|
|
|
|
|
{
|
|
|
|
|
public static CoreAttributes Attributes(this IEmulator core)
|
|
|
|
|
{
|
|
|
|
|
return (CoreAttributes)Attribute.GetCustomAttribute(core.GetType(), typeof(CoreAttributes));
|
|
|
|
|
}
|
2014-09-01 18:43:41 +00:00
|
|
|
|
|
|
|
|
|
public static bool HasMemoryDomains(this IEmulator core)
|
|
|
|
|
{
|
|
|
|
|
return core is IMemoryDomains;
|
|
|
|
|
}
|
2014-11-24 00:38:29 +00:00
|
|
|
|
|
|
|
|
|
// TODO: a better place for these
|
|
|
|
|
public static bool IsImplemented(this MethodInfo info)
|
|
|
|
|
{
|
|
|
|
|
return !info.GetCustomAttributes(false).OfType<FeatureNotImplemented>().Any();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsImplemented(this PropertyInfo info)
|
|
|
|
|
{
|
|
|
|
|
return !info.GetCustomAttributes(false).OfType<FeatureNotImplemented>().Any();
|
|
|
|
|
}
|
2014-04-25 01:19:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|