This commit is contained in:
doitux
2007-05-05 20:11:49 +00:00
parent e72c25203b
commit 7b6be9d750
2 changed files with 13 additions and 6 deletions
+9 -3
View File
@@ -112,14 +112,20 @@ ConfigFile::ConfigFile(bool configFirstStart)
if (configFirstStart) {
//Prüfen ob Configfile existiert --> sonst anlegen
TiXmlDocument doc(configFileName);
if(!doc.LoadFile()){ createDefaultConfig(); }
if(!doc.LoadFile()){
CONFIGSTATE = INEXISTENT;
updateConfig(CONFIGSTATE);
}
else {
//Prüfen ob die Revision stimmt ansonsten löschen und neue anlegen
int temp = 0;
TiXmlHandle docHandle( &doc );
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement();
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;
+4 -3
View File
@@ -23,15 +23,15 @@
#include "tinyxml.h"
#include <string>
enum CONFIGSTATE { Inexistens, Old };
class ConfigFile{
public:
ConfigFile(bool configFirstStart =0);
~ConfigFile();
void createDefaultConfig();
void updateConfig(CONFIGSTATE);
std::string readConfigString(std::string varName);
void writeConfigString(std::string varName, std::string varCont);
@@ -45,6 +45,7 @@ private:
std::string logDir;
std::string dataDir;
int configRev;
};