using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace FilterAPI.Networking { public class HandlerLoader { public static Dictionary Handlers; public HandlerLoader() { Handlers = new Dictionary(); } public Boolean HasHandler(NETCMD OPCode) { return Handlers.ContainsKey(OPCode); } public MethodInfo GetHandler(NETCMD netCMD) { MethodInfo TypeMethod; if (Handlers.TryGetValue(netCMD, out TypeMethod)) { return TypeMethod; } return null; } public Action GetAction(MethodInfo TypeMethod, params Object[] Args) { return () => TypeMethod.Invoke(null, Args); } } }