public static void DW_PacketReceived(MessageData data) { var type = data.Get <int>("type"); var crypt = data.Get <bool>("crypt"); var weHandle = ((type == 10) || (type == 18) || (type == 8 || (crypt && type == 28) || type == 50 || type == 4 || type == 58) || (type == 23)); try { if (type == 10) { var packet = DWRouter.GetMessage(data); var call = packet.ByteBuffer.ReadByte(); var initTime = DateTime.Now; switch (call) { case 1: UploadFile(data, packet); break; case 3: GetFile(data, packet); break; case 7: GetPublisherFile(data, packet); break; default: Log.Debug("unknown packet " + call + " in bdStorage"); DWRouter.Unknown(data, packet); break; } } else if (type == 18) { try { var packet = DWRouter.GetMessage(data); var reply = packet.MakeReply(5, false); reply.ByteBuffer.Write(new byte[] { 0x2d, 0xb3, 0xa2, 0x4f, 0x1a, 0x36, 0xd0, 0xd2, 0x00, 0x00, 0x04, 0x00, 0x00, 0xee, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0xd0, 0x07, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x02, 0x0c, 0xd1, 0xaa, 0x7a, 0xb1, 0x31, 0xb1, 0xaa, 0x6b, 0x83, 0x51, 0x00, 0x00 }); reply.Send(true); } catch { } } else if (type == 8 || (crypt && type == 28) || type == 50 || type == 4 || type == 58) { try { var packet = DWRouter.GetMessage(data); try { var call = packet.ByteBuffer.ReadByte(); //Log.Debug("Service call identifier is " + call + "."); } catch { } //DWRouter.Unknown(data, packet); } catch { } } else if (type == 23) { try { var packet = DWRouter.GetMessage(data); var call = packet.ByteBuffer.ReadByte(); switch (call) { case 2: GetCounterTotals(data, packet); break; default: Log.Debug("unknown packet " + call + " in bdCounter"); //DWRouter.Unknown(data, packet); break; } } catch { } } /*else if (type != 12 && crypt) * { * var packet = DWRouter.GetMessage(data); * DWRouter.Unknown(data, packet); * }*/ } catch (Exception e) { Log.Error(e.ToString()); } if (weHandle) { var upacket = DWRouter.GetMessage(data); } }
private void redirectPacket(MessageData data) { data.Arguments["handled"] = false; var type = data.Get <int>("type"); var crypt = data.Get <bool>("crypt"); bool routed = false; try { if (!crypt && (type == 28 || type == 12 || type == 26)) { DWAuther.DW_PacketReceived(data); routed = true; //Log.Debug("got auth packet"); } if (crypt && type == 28) { DWGroups.DW_PacketReceived(data); routed = true; } if (type == 7) { DWLobby.DW_PacketReceived(data); routed = true; //Log.Debug("got lobby packet"); } if (type == 6) { DWMessaging.DW_PacketReceived(data); routed = true; //Log.Debug("got service packet"); } if (type == 21) { DWMatch.DW_PacketReceived(data); routed = true; //Log.Debug("got match packet"); } if ((type == 10) || (type == 18) || (type == 23) || (type == 8 || type == 50 || type == 4 || type == 58)) { DWStorage.DW_PacketReceived(data); routed = true; //Log.Debug("got storage packet"); } if (type == 12 && crypt) { DWTitles.DW_PacketReceived(data); routed = true; //Log.Debug("got Title packet"); } if (type == 8) { DWProfiles.DW_PacketReceived(data); routed = true; } if (type == 27) { DWDML.DW_PacketReceived(data); } if (type == 67) { DWEventLog.DW_PacketReceived(data); } } catch (Exception e) { Log.Error("Exception: " + e.ToString()); } /*if(routed == false) * { * Log.Debug("UNHANDLED PACKET: " + type); * }*/ try { if (crypt && !data.Get <bool>("handled")) { DWRouter.Unknown(data, DWRouter.GetMessage(data)); } } catch { Log.Error("UNKNOWN FAILED, THIS CONNECTION CAN BE CONSIDERED DEAD."); // disconnect to prevent pollution of system TCPHandler.ForceDisconnect(data); } }