public static void InitializeCommands()
{
var currentAsm = Assembly.GetEntryAssembly();
foreach (var type in currentAsm.GetTypes())
{
foreach (var methodInfo in type.GetTypeInfo().GetMethods())
{
foreach (var commandAttr in methodInfo.GetCustomAttributes<ConsoleCommandAttribute>())
if (commandAttr != null)
commands[commandAttr.Command] = (HandleCommand)methodInfo.CreateDelegate(typeof(HandleCommand), null);
}
}
}