public GameServer()
{
ReflectionHelper.GetMethodsWithAttritube<PacketHandlerAttribute>((method, attribute) =>
{
OpCodes opCode = attribute.OpCode;
Type packetType = method.GetParameters()[1].ParameterType;
Delegate del =
Delegate.CreateDelegate(typeof (Action<,>).MakeGenericType(typeof (GameClient), packetType),
method);
var handler =
(IPacketHandler)
Activator.CreateInstance(typeof (PacketHandler<>).MakeGenericType(packetType), del);
_packetHandlers.Add(opCode, handler);
});
}