示例#1
0
void CMsvIndexContext::DoStoreConfigL()
	{
	// we only want to store the config file if it has changed,
	// we also don't care about UniqueIDs for the internal drive
	if(iConfig.iDebug!=iConfig.iDebugAsLoaded ||
		iConfig.iDrive!=iConfig.iDriveAsLoaded ||
		(iConfig.iDrive!=iServer.FileSession().GetSystemDrive() && iConfig.iUniqueID!=iConfig.iUniqueIDAsLoaded))
		{
		TChar driveChar= iServer.FileSession().GetSystemDriveChar();
		TBuf<2> systemDrive;
		systemDrive.Append(driveChar);
		systemDrive.Append(KDriveDelimiter);
	    TPath pathName(systemDrive);
		pathName.Append(KServerINIFile);
		CDictionaryFileStore *store=CDictionaryFileStore::OpenLC(iServer.FileSession(),pathName,KNullUid);
		RDictionaryWriteStream stream;
		stream.AssignLC(*store, KUidMsvMessageDriveStream);

		stream.WriteUint8L(KMsvMessageDriveStreamVersionNumber); // version number
		stream << iConfig.iDrive.Name();
		stream.WriteUint32L(iConfig.iUniqueID);
		stream.WriteInt8L(iConfig.iDebug);

		stream.CommitL();
		store->CommitL();
		CleanupStack::PopAndDestroy(2,store); // stream, store
		}
	}
示例#2
0
void CPingAppUi::StorePreferencesL(const TPreferences &aPreferences)
{
    CDictionaryStore *iniFile = Application()->OpenIniFileLC(iCoeEnv->FsSession());
    RDictionaryWriteStream writeStream;
    writeStream.AssignLC(*iniFile, KUidPingApp);
    writeStream.WriteUint8L (aPreferences.iFlags);
    writeStream.WriteUint16L (aPreferences.iLastSecWait);
    writeStream.WriteUint16L (aPreferences.iPacketDataSize);
    writeStream.WriteUint16L (aPreferences.iSecWait);
    writeStream.WriteUint16L (aPreferences.iTotalPackets);
    writeStream.WriteInt16L (aPreferences.iHostname.Length());
    writeStream.WriteL (aPreferences.iHostname);
    writeStream.WriteInt16L (aPreferences.iPattern.Length());
    writeStream.WriteL (aPreferences.iPattern);
   
#ifdef IAPSETTING
	writeStream.WriteUint16L (aPreferences.iIAP);
#endif
    //.... // and whatever

    writeStream.CommitL();
    CleanupStack::PopAndDestroy(); // write stream

    // in this replace XXVersionUid with another unique UID - usually the next one up from XXUid
    writeStream.AssignLC(*iniFile, KUidPingVersionUid); // write version 1.0 (major.minor)
    writeStream.WriteInt8L(1); // major
    writeStream.WriteInt8L(0); // minor
    writeStream.CommitL(); // flush
    CleanupStack::PopAndDestroy(); // writeStream;

    // commit changes to the store
    if (iniFile->Commit()!=KErrNone)
        iniFile->RevertL();

    CleanupStack::PopAndDestroy();
}