static void Socket_SocketConnection_PacketReceived_Event(SocketConnection socketConnection, Packet pak) { if (pak.IsValid()) { uint Header = pak.Readuint(); switch (Header) { case Packets.PAK_CLI_LGNRQST: PacketHandlers.HandleLoginRequest(socketConnection, pak); break; case Packets.PAK_CLI_FRNDLSTRQST: PacketHandlers.HandleFriendListRequest(socketConnection, pak); break; case Packets.PAK_CLI_MEMINFORQST: PacketHandlers.HandleMemberInfoRequest(socketConnection, pak); break; case Packets.PAK_CLI_SNDMSG: PacketHandlers.HandleMessageSend(socketConnection, pak); break; case Packets.PAK_CLI_CHNGSTSRQST: PacketHandlers.HandleStatusChangeRequest(socketConnection, pak); break; case Packets.PAK_CLI_OFFLNMSGRQST: PacketHandlers.HandleOfflineMessagesRequest(socketConnection, pak); break; case Packets.PAK_CLI_FRNDADDRQST: PacketHandlers.HandleFriendAddRequest(socketConnection, pak); break; case Packets.PAK_CLI_FRNDDNYRQST: PacketHandlers.HandleFriendDenyRequest(socketConnection, pak); break; case Packets.PAK_CLI_CHNGUPDTRQST: PacketHandlers.HandleChangeUpdateRequest(socketConnection, pak); break; case Packets.PAK_CLI_FRNDRMVRQST: PacketHandlers.HandleFriendRemoveRequest(socketConnection, pak); break; case Packets.PAK_CLI_CALL_RQST: PacketHandlers.HandleCallRequest(socketConnection, pak); break; case Packets.PAK_CLI_CALL_ACC: PacketHandlers.HandleCallAccept(socketConnection, pak); break; case Packets.PAK_CLI_CALL_DNY: PacketHandlers.HandleCallDeny(socketConnection, pak); break; default: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid packet from {0}, 0x{1:X}", socketConnection.IP, Header); break; } } else { //Console.ForegroundColor = ConsoleColor.Red; //Console.WriteLine("Invalid packet from {0}", socketConnection.IP); //socketConnection.clientSocket.Close(); } }