Index: src/ch/MainWnd.cpp =================================================================== diff -u -rd32a79f0e9220bad2c6eeb5e8a986228b6e832fb -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision d32a79f0e9220bad2c6eeb5e8a986228b6e832fb) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -186,7 +186,11 @@ // Create the tray icon ShowTrayIcon(); - LoadTaskManager(); + if(!LoadTaskManager()) + { + LOG_ERROR(_T("Couldn't load task manager data. User did not allow re-creation of the database.")); + return -1; + } // import tasks specified at command line (before loading current tasks) const TCommandLineParser& cmdLine = GetApp().GetCommandLine(); @@ -199,64 +203,10 @@ LOG_INFO(_T("Starting clipboard monitor...")); CClipboardMonitor::StartMonitor(m_spTasks.get()); - EUpdatesFrequency eFrequency = (EUpdatesFrequency)GetPropValue(GetConfig()); - if(eFrequency != eFreq_Never) - { - unsigned long long ullMinInterval = 0; - switch(eFrequency) - { - case eFreq_Daily: - ullMinInterval = 1*24*60*60; - break; - case eFreq_Weekly: - ullMinInterval = 7*24*60*60; - break; - case eFreq_OnceEvery2Weeks: - ullMinInterval = 14*24*60*60; - break; - case eFreq_Monthly: - ullMinInterval = 30*24*60*60; // we don't really care if it is a day less or more - break; - case eFreq_Quarterly: - ullMinInterval = 90*24*60*60; - break; - case eFreq_EveryStartup: - default: - ullMinInterval = 0; - } + CheckForUpdates(); - // get last check time stored in configuration - unsigned long long ullCurrentStamp = _time64(NULL); - unsigned long long ullTimestamp = GetPropValue(GetConfig()); + SetupTimers(); - // perform checking for updates only when the minimal interval has passed - if(ullCurrentStamp - ullTimestamp >= ullMinInterval) - { - LOG_INFO(_T("Checking for updates...")); - - CUpdaterDlg* pDlg = new CUpdaterDlg(true); - pDlg->m_bAutoDelete = true; - - pDlg->Create(); - chcore::TConfig& rConfig = GetConfig(); - try - { - SetPropValue(rConfig, _time64(NULL)); - rConfig.Write(); - } - catch(icpf::exception& /*e*/) - { - LOG_ERROR(_T("Storing last update check timestamp in configuration failed")); - } - } - } - - // start saving timer - SetTimer(1023, GetPropValue(GetConfig()), NULL); - - SetTimer(3245, TM_AUTOREMOVE, NULL); - SetTimer(8743, TM_ACCEPTING, NULL); // ends wait state in tasks - if (GetPropValue(GetConfig())) PostMessage(WM_SHOWMINIVIEW); } @@ -285,20 +235,40 @@ return 0; } -void CMainWnd::LoadTaskManager() +bool CMainWnd::LoadTaskManager() { using namespace chcore; + CString strError; CString strTasksDir = GetTasksDirectory(); TSQLiteSerializerFactoryPtr spSerializerFactory(new TSQLiteSerializerFactory(PathFromString(strTasksDir))); - m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, m_pFeedbackFactory)); + try + { + m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, m_pFeedbackFactory)); + } + catch(const std::exception& e) + { + strError = e.what(); + } + if(!strError.IsEmpty()) + { + if(MsgBox(IDS_TASKMANAGER_LOAD_FAILED, MB_ICONERROR | MB_OKCANCEL) == IDOK) + { + m_spTasks.reset(new chcore::TTaskManager(spSerializerFactory, m_pFeedbackFactory, true)); + } + else + return false; + } + // load last state LOG_INFO(_T("Loading existing tasks...")); // load tasks m_spTasks->Load(); + + return true; } LRESULT CMainWnd::OnTrayNotification(WPARAM wParam, LPARAM lParam) @@ -945,3 +915,67 @@ strPath += _T("\\Tasks\\"); return strPath; } + +void CMainWnd::CheckForUpdates() +{ + EUpdatesFrequency eFrequency = (EUpdatesFrequency)GetPropValue(GetConfig()); + if(eFrequency != eFreq_Never) + { + unsigned long long ullMinInterval = 0; + switch(eFrequency) + { + case eFreq_Daily: + ullMinInterval = 1*24*60*60; + break; + case eFreq_Weekly: + ullMinInterval = 7*24*60*60; + break; + case eFreq_OnceEvery2Weeks: + ullMinInterval = 14*24*60*60; + break; + case eFreq_Monthly: + ullMinInterval = 30*24*60*60; // we don't really care if it is a day less or more + break; + case eFreq_Quarterly: + ullMinInterval = 90*24*60*60; + break; + case eFreq_EveryStartup: + default: + ullMinInterval = 0; + } + + // get last check time stored in configuration + unsigned long long ullCurrentStamp = _time64(NULL); + unsigned long long ullTimestamp = GetPropValue(GetConfig()); + + // perform checking for updates only when the minimal interval has passed + if(ullCurrentStamp - ullTimestamp >= ullMinInterval) + { + LOG_INFO(_T("Checking for updates...")); + + CUpdaterDlg* pDlg = new CUpdaterDlg(true); + pDlg->m_bAutoDelete = true; + + pDlg->Create(); + chcore::TConfig& rConfig = GetConfig(); + try + { + SetPropValue(rConfig, _time64(NULL)); + rConfig.Write(); + } + catch(icpf::exception& /*e*/) + { + LOG_ERROR(_T("Storing last update check timestamp in configuration failed")); + } + } + } +} + +void CMainWnd::SetupTimers() +{ + // start saving timer + SetTimer(1023, GetPropValue(GetConfig()), NULL); + + SetTimer(3245, TM_AUTOREMOVE, NULL); + SetTimer(8743, TM_ACCEPTING, NULL); // ends wait state in tasks +} Index: src/ch/MainWnd.h =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/ch/MainWnd.h (.../MainWnd.h) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/ch/MainWnd.h (.../MainWnd.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -50,15 +50,16 @@ CString GetTasksDirectory() const; + void SetupTimers(); + void CheckForUpdates(); + bool LoadTaskManager(); + afx_msg void OnPopupShowStatus(); afx_msg void OnPopupShowOptions(); afx_msg void OnClose(); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - - void LoadTaskManager(); - afx_msg void OnShowMiniView(); afx_msg void OnPopupCustomCopy(); afx_msg void OnAppAbout(); Index: src/ch/ch.rc =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/ch/ch.rc (.../ch.rc) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/ch/ch.rc (.../ch.rc) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -1085,6 +1085,7 @@ IDS_CH_PORTABLE_STRING " (portable mode)" IDS_TASK_IMPORT_FAILED "Failed to import task '%path'." IDS_TASK_CREATE_FAILED "Cannot create new task. Reason: %reason." + IDS_TASKMANAGER_LOAD_FAILED "Failed to load task list database. Copy Handler will create a new, empty database for you." END STRINGTABLE Index: src/ch/resource.h =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/ch/resource.h (.../resource.h) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/ch/resource.h (.../resource.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -372,6 +372,7 @@ #define IDS_CH_PORTABLE_STRING 5030 #define IDS_TASK_IMPORT_FAILED 5031 #define IDS_TASK_CREATE_FAILED 5032 +#define IDS_TASKMANAGER_LOAD_FAILED 5033 #define IDS_ONECOPY_STRING 6000 #define IDS_REGISTEROK_STRING 6001 #define IDS_REGISTERERR_STRING 6002 Index: src/libchcore/ErrorCodes.h =================================================================== diff -u -r3397fd021739bea537248415a7b4fc2712dd2320 -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision 3397fd021739bea537248415a7b4fc2712dd2320) +++ src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -72,6 +72,7 @@ // Filesystem errors (3000+) eErr_FixedDriveWithoutDriveLetter = 3000, eErr_CannotGetFileInfo = 3001, + eErr_CannotDeleteFile = 3002, // Task handling errors (4000+) eErr_MissingTaskSerializationPath = 4000, Index: src/libchcore/ISerializerFactory.h =================================================================== diff -u -rd32a79f0e9220bad2c6eeb5e8a986228b6e832fb -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/ISerializerFactory.h (.../ISerializerFactory.h) (revision d32a79f0e9220bad2c6eeb5e8a986228b6e832fb) +++ src/libchcore/ISerializerFactory.h (.../ISerializerFactory.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -37,7 +37,7 @@ public: virtual ~ISerializerFactory(); - virtual ISerializerPtr CreateSerializer(EObjectType eObjType, const TString& strNameHint = _T("")) = 0; + virtual ISerializerPtr CreateSerializer(EObjectType eObjType, const TString& strNameHint = _T(""), bool bForceRecreate = false) = 0; }; typedef boost::shared_ptr ISerializerFactoryPtr; Index: src/libchcore/TSQLiteSerializer.cpp =================================================================== diff -u -r31c4b1fc46687ed2cf35dd9fa0acec2543ae1886 -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TSQLiteSerializer.cpp (.../TSQLiteSerializer.cpp) (revision 31c4b1fc46687ed2cf35dd9fa0acec2543ae1886) +++ src/libchcore/TSQLiteSerializer.cpp (.../TSQLiteSerializer.cpp) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -57,13 +57,14 @@ { TSQLiteTransaction tran(m_spDatabase); - for(ContainerMap::iterator iterContainer = m_mapContainers.begin(); iterContainer != m_mapContainers.end(); ++iterContainer) { iterContainer->second->Flush(); } tran.Commit(); + + m_mapContainers.clear(); } END_CHCORE_NAMESPACE Index: src/libchcore/TSQLiteSerializerFactory.cpp =================================================================== diff -u -rd32a79f0e9220bad2c6eeb5e8a986228b6e832fb -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TSQLiteSerializerFactory.cpp (.../TSQLiteSerializerFactory.cpp) (revision d32a79f0e9220bad2c6eeb5e8a986228b6e832fb) +++ src/libchcore/TSQLiteSerializerFactory.cpp (.../TSQLiteSerializerFactory.cpp) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -39,7 +39,7 @@ { } -ISerializerPtr TSQLiteSerializerFactory::CreateSerializer(EObjectType eObjType, const TString& strNameHint) +ISerializerPtr TSQLiteSerializerFactory::CreateSerializer(EObjectType eObjType, const TString& strNameHint, bool bForceRecreate) { switch(eObjType) { @@ -53,28 +53,54 @@ strName = boost::lexical_cast(u).c_str(); } - if(!strName.EndsWithNoCase(_T(".sqlite"))) - strName += _T(".sqlite"); + TSmartPath pathTask = PathFromString(strNameHint); + if(!pathTask.HasFileRoot()) + { + if(!strName.EndsWithNoCase(_T(".sqlite"))) + strName += _T(".sqlite"); - TSmartPath pathTask(m_pathSerializeDir); - pathTask += PathFromString(strName); + TSmartPath pathTask(m_pathSerializeDir); + pathTask += PathFromString(strName); + } + if(bForceRecreate) + { + if(!DeleteFile(pathTask.ToString())) + { + DWORD dwLastError = GetLastError(); + if(dwLastError != ERROR_FILE_NOT_FOUND) + THROW_CORE_EXCEPTION_WIN32(eErr_CannotDeleteFile, dwLastError); + } + } + TSQLiteSerializerPtr spSerializer(new TSQLiteSerializer( pathTask, TSQLiteTaskSchemaPtr(new TSQLiteTaskSchema))); return spSerializer; } + case ISerializerFactory::eObj_TaskManager: { TSmartPath pathTaskManager = m_pathSerializeDir + PathFromString(_T("tasks.sqlite")); + if(bForceRecreate) + { + if(!DeleteFile(pathTaskManager.ToString())) + { + DWORD dwLastError = GetLastError(); + if(dwLastError != ERROR_FILE_NOT_FOUND) + THROW_CORE_EXCEPTION_WIN32(eErr_CannotDeleteFile, dwLastError); + } + } + TSQLiteSerializerPtr spSerializer(new TSQLiteSerializer( pathTaskManager, TTaskManagerSchemaPtr(new TSQLiteTaskManagerSchema))); return spSerializer; } + default: THROW_CORE_EXCEPTION(eErr_InvalidArgument); } Index: src/libchcore/TSQLiteSerializerFactory.h =================================================================== diff -u -rd32a79f0e9220bad2c6eeb5e8a986228b6e832fb -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TSQLiteSerializerFactory.h (.../TSQLiteSerializerFactory.h) (revision d32a79f0e9220bad2c6eeb5e8a986228b6e832fb) +++ src/libchcore/TSQLiteSerializerFactory.h (.../TSQLiteSerializerFactory.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -31,7 +31,7 @@ TSQLiteSerializerFactory(const TSmartPath& pathSerializeDir); virtual ~TSQLiteSerializerFactory(); - virtual ISerializerPtr CreateSerializer(EObjectType eObjType, const TString& strNameHint = _T("")); + virtual ISerializerPtr CreateSerializer(EObjectType eObjType, const TString& strNameHint = _T(""), bool bForceRecreate = false); private: TSmartPath m_pathSerializeDir; Index: src/libchcore/TSQLiteSerializerRowData.cpp =================================================================== diff -u -r1875711000138ff9d4185c2e3e74d455533de8a8 -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision 1875711000138ff9d4185c2e3e74d455533de8a8) +++ src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -23,6 +23,81 @@ BEGIN_CHCORE_NAMESPACE +namespace +{ + struct SQLiteBindValueVisitor : public boost::static_visitor<> + { + private: + SQLiteBindValueVisitor& operator=(const SQLiteBindValueVisitor&); + + public: + SQLiteBindValueVisitor(sqlite::TSQLiteStatement& rStatement, int& rColumn) : m_rStatement(rStatement), m_rColumn(rColumn) {} + + void operator()(bool value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(short value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(unsigned short value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(int value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(unsigned int value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(long value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(unsigned long value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(long long value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(unsigned long long value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(double value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(const TString& value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + void operator()(const TSmartPath& value) const + { + m_rStatement.BindValue(m_rColumn++, value); + } + + int& m_rColumn; + sqlite::TSQLiteStatement& m_rStatement; + }; +} + TSQLiteSerializerRowData::TSQLiteSerializerRowData(size_t stRowID, const TSQLiteColumnDefinitionPtr& spColumnDefinition, bool bAdded) : m_stRowID(stRowID), m_spColumns(spColumnDefinition), @@ -58,107 +133,62 @@ return *this; } -struct BindingVisitor : public boost::static_visitor<> +void TSQLiteSerializerRowData::Flush(const sqlite::TSQLiteDatabasePtr& spDatabase, const TString& strContainerName) { -private: - BindingVisitor& operator=(const BindingVisitor&); + using namespace sqlite; -public: - BindingVisitor(sqlite::TSQLiteStatement& rStatement, int& rColumn) : m_rStatement(rStatement), m_rColumn(rColumn) {} + TSQLiteStatement tStatement(spDatabase); - void operator()(bool value) const + if(m_bAdded) { - m_rStatement.BindValue(m_rColumn++, value); - } + // prepare insert query + TString strQuery = boost::str(boost::wformat(L"INSERT INTO %1%(") % strContainerName).c_str(); + TString strParams; - void operator()(short value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } + for(MapVariants::iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) + { + strQuery += boost::str(boost::wformat(_T("%1%,")) % m_spColumns->GetColumnName(iterVariant->first)).c_str(); + strParams += _T("?,"); + } - void operator()(unsigned short value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } + strQuery.TrimRightSelf(_T(",")); + strQuery += _T(") VALUES("); - void operator()(int value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } + strParams.TrimRightSelf(_T(",")); + strQuery += strParams; + strQuery += _T(")"); - void operator()(unsigned int value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } + // exec query + int iColumn = 1; + tStatement.Prepare(strQuery); + for(MapVariants::iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) + { + boost::apply_visitor(SQLiteBindValueVisitor(tStatement, iColumn), iterVariant->second); + } - void operator()(long value) const - { - m_rStatement.BindValue(m_rColumn++, value); + tStatement.Step(); } - - void operator()(unsigned long value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(long long value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(unsigned long long value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(double value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(const TString& value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(const TSmartPath& value) const - { - m_rStatement.BindValue(m_rColumn++, value); - } - - int& m_rColumn; - sqlite::TSQLiteStatement& m_rStatement; -}; - -void TSQLiteSerializerRowData::Flush(const sqlite::TSQLiteDatabasePtr& spDatabase, const TString& strContainerName) -{ - using namespace sqlite; - - TSQLiteStatement tStatement(spDatabase); - - if(m_bAdded) - { - // insert into container_name(col1, col2) values(val1, val2) - } else { - // update container_name set col1=val1, col2=val2 where id=? - TString strPairs = boost::str(boost::wformat(L"UPDATE %1% SET ") % strContainerName).c_str(); + // prepare update query + TString strQuery = boost::str(boost::wformat(L"UPDATE %1% SET ") % strContainerName).c_str(); - int iColumn = 0; for(MapVariants::iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) { - strPairs += boost::str(boost::wformat(_T("%1%=?,")) % m_spColumns->GetColumnName(iterVariant->first)).c_str(); + strQuery += boost::str(boost::wformat(_T("%1%=?,")) % m_spColumns->GetColumnName(iterVariant->first)).c_str(); + } + strQuery.TrimRightSelf(_T(",")); + strQuery += _T(" WHERE id=?"); - boost::apply_visitor(BindingVisitor(tStatement, iColumn), iterVariant->second); + int iColumn = 1; + tStatement.Prepare(strQuery); + for(MapVariants::iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) + { + boost::apply_visitor(SQLiteBindValueVisitor(tStatement, iColumn), iterVariant->second); } - - strPairs.TrimRightSelf(_T(",")); - strPairs += _T(" WHERE id=?"); tStatement.BindValue(iColumn++, m_stRowID); - - + tStatement.Step(); } } Index: src/libchcore/TString.cpp =================================================================== diff -u -rbe86ea000c8ee746379fd5018c9f43a9b1cddfa1 -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TString.cpp (.../TString.cpp) (revision be86ea000c8ee746379fd5018c9f43a9b1cddfa1) +++ src/libchcore/TString.cpp (.../TString.cpp) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -119,7 +119,7 @@ using namespace details; -size_t TString::npos = std::numeric_limits::max(); +const size_t TString::npos = std::numeric_limits::max(); /** Standard constructor - allocates the underlying data object */ Index: src/libchcore/TString.h =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TString.h (.../TString.h) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/libchcore/TString.h (.../TString.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -25,6 +25,7 @@ #include "libchcore.h" #include +#include BEGIN_CHCORE_NAMESPACE @@ -93,10 +94,6 @@ class LIBCHCORE_API TString { public: - static size_t npos; - static const size_t DefaultMaxStringSize = 65536; - -public: /** \name Construction/destruction */ /*@{*/ TString(); ///< Standard constructor @@ -219,8 +216,17 @@ protected: wchar_t* m_pszStringData; ///< Pointer to an underlying c string (with prepended TInternalStringData) + +public: + static const size_t npos; + static const size_t DefaultMaxStringSize = 65536; }; +inline std::wostream& operator<<(std::wostream& os, const TString& rString) +{ + return os << std::wstring((const wchar_t*)rString); +} + END_CHCORE_NAMESPACE LIBCHCORE_API chcore::TString operator+(const wchar_t* pszString, const chcore::TString& str); Index: src/libchcore/TTaskManager.cpp =================================================================== diff -u -r0c5027d5173ab0daeba6aa6b735a2b11d4cd2164 -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision 0c5027d5173ab0daeba6aa6b735a2b11d4cd2164) +++ src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -30,14 +30,16 @@ //////////////////////////////////////////////////////////////////////////////// // TTaskManager members -TTaskManager::TTaskManager(const ISerializerFactoryPtr& spSerializerFactory, IFeedbackHandlerFactory* piFeedbackHandlerFactory) : +TTaskManager::TTaskManager(const ISerializerFactoryPtr& spSerializerFactory, + IFeedbackHandlerFactory* piFeedbackHandlerFactory, + bool bForceRecreateSerializer) : m_stNextTaskID(NoTaskID + 1), m_spSerializerFactory(spSerializerFactory), m_piFeedbackFactory(piFeedbackHandlerFactory) { if(!piFeedbackHandlerFactory || !spSerializerFactory) THROW_CORE_EXCEPTION(eErr_InvalidPointer); - m_spSerializer = m_spSerializerFactory->CreateSerializer(ISerializerFactory::eObj_TaskManager); + m_spSerializer = m_spSerializerFactory->CreateSerializer(ISerializerFactory::eObj_TaskManager, _T(""), bForceRecreateSerializer); } TTaskManager::~TTaskManager() @@ -483,6 +485,7 @@ } } } + TSmartPath TTaskManager::CreateTaskLogPath(const TString& strTaskUuid) const { TSmartPath pathLog = m_pathLogDir + PathFromString(TString(_T("Task-")) + strTaskUuid + _T(".log")); Index: src/libchcore/TTaskManager.h =================================================================== diff -u -rd32a79f0e9220bad2c6eeb5e8a986228b6e832fb -r30297d6aab17483da8e7b8323b4d17ff1a9f78d6 --- src/libchcore/TTaskManager.h (.../TTaskManager.h) (revision d32a79f0e9220bad2c6eeb5e8a986228b6e832fb) +++ src/libchcore/TTaskManager.h (.../TTaskManager.h) (revision 30297d6aab17483da8e7b8323b4d17ff1a9f78d6) @@ -38,7 +38,10 @@ class LIBCHCORE_API TTaskManager { public: - TTaskManager(const ISerializerFactoryPtr& spSerializerFactory, IFeedbackHandlerFactory* piFeedbackHandlerFactory); + TTaskManager(const ISerializerFactoryPtr& spSerializerFactory, + IFeedbackHandlerFactory* piFeedbackHandlerFactory, + bool bForceRecreateSerializer = false); + ~TTaskManager(); void Store();