private static unsafe void OnClientReceive(WinsockClient Socket, byte[] Packet, int Length) { AuthClient Client = Socket.Wrapper as AuthClient; Client.Decrypt(Packet); fixed(byte *pPacket = Packet) { ushort Size = *(ushort *)pPacket; ushort Type = *(ushort *)(pPacket + 2); HexDump(Packet, "Client -> Server", Size, Type); switch (Type) { case 0x41B: { AuthRequest *Request = (AuthRequest *)pPacket; string Username = new string(Request->Username, 0, 16).Trim('\x00'); string Password = PasswordCipher.Decrypt((uint *)Request->Password); string Server = new string(Request->Server, 0, 16).Trim('\x00'); string Address = ""; if (Database.ServerExists(Server, out Address)) { if (Database.AccountExists(Username, Password, Client)) { #if LOCAL_VERSION IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress address in entry.AddressList) { if (address.AddressFamily == AddressFamily.InterNetwork) { string local_ip = address.ToString(); if (local_ip.StartsWith("10")) { Address = local_ip; break; } } } #endif SendAuthResponse(Client, Address, 5816); } else { SendAuthReject(Client, InvalidCredentials()); //Client.Disconnect(); } } } break; } } }