Пример #1
0
 private void Login(string[] args)
 {
     if ((int)ServerConfigManager.MyConfigs["maxUserCount"] == CurrServerDB.getLoggedUserCount())
     {
         CurrClient.Send((int)ServerCommand.ServerIsFull);
     }
     if (CurrClient.UserID != "")
     {
         CurrClient.Send((int)ServerCommand.AlreadyLogged); return;
     }
     //if ((bool)ServerConfigManager.MyConfigs["isServerPrivate"]) { CurrClient.Send((int)ServerCommand.ServerIsPrivate); return; }
     if (args.Length == 2)
     {
         string        username = args[0]; string password = args[1];
         ServerCommand cmd = CurrServerDB.Login(username, password);
         if (cmd == ServerCommand.isLogged)
         {
             CurrClient.UserID = CurrServerDB.getIdByUsername(username).ToString();
         }
         if (cmd == ServerCommand.NewUserRegistered)
         {
             CurrClient.UserID = CurrServerDB.getIdByUsername(username).ToString();
         }
         CurrClient.Send((int)cmd);
     }
     else
     {
         Console.WriteLine("Zu viele Parameter beim Login: " + CurrClient.EndPoint.ToString());
         CurrClient.Send((int)ServerCommand.WrongArgs);
     }
 }