protected override void Dispatch(InPacket inPacket) { try { #if DEBUG Log.Hex("<<< Received (0x{0:X2}) packet from {1}: ", inPacket.Content, inPacket.OperationCode, this.Title); #endif if (inPacket.OperationCode == (ushort)ClientOpcode.SERVER) { short Header = inPacket.ReadShort(); // Read header inPacket.ReadInt(); // Original length + CRC inPacket.ReadInt(); #if DEBUG Log.Debug("^^^--- <<< Received opcode (0x{0:X}): ", Header); #endif switch ((ClientOpcode)Header) { case ClientOpcode.MYCHAR_INFO_REQ: Log.Debug("Send >> CharHandler.MyChar_Info_Req"); CharHandler.MyChar_Info_Req(inPacket, this); break; case ClientOpcode.CREATE_MYCHAR_REQ: Log.Debug("Send >> CharHandler.Create_MyChar_Req"); CharHandler.Create_MyChar_Req(inPacket, this); break; case ClientOpcode.CHECK_SAMENAME_REQ: Log.Debug("Send >> CharHandler.Check_SameName_Req"); CharHandler.Check_SameName_Req(inPacket, this); break; case ClientOpcode.DELETE_MYCHAR_REQ: Log.Debug("Send >> CharHandler.Delete_MyChar_Req"); CharHandler.Delete_MyChar_Req(inPacket, this); break; case ClientOpcode.CREATE_PREVIEW_REQ: Log.Debug("Send >> CharHandler.Create_Preview_Req"); CharHandler.Create_Preview_Req(inPacket, this); break; case ClientOpcode.CHAR_PAGE2_REQ: Log.Debug("Send >> CharHandler.Char_page2_preview "); CharHandler.Char_page2_preview(inPacket, this); break; } } } catch (HackException e) { Log.Warn("Hack from {0}: \n{1}", this.Account.Username, e.ToString()); } catch (Exception e) { Log.Error("Unhandled exception from {0}: \n{1}", this.Title, e.ToString()); } }
protected override void Dispatch(InPacket inPacket) { try { Log.Hex("Received (0x{0:X2}) packet from {1}: ", inPacket.Content, inPacket.OperationCode, this.Title); if (inPacket.OperationCode == (ushort)ClientOpcode.SERVER) { var Header = inPacket.ReadShort(); // 讀取包頭 inPacket.ReadInt(); // 原始長度 + CRC inPacket.ReadInt(); switch ((ClientOpcode)Header) { case ClientOpcode.MYCHAR_INFO_REQ: CharHandler.MyChar_Info_Req(inPacket, this); break; case ClientOpcode.CREATE_MYCHAR_REQ: CharHandler.Create_MyChar_Req(inPacket, this); break; case ClientOpcode.CHECK_SAMENAME_REQ: CharHandler.Check_SameName_Req(inPacket, this); break; case ClientOpcode.DELETE_MYCHAR_REQ: CharHandler.Delete_MyChar_Req(inPacket, this); break; } } } catch (HackException e) { Log.Warn("Hack from {0}: \n{1}", this.Account.Username, e.ToString()); } catch (Exception e) { Log.Error("Unhandled exception from {0}: \n{1}", this.Title, e.ToString()); } }