Index: src/ch/ch.cpp =================================================================== diff -u -rd9527df01ee91b35d9a5fdccb80ded25a9c8265f -r58de8d7360813537b384eff808c031f9e63db4de --- src/ch/ch.cpp (.../ch.cpp) (revision d9527df01ee91b35d9a5fdccb80ded25a9c8265f) +++ src/ch/ch.cpp (.../ch.cpp) (revision 58de8d7360813537b384eff808c031f9e63db4de) @@ -31,13 +31,13 @@ #include "CrashDlg.h" #include "../common/version.h" #include "TCommandLineParser.h" -#include "../libchcore/TStringSet.h" -#include "../libchcore/SerializerTrace.h" +#include "../libstring/TStringSet.h" #include "TMsgBox.h" #include "resource.h" #include "../liblogger/TLogger.h" #include "../liblogger/TAsyncMultiLogger.h" #include "TWindowMessageFilterHelper.h" +#include "../libchengine/TConfigSerializers.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -69,7 +69,7 @@ 0xac6e, 0x1e4c, 0x5667, 0x1942, 0x0a47, 0x1f80, 0x4191, 0x4f8d }; int iOffCount=12; -unsigned char off[]={ 2, 6, 3, 4, 8, 0, 1, 3, 2, 4, 1, 6 }; +unsigned char _off[]={ 2, 6, 3, 4, 8, 0, 1, 3, 2, 4, 1, 6 }; unsigned short _hash[]={ 0x3fad, 0x34cd, 0x7fff, 0x65ff, 0x4512, 0x0112, 0xabac, 0x1abc, 0x54ab, 0x1212, 0x0981, 0x0100 }; ///////////////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ theApp.OnResManNotify(uiMsg); } -void ConfigPropertyChangedCallback(const chcore::TStringSet& setPropNames, void* /*pParam*/) +void ConfigPropertyChangedCallback(const string::TStringSet& setPropNames, void* /*pParam*/) { theApp.OnConfigNotify(setPropNames); } @@ -124,13 +124,13 @@ return ictranslate::CResourceManager::Acquire(); } -chcore::TConfig& CCopyHandlerApp::GetConfig() +chengine::TConfig& CCopyHandlerApp::GetConfig() { - static chcore::TConfig tCfg; + static chengine::TConfig tCfg; return tCfg; } -int MsgBox(UINT uiID, UINT nType, UINT nIDHelp) +int CCopyHandlerApp::MsgBox(UINT uiID, UINT nType, UINT nIDHelp) { return AfxMessageBox(GetResManager().LoadString(uiID), nType, nIDHelp); } @@ -234,7 +234,7 @@ strCfgPath = strPath + _T("\\ch.xml"); // initialize configuration file - chcore::TConfig& rCfg = GetConfig(); + chengine::TConfig& rCfg = GetConfig(); rCfg.ConnectToNotifier(ConfigPropertyChangedCallback, nullptr); // read the configuration @@ -260,6 +260,12 @@ m_spEngineLoggerConfig->SetLogLevel(L"ST-CopyMove", (logger::ESeverityLevel)GetPropValue(rCfg)); m_spEngineLoggerConfig->SetLogLevel(L"ST-Delete", (logger::ESeverityLevel)GetPropValue(rCfg)); m_spEngineLoggerConfig->SetLogLevel(L"ST-ScanDirs", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer-RowReader", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer-RowData", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer-Container", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"TaskManager", (logger::ESeverityLevel)GetPropValue(rCfg)); + // also update CCopyHandlerApp::OnConfigNotify() with new channels // initialize the global log file if it is requested by configuration file CString strLogPath = strPath + _T("\\ch.log"); @@ -302,7 +308,7 @@ rResManager.Init(AfxGetInstanceHandle()); rResManager.SetCallback(ResManCallback); GetPropValue(rCfg, strPath); - TRACE(_T("Help path=%s\n"), strPath); + TRACE(_T("Help path=%s\n"), (PCTSTR)strPath); if(!rResManager.SetLanguage(m_pathProcessor.ExpandPath(strPath))) { TCHAR szData[2048]; @@ -319,17 +325,6 @@ EnableHtmlHelp(); - // ================================= Handle early command line options ======================================== - if(m_cmdLineParser.HasCommandLineParams() && m_cmdLineParser.HasSystemStartupOption()) - { - SetPropValue(rCfg, m_cmdLineParser.IsSystemStartupEnabled()); - rCfg.Write(); - - SetAutorun(GetPropValue(rCfg)); - - return FALSE; - } - // ================================= Checking for running instances of CH ======================================== // check instance - return false if it's the second one LOG_INFO(m_spLog) << _T("Checking for other running instances of Copy Handler"); @@ -363,12 +358,10 @@ return FALSE; } - else - { - LOG_WARNING(m_spLog) << _T("Other instance of Copy Handler is already running. Exiting."); - MsgBox(IDS_ONECOPY_STRING, MB_OK | MB_ICONWARNING); - return FALSE; - } + + LOG_WARNING(m_spLog) << _T("Other instance of Copy Handler is already running. Exiting."); + MsgBox(IDS_ONECOPY_STRING, MB_OK | MB_ICONWARNING); + return FALSE; } // ================================= Common controls ======================================== @@ -471,7 +464,7 @@ void CCopyHandlerApp::InitLoggers() { - chcore::TConfig& rConfig = GetConfig(); + chengine::TConfig& rConfig = GetConfig(); logger::TAsyncMultiLogger::GetInstance()->SetMaxLogSize(GetPropValue(rConfig)); logger::TAsyncMultiLogger::GetInstance()->SetMaxRotatedCount(GetPropValue(rConfig)); @@ -484,7 +477,7 @@ long lExtensionVersion = 0; INT_PTR iDlgResult = IDNO; - chcore::TConfig& rConfig = GetConfig(); + chengine::TConfig& rConfig = GetConfig(); int iDoNotShowAgain_Unregistered = GetPropValue(rConfig); int iDoNotShowAgain_VersionMismatch = GetPropValue(rConfig); @@ -622,12 +615,15 @@ case eFailure: MsgBox(IDS_UNREGISTERERR_STRING, MB_ICONERROR | MB_OK); break; + case eSuccessNeedRestart: + default: + break; } } -void CCopyHandlerApp::OnConfigNotify(const chcore::TStringSet& setPropNames) +void CCopyHandlerApp::OnConfigNotify(const string::TStringSet& setPropNames) { - chcore::TConfig& rCfg = GetConfig(); + chengine::TConfig& rCfg = GetConfig(); // is this language if(setPropNames.HasValue(PropData::GetPropertyName())) @@ -647,7 +643,10 @@ m_spLog->GetLogFileData()->GetMultiLoggerConfig()->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); if(setPropNames.HasValue(PropData::GetPropertyName())) + { m_spEngineLoggerConfig->SetLogLevel(L"default", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"TaskManager", (logger::ESeverityLevel)GetPropValue(rCfg)); + } if(setPropNames.HasValue(PropData::GetPropertyName())) { m_spEngineLoggerConfig->SetLogLevel(L"Filesystem", (logger::ESeverityLevel)GetPropValue(rCfg)); @@ -664,6 +663,14 @@ m_spEngineLoggerConfig->SetLogLevel(L"ST-Delete", (logger::ESeverityLevel)GetPropValue(rCfg)); if(setPropNames.HasValue(PropData::GetPropertyName())) m_spEngineLoggerConfig->SetLogLevel(L"ST-ScanDirs", (logger::ESeverityLevel)GetPropValue(rCfg)); + + if(setPropNames.HasValue(PropData::GetPropertyName())) + { + m_spEngineLoggerConfig->SetLogLevel(L"Serializer", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer-RowReader", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer-RowData", (logger::ESeverityLevel)GetPropValue(rCfg)); + m_spEngineLoggerConfig->SetLogLevel(L"Serializer-Container", (logger::ESeverityLevel)GetPropValue(rCfg)); + } } void CCopyHandlerApp::OnResManNotify(UINT uiType) @@ -696,8 +703,8 @@ strAdd += pszFile; return ::HtmlHelp(hwndCaller, strAdd, uCommand, dwData); } - else - return ::HtmlHelp(hwndCaller, pszPath, uCommand, dwData); + + return ::HtmlHelp(hwndCaller, pszPath, uCommand, dwData); } void CCopyHandlerApp::HtmlHelp(DWORD_PTR dwData, UINT nCmd)