SMP Headless.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // SMP Headless.cpp : Diese Anwendung committet alle änderungen und lädt sie zu allen verfügbaren patch servern hoch
  2. //
  3. #include <Globals.h>
  4. #include <iostream>
  5. #include <string>
  6. #include "../SMP/Programm/Version/Version.h"
  7. #include "../SMP/Programm/Server/Patch/PatchServer.h"
  8. int main()
  9. {
  10. Framework::initFramework();
  11. std::cout << " _ __ _____ _____ _____ __ __ _____ \n"
  12. " | |/ // ____|/ ____| / ____| \\/ | __ \\ \n"
  13. " | ' /| (___ | | __ | (___ | \\ / | |__) |\n"
  14. " | < \\___ \\| | |_ | \\___ \\| |\\/| | ___/\n"
  15. " | . \\ ____) | |__| | ____) | | | | |\n"
  16. " |_|\\_\\_____ /\\_____| |_____/|_| |_|_| \n\n";
  17. InitDatei *iD = new InitDatei( "data/start/optionen.ini" );
  18. iD->laden();
  19. std::string login;
  20. std::string password;
  21. AdminAccount *account = 0;
  22. MSKlient *msk = new MSKlient( iD->zWert( "MainServerIP" )->getText(), TextZuInt( iD->zWert( "MainServerPort" )->getText(), 10 ) );
  23. while( true )
  24. {
  25. std::cout << "login: ";
  26. std::getline( std::cin, login );
  27. std::cout << "password: ";
  28. HANDLE hStdin = GetStdHandle( STD_INPUT_HANDLE );
  29. DWORD mode = 0;
  30. GetConsoleMode( hStdin, &mode );
  31. SetConsoleMode( hStdin, mode & ( ~ENABLE_ECHO_INPUT ) );
  32. std::getline( std::cin, password );
  33. GetConsoleMode( hStdin, &mode );
  34. SetConsoleMode( hStdin, mode | ENABLE_ECHO_INPUT );
  35. if( msk->login( login.c_str(), password.c_str() ) )
  36. account = new AdminAccount( login.c_str(), password.c_str() );
  37. if( account )
  38. break;
  39. std::cout << "\nFehler\n";
  40. }
  41. std::cout << "\nVersionskontrolle\n";
  42. Version *v = new Version( 0, msk->getThis(), 0, account->getThis(), 0 );
  43. v->commitAll();
  44. v->release();
  45. PatchServer *s = new PatchServer( 0, iD->getThis(), msk->getThis(), 0, account->getThis(), 0 );
  46. s->setSichtbar( 1 );
  47. s->updateAll();
  48. s->release();
  49. account->release();
  50. msk->release();
  51. iD->release();
  52. Framework::releaseFramework();
  53. }