private void _Initialize()
{
_EntriesByNID = new Dictionary<uint, HleFunctionEntry>();
_EntriesByName = new Dictionary<string, HleFunctionEntry>();
//this.PspEmulatorContext = PspEmulatorContext;
//PspEmulatorContext.InjectDependencesTo(this);
//Console.WriteLine(this.ModuleLocation);
//Console.ReadKey();
//try
{
foreach (
var MethodInfo in
new MethodInfo[0]
.Concat(this.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance))
//.Concat(this.GetType().GetMethods(BindingFlags.NonPublic))
//.Concat(this.GetType().GetMethods(BindingFlags.Public))
)
{
var Attributes = MethodInfo.GetCustomAttributes(typeof(HlePspFunctionAttribute), true).Cast<HlePspFunctionAttribute>();
if (Attributes.Any())
{
if (!MethodInfo.IsPublic)
{
throw(new InvalidProgramException("Method " + MethodInfo + " is not public"));
}
var Delegate = CreateDelegateForMethodInfo(MethodInfo, Attributes.First());
foreach (var Attribute in Attributes)
{
_EntriesByNID[Attribute.NID] = new HleFunctionEntry()
{
NID = Attribute.NID,
Name = MethodInfo.Name,
Description = "",
Delegate = Delegate,
Module = this,
ModuleName = this.Name,
};
}
_EntriesByName[MethodInfo.Name] = _EntriesByNID[Attributes.First().NID];
}
else
{
//Console.WriteLine("HleModuleHost: NO: {0}", MethodInfo.Name);
}
}
}
//catch (Exception Exception)
//{
// Console.WriteLine(Exception);
// throw (Exception);
//}
ModuleInitialize();
}