Beispiel #1
0
void RhoSettings::readChanges()
{
    String strTimestamp;
    CRhoFile::readStringFromFile((getConfFilePath()+CONF_TIMESTAMP).c_str(), strTimestamp);

    if ( CRhoFile::isFileExist((getConfFilePath()+CONF_CHANGES).c_str()) )
    {
        String strSettings;
        CRhoFile::readStringFromFile((getConfFilePath()+CONF_CHANGES).c_str(), strSettings);
        loadFromString( strSettings.c_str(), m_mapChangedValues );

        String strOldTimestamp = "";
	    Hashtable<String,String>::iterator it = m_mapChangedValues.find(CONF_TIMESTAMP_PROP);
        if ( it != m_mapChangedValues.end() )
            strOldTimestamp = it->second;
        
        if ( strTimestamp.compare(strOldTimestamp) != 0 )
            checkConflicts();

        loadFromString( strSettings.c_str(), m_mapValues );
    }else
    {
        m_mapChangedValues.put(CONF_TIMESTAMP_PROP,strTimestamp);
    }
}
Beispiel #2
0
void RhoSettings::loadFromFile(){
    common::CRhoFile oFile;
    if ( oFile.open( getConfFilePath().c_str(), common::CRhoFile::OpenReadOnly) ){
        String strSettings;
        oFile.readString(strSettings);
        loadFromString( strSettings.c_str() );
    }
}
Beispiel #3
0
void RhoSettings::saveToFile(){
    String strData;
    saveToString(strData);

    common::CRhoFile oFile;
    oFile.open(  getConfFilePath().c_str(), common::CRhoFile::OpenForWrite);

    oFile.write( strData.c_str(), strData.size() );
}
Beispiel #4
0
void RhoSettings::loadFromFile()
{
    m_mapValues.clear();
    m_mapChangedValues.clear();

    String strSettings;
    CRhoFile::readStringFromFile(getConfFilePath().c_str(), strSettings);
    loadFromString( strSettings.c_str(), m_mapValues );

    readChanges();
}
Beispiel #5
0
void RhoSettings::conflictsResolved()
{
    if (m_mapConflictedValues.size() == 0 )
        return;

    String strTimestamp;
    CRhoFile::readStringFromFile((getConfFilePath()+CONF_TIMESTAMP).c_str(), strTimestamp);

    setString(CONF_TIMESTAMP_PROP, strTimestamp, true);
    m_mapConflictedValues.clear();
}
Beispiel #6
0
void RhoSettings::saveToFile(const char* szName)
{
    m_mapChangedValues.put(szName, getString(szName) );

    String strData;
    saveChangesToString(strData);

    CRhoFile oFile;
    oFile.open( (getConfFilePath()+CONF_CHANGES).c_str(), common::CRhoFile::OpenForWrite);
    oFile.write( strData.c_str(), strData.size() );
}