buggy!!!
This commit is contained in:
@@ -112,14 +112,20 @@ ConfigFile::ConfigFile(bool configFirstStart)
|
|||||||
if (configFirstStart) {
|
if (configFirstStart) {
|
||||||
//Prüfen ob Configfile existiert --> sonst anlegen
|
//Prüfen ob Configfile existiert --> sonst anlegen
|
||||||
TiXmlDocument doc(configFileName);
|
TiXmlDocument doc(configFileName);
|
||||||
if(!doc.LoadFile()){ createDefaultConfig(); }
|
if(!doc.LoadFile()){
|
||||||
|
CONFIGSTATE = INEXISTENT;
|
||||||
|
updateConfig(CONFIGSTATE);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
//Prüfen ob die Revision stimmt ansonsten löschen und neue anlegen
|
//Prüfen ob die Revision stimmt ansonsten löschen und neue anlegen
|
||||||
int temp = 0;
|
int temp = 0;
|
||||||
TiXmlHandle docHandle( &doc );
|
TiXmlHandle docHandle( &doc );
|
||||||
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement();
|
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement();
|
||||||
if ( conf ) { conf->QueryIntAttribute("value", &temp ); }
|
if ( conf ) { conf->QueryIntAttribute("value", &temp ); }
|
||||||
if (temp < configRev) { /*löschen()*/ createDefaultConfig() ;}
|
if (temp < configRev) { /*löschen()*/
|
||||||
|
CONFIGSTATE = OLD;
|
||||||
|
updateConfig(CONFIGSTATE) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +135,7 @@ ConfigFile::~ConfigFile()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigFile::createDefaultConfig() {
|
void ConfigFile::updateConfig(CONFIGSTATE) {
|
||||||
|
|
||||||
QtToolsInterface *myQtToolsInterface = new QtToolsWrapper;
|
QtToolsInterface *myQtToolsInterface = new QtToolsWrapper;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
enum CONFIGSTATE { Inexistens, Old };
|
||||||
|
|
||||||
class ConfigFile{
|
class ConfigFile{
|
||||||
public:
|
public:
|
||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
~ConfigFile();
|
~ConfigFile();
|
||||||
|
|
||||||
void createDefaultConfig();
|
void updateConfig(CONFIGSTATE);
|
||||||
|
|
||||||
std::string readConfigString(std::string varName);
|
std::string readConfigString(std::string varName);
|
||||||
void writeConfigString(std::string varName, std::string varCont);
|
void writeConfigString(std::string varName, std::string varCont);
|
||||||
@@ -46,6 +46,7 @@ private:
|
|||||||
std::string dataDir;
|
std::string dataDir;
|
||||||
int configRev;
|
int configRev;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user