/// <summary> /// Returns false if the packet should be sent to the loginserver /// </summary> /// <param name="client"></param> /// <param name="msgID"></param> /// <param name="data"></param> /// <returns></returns> public static bool HandlePacket(LoginClient client, CMSG msgID, BinReader data) { if (msgID >= CMSG.MAX) { return(true); } ILoginClientPacketHandler handler = (ILoginClientPacketHandler)loginClientHandlers[msgID]; bool wasHandled = false; if (handler != null) { wasHandled = handler.HandlePacket(client, msgID, data); } LoginClientPacketDelegate wcpd = (LoginClientPacketDelegate)loginClientDelegates[(int)msgID]; if (wcpd != null) { foreach (LoginClientPacketDelegate d in wcpd.GetInvocationList()) { if (d(client, msgID, data)) { wasHandled = true; } } } return(wasHandled); }
/// <summary> /// Returns false if the packet should be sent to the loginserver /// </summary> /// <param name="client"></param> /// <param name="msgID"></param> /// <param name="data"></param> /// <returns></returns> public static bool HandlePacket(LoginClient client, CMSG msgID, BinReader data) { DebugLogger.Logger.Log("LoginClient handling packet " + msgID.ToString()); if (msgID >= CMSG.MAX) { return(true); } ILoginClientPacketHandler handler = (ILoginClientPacketHandler)loginClientHandlers[msgID]; bool wasHandled = false; try { long position = data.BaseStream.Position; if (handler != null) { wasHandled = handler.HandlePacket(client, msgID, data); } data.BaseStream.Position = position; LoginClientPacketDelegate wcpd = (LoginClientPacketDelegate)loginClientDelegates[(int)msgID]; if (wcpd != null) { foreach (LoginClientPacketDelegate d in wcpd.GetInvocationList()) { if (d != null) { if (d(client, msgID, data)) { wasHandled = true; } data.BaseStream.Position = position; } } } return(wasHandled); } catch (Exception exp) { DebugLogger.Logger.Log("", exp); } return(wasHandled); }