From 50d9907af2522a9a6e02a171b9a26938a743971c Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Thu, 24 Sep 2015 22:10:19 +0200 Subject: Save session to CrServerManager.session on detach and load it on reattaching --- src/crsm.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/crsm.cpp') diff --git a/src/crsm.cpp b/src/crsm.cpp index 4506c4b..2e7f1a4 100644 --- a/src/crsm.cpp +++ b/src/crsm.cpp @@ -62,8 +62,11 @@ CRSM::CRSM(QObject *parent) : if(processManager->isRunning()) { + Session.read(SESSION_FILE_NAME, false); writeToServer("Server Manager läuft wieder.\nBis zur nächsten Runde könnte unerwartetes Verhalten auftreten.\n"); } + QFile sessionFile(SESSION_FILE_NAME); + if(sessionFile.exists()) sessionFile.remove(); setupCmds(); @@ -275,6 +278,11 @@ void CRSM::readServerOutput() { Session.CountDown = countDownExp.cap(1).toInt(); } + static QRegExp countDownExp2(R"(^(\d+)\.\.\.)"); + if(countDownExp2.exactMatch(what)) + { + Session.CountDown = countDownExp2.cap(1).toInt(); + } static QRegExp countDownStopExp("^(?:Spielstart abgebrochen\\.|Game start aborted\\.)"); if(countDownStopExp.exactMatch(what)) @@ -294,6 +302,7 @@ void CRSM::readInput() } Config.Auto.ProcessManager.ReattachId = processManager->ID(); writeConfig(); + Session.write(SESSION_FILE_NAME); QCoreApplication::quit(); return; } @@ -2042,6 +2051,7 @@ CMD_FUNCTION_IMPL(exit) CMD_FUNCTION_IMPL(exitDetach) Config.Auto.ProcessManager.ReattachId = processManager->ID(); writeConfig(); + Session.write(SESSION_FILE_NAME); QCoreApplication::quit(); } -- cgit v1.2.3-54-g00ecf