コード例 #1
0
        private static void ClientLoginRequest(Socket clientSocket, List <string> content)
        {
            Dictionary <string, object> accountData = CuentaNetwork.TryLogin(content[1], content[2]);

            if (accountData.Count == 0)
            {
                IList <ArraySegment <byte> > serverResponse = CreateServerResponse(NetworkServerResponses.LoginError);
                Send(clientSocket, serverResponse);
            }
            else
            {
                if ((short)accountData["confirmado"] == 0)
                {
                    IList <ArraySegment <byte> > serverResponse = CreateServerResponse(NetworkServerResponses.AccountNotConfirmed);
                    Send(clientSocket, serverResponse);
                    return;
                }
                IList <ArraySegment <byte> > accountDataPackage = CreatePackage(accountData);
                Send(clientSocket, accountDataPackage);
                Console.WriteLine(">> " + accountData["usuario"] + " has logged in.");
                clients[clientSocket] = (int)accountData["idcuenta"];
            }
        }