Index: src/ch/CfgProperties.h =================================================================== diff -u -rad9bc5d98b91dc9f680742afbf4990b2b6dcda30 -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/CfgProperties.h (.../CfgProperties.h) (revision ad9bc5d98b91dc9f680742afbf4990b2b6dcda30) +++ src/ch/CfgProperties.h (.../CfgProperties.h) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -21,7 +21,7 @@ #pragma once -#include "TTaskConfiguration.h" +#include "../libchcore/TTaskConfiguration.h" namespace chcore { class TConfig; } @@ -148,9 +148,9 @@ #define ADAPT_TASK_PROPERTY(enum_id, task_enum_id)\ template<> struct PropData\ {\ - typedef TaskPropData::value_type value_type;\ - static value_type GetDefaultValue() { return TaskPropData::GetDefaultValue(); }\ - static const wchar_t* GetPropertyName() { return TaskPropData::GetPropertyName(); }\ + typedef chcore::TaskPropData::value_type value_type;\ + static value_type GetDefaultValue() { return chcore::TaskPropData::GetDefaultValue(); }\ + static const wchar_t* GetPropertyName() { return chcore::TaskPropData::GetPropertyName(); }\ static const wchar_t* GetPropertyNamePrefix() { return BRANCH_TASK_SETTINGS _T("."); }\ } @@ -211,22 +211,22 @@ PROPERTY(PP_CMLIMITMAXOPERATIONS, unsigned int, _T("CHConfig.Core.Operation.LimitMaxOperations"), 1); // Task default settings (see TTaskConfiguration.h) -ADAPT_TASK_PROPERTY(PP_BFUSEONLYDEFAULT, eTO_UseOnlyDefaultBuffer); -ADAPT_TASK_PROPERTY(PP_BFDEFAULT, eTO_DefaultBufferSize); -ADAPT_TASK_PROPERTY(PP_BFONEDISK, eTO_OneDiskBufferSize); -ADAPT_TASK_PROPERTY(PP_BFTWODISKS, eTO_TwoDisksBufferSize); -ADAPT_TASK_PROPERTY(PP_BFCD, eTO_CDBufferSize); -ADAPT_TASK_PROPERTY(PP_BFLAN, eTO_LANBufferSize); -ADAPT_TASK_PROPERTY(PP_BFUSENOBUFFERING, eTO_DisableBuffering); -ADAPT_TASK_PROPERTY(PP_BFBOUNDARYLIMIT, eTO_DisableBufferingMinSize); +ADAPT_TASK_PROPERTY(PP_BFUSEONLYDEFAULT, chcore::eTO_UseOnlyDefaultBuffer); +ADAPT_TASK_PROPERTY(PP_BFDEFAULT, chcore::eTO_DefaultBufferSize); +ADAPT_TASK_PROPERTY(PP_BFONEDISK, chcore::eTO_OneDiskBufferSize); +ADAPT_TASK_PROPERTY(PP_BFTWODISKS, chcore::eTO_TwoDisksBufferSize); +ADAPT_TASK_PROPERTY(PP_BFCD, chcore::eTO_CDBufferSize); +ADAPT_TASK_PROPERTY(PP_BFLAN, chcore::eTO_LANBufferSize); +ADAPT_TASK_PROPERTY(PP_BFUSENOBUFFERING, chcore::eTO_DisableBuffering); +ADAPT_TASK_PROPERTY(PP_BFBOUNDARYLIMIT, chcore::eTO_DisableBufferingMinSize); -ADAPT_TASK_PROPERTY(PP_CMSETDESTATTRIBUTES, eTO_SetDestinationAttributes); -ADAPT_TASK_PROPERTY(PP_CMSETDESTDATE, eTO_SetDestinationDateTime); -ADAPT_TASK_PROPERTY(PP_CMPROTECTROFILES, eTO_ProtectReadOnlyFiles); -ADAPT_TASK_PROPERTY(PP_CMREADSIZEBEFOREBLOCKING, eTO_ScanDirectoriesBeforeBlocking); -ADAPT_TASK_PROPERTY(PP_CMDEFAULTPRIORITY, eTO_ThreadPriority); -ADAPT_TASK_PROPERTY(PP_CMDISABLEPRIORITYBOOST, eTO_DisablePriorityBoost); -ADAPT_TASK_PROPERTY(PP_CMDELETEAFTERFINISHED, eTO_DeleteInSeparateSubTask); +ADAPT_TASK_PROPERTY(PP_CMSETDESTATTRIBUTES, chcore::eTO_SetDestinationAttributes); +ADAPT_TASK_PROPERTY(PP_CMSETDESTDATE, chcore::eTO_SetDestinationDateTime); +ADAPT_TASK_PROPERTY(PP_CMPROTECTROFILES, chcore::eTO_ProtectReadOnlyFiles); +ADAPT_TASK_PROPERTY(PP_CMREADSIZEBEFOREBLOCKING, chcore::eTO_ScanDirectoriesBeforeBlocking); +ADAPT_TASK_PROPERTY(PP_CMDEFAULTPRIORITY, chcore::eTO_ThreadPriority); +ADAPT_TASK_PROPERTY(PP_CMDISABLEPRIORITYBOOST, chcore::eTO_DisablePriorityBoost); +ADAPT_TASK_PROPERTY(PP_CMDELETEAFTERFINISHED, chcore::eTO_DeleteInSeparateSubTask); // Shell extension PROPERTY(PP_SHSHOWCOPY, bool, _T("CHConfig.ShellExtension.ShowCommands.Copy"), true); Index: src/ch/ClipboardMonitor.cpp =================================================================== diff -u -rab32897e61cc637a1e28d9dc3f0489b8d16a429c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) +++ src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -178,8 +178,8 @@ tTaskDefinition.SetDestinationPath(chcore::PathFromString(strData)); // load resource strings - SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_FIRSTCOPY_STRING)); - SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_NEXTCOPY_STRING)); + chcore::SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_FIRSTCOPY_STRING)); + chcore::SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_NEXTCOPY_STRING)); CTaskPtr spTask = pData->m_pTasks->CreateTask(tTaskDefinition); Index: src/ch/CustomCopyDlg.cpp =================================================================== diff -u -ra795c6fee89a6f17d437d7030a54d8d5ecf1ae17 -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision a795c6fee89a6f17d437d7030a54d8d5ecf1ae17) +++ src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -223,7 +223,7 @@ m_ctlPriority.AddString(GetResManager().LoadString(IDS_PRIORITY0_STRING+stIndex)); } - m_ctlPriority.SetCurSel(PriorityToIndex(GetTaskPropValue(m_tTaskDefinition.GetConfiguration()))); + m_ctlPriority.SetCurSel(PriorityToIndex(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()))); // fill buffer sizes listbox SetBuffersizesString(); @@ -279,14 +279,14 @@ m_ctlFilters.InsertColumn(6, &lvc); chcore::TFiltersArray afFilters; - GetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); + chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); m_bFilters = !afFilters.IsEmpty(); // other custom flags - m_bIgnoreFolders = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); - m_bForceDirectories = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); - m_bOnlyCreate = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + m_bIgnoreFolders = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + m_bForceDirectories = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + m_bOnlyCreate = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); m_bAdvanced = (m_bIgnoreFolders | m_bForceDirectories | m_bOnlyCreate); UpdateData(FALSE); @@ -379,7 +379,7 @@ m_ctlFilters.InsertColumn(6, &lvc); // refresh the entries in filters' list - chcore::TFiltersArray afFilters = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); m_ctlFilters.DeleteAllItems(); for(size_t stIndex = 0; stIndex < afFilters.GetSize(); ++stIndex) { @@ -487,11 +487,11 @@ m_tTaskDefinition.SetOperationType(m_ctlOperation.GetCurSel() == 0 ? chcore::eOperation_Copy: chcore::eOperation_Move); // priority - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), IndexToPriority(m_ctlPriority.GetCurSel())); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), IndexToPriority(m_ctlPriority.GetCurSel())); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), (m_bIgnoreFolders != 0)); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), (m_bForceDirectories != 0)); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), (m_bOnlyCreate != 0)); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), (m_bIgnoreFolders != 0)); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), (m_bForceDirectories != 0)); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), (m_bOnlyCreate != 0)); CLanguageDialog::OnOK(); } @@ -512,12 +512,12 @@ ictranslate::CFormat fmt; chcore::TBufferSizes bsSizes; - bsSizes.SetOnlyDefault(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetDefaultSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetOneDiskSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetTwoDisksSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetCDSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetLANSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); fmt.SetFormat(GetResManager().LoadString(IDS_BSEDEFAULT_STRING)); fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetDefaultSize(), szSize, 64, true)); @@ -547,21 +547,21 @@ { CBufferSizeDlg dlg; - dlg.m_bsSizes.SetOnlyDefault(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetDefaultSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetOneDiskSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetTwoDisksSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetCDSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetLANSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); if(dlg.DoModal() == IDOK) { - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.IsOnlyDefault()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetDefaultSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetOneDiskSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetTwoDisksSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetCDSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetLANSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.IsOnlyDefault()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetDefaultSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetOneDiskSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetTwoDisksSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetCDSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetLANSize()); SetBuffersizesString(); } @@ -593,7 +593,7 @@ CFilterDlg dlg; chcore::TString strData; - chcore::TFiltersArray afFilters = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); for (size_t i = 0; i < afFilters.GetSize(); i++) { const chcore::TFileFilter* pFilter = afFilters.GetAt(i); @@ -612,7 +612,7 @@ if(dlg.m_ffFilter.GetUseMask() || dlg.m_ffFilter.GetUseExcludeMask() || dlg.m_ffFilter.GetUseSize1() || dlg.m_ffFilter.GetUseDateTime1() || dlg.m_ffFilter.GetUseAttributes()) { afFilters.Add(dlg.m_ffFilter); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); AddFilter(dlg.m_ffFilter); } else @@ -760,7 +760,7 @@ void CCustomCopyDlg::OnRemovefilterButton() { - chcore::TFiltersArray afFilters = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); POSITION pos; int iItem; @@ -775,7 +775,7 @@ m_ctlFilters.DeleteItem(iItem); afFilters.RemoveAt(iItem); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); } } } @@ -821,7 +821,7 @@ POSITION pos = m_ctlFilters.GetFirstSelectedItemPosition(); if(pos != NULL) { - chcore::TFiltersArray afFilters = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); int iItem = m_ctlFilters.GetNextSelectedItem(pos); CFilterDlg dlg; @@ -855,7 +855,7 @@ || dlg.m_ffFilter.GetUseDateTime1() || dlg.m_ffFilter.GetUseAttributes()) { afFilters.SetAt(iItem, dlg.m_ffFilter); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); AddFilter(dlg.m_ffFilter, iItem); } } @@ -871,22 +871,22 @@ { CBufferSizeDlg dlg; - dlg.m_bsSizes.SetOnlyDefault(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetDefaultSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetOneDiskSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetTwoDisksSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetCDSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetLANSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + dlg.m_bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); dlg.m_iActiveIndex = iItem; if(dlg.DoModal() == IDOK) { - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.IsOnlyDefault()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetDefaultSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetOneDiskSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetTwoDisksSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetCDSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetLANSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.IsOnlyDefault()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetDefaultSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetOneDiskSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetTwoDisksSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetCDSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetLANSize()); SetBuffersizesString(); } Index: src/ch/MainWnd.cpp =================================================================== diff -u -rf2eab440135dd8052881aa3e9af83ec85e9bf1bf -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision f2eab440135dd8052881aa3e9af83ec85e9bf1bf) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -497,8 +497,8 @@ } // load resource strings - SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_FIRSTCOPY_STRING)); - SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_NEXTCOPY_STRING)); + chcore::SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_FIRSTCOPY_STRING)); + chcore::SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_NEXTCOPY_STRING)); // create task with the above definition CTaskPtr spTask = m_tasks.CreateTask(tTaskDefinition); @@ -607,8 +607,8 @@ chcore::TTaskDefinition tTaskDefinition = dlg.m_tTaskDefinition; // load resource strings - SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_FIRSTCOPY_STRING)); - SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_NEXTCOPY_STRING)); + chcore::SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_FIRSTCOPY_STRING)); + chcore::SetTaskPropValue(tTaskDefinition.GetConfiguration(), GetResManager().LoadString(IDS_NEXTCOPY_STRING)); // new task CTaskPtr spTask = m_tasks.CreateTask(tTaskDefinition); Index: src/ch/TSubTaskBase.cpp =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -23,10 +23,10 @@ #include "stdafx.h" #include "TSubTaskBase.h" #include "../libchcore/TBasePathData.h" -#include "TLocalFilesystem.h" +#include "../libchcore/TLocalFilesystem.h" #include "TSubTaskContext.h" #include "../libchcore/TTaskDefinition.h" -#include "TTaskConfiguration.h" +#include "../libchcore/TTaskConfiguration.h" /////////////////////////////////////////////////////////////////////////// // TSubTaskBase @@ -54,7 +54,7 @@ chcore::TSmartPath pathCombined = pathDst + spFileInfo->GetFullFilePath().GetFileDir(); // force create directory - TLocalFilesystem::CreateDirectory(pathCombined, true); + chcore::TLocalFilesystem::CreateDirectory(pathCombined, true); return pathCombined + spFileInfo->GetFullFilePath().GetFileName(); } @@ -91,14 +91,14 @@ // set the dest path CString strCheckPath; - ictranslate::CFormat fmt(GetTaskPropValue(rTaskDefinition.GetConfiguration())); + ictranslate::CFormat fmt(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); fmt.SetParam(_t("%name"), pathFilename.ToString()); chcore::TSmartPath pathCheckPath(chcore::PathFromString((PCTSTR)fmt)); // when adding to strDstPath check if the path already exists - if so - try again int iCounter = 1; - CString strFmt = GetTaskPropValue(rTaskDefinition.GetConfiguration()); - while(TLocalFilesystem::PathExist(pathDstPath + pathCheckPath)) + CString strFmt = chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()); + while(chcore::TLocalFilesystem::PathExist(pathDstPath + pathCheckPath)) { fmt.SetFormat(strFmt); fmt.SetParam(_t("%name"), pathFilename.ToString()); Index: src/ch/TSubTaskContext.cpp =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -23,9 +23,9 @@ #include "stdafx.h" #include "TSubTaskContext.h" -TSubTaskContext::TSubTaskContext(chcore::TTaskDefinition& rTaskDefinition, chcore::TBasePathDataContainer& rBasePathDataContainer, chcore::TFileInfoArray& rFilesCache, TTaskLocalStats& rTaskLocalStats, - TTaskBasicProgressInfo& rTaskBasicProgressInfo, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, chcore::IFeedbackHandler* piFeedbackHandler, - chcore::TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal) : +TSubTaskContext::TSubTaskContext(chcore::TTaskDefinition& rTaskDefinition, chcore::TBasePathDataContainer& rBasePathDataContainer, chcore::TFileInfoArray& rFilesCache, chcore::TTaskLocalStats& rTaskLocalStats, + chcore::TTaskBasicProgressInfo& rTaskBasicProgressInfo, chcore::TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, chcore::IFeedbackHandler* piFeedbackHandler, + chcore::TWorkerThreadController& rThreadController, chcore::TLocalFilesystem& rfsLocal) : m_rTaskDefinition(rTaskDefinition), m_rBasePathDataContainer(rBasePathDataContainer), m_rFilesCache(rFilesCache), Index: src/ch/TSubTaskContext.h =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskContext.h (.../TSubTaskContext.h) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskContext.h (.../TSubTaskContext.h) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -31,22 +31,21 @@ class TTaskDefinition; class TWorkerThreadController; class TBasePathDataContainer; + class TTaskConfigTracker; + class TLocalFilesystem; + class TTaskLocalStats; + class TTaskBasicProgressInfo; } -class TTaskLocalStats; -class TTaskConfigTracker; -class TTaskBasicProgressInfo; -class TLocalFilesystem; - /////////////////////////////////////////////////////////////////////////// // TSubTaskContext class TSubTaskContext { public: - TSubTaskContext(chcore::TTaskDefinition& rTaskDefinition, chcore::TBasePathDataContainer& rBasePathDataContainer, chcore::TFileInfoArray& rFilesCache, TTaskLocalStats& rTaskLocalStats, - TTaskBasicProgressInfo& rTaskBasicProgressInfo, TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, - chcore::IFeedbackHandler* piFeedbackHandler, chcore::TWorkerThreadController& rThreadController, TLocalFilesystem& rfsLocal); + TSubTaskContext(chcore::TTaskDefinition& rTaskDefinition, chcore::TBasePathDataContainer& rBasePathDataContainer, chcore::TFileInfoArray& rFilesCache, chcore::TTaskLocalStats& rTaskLocalStats, + chcore::TTaskBasicProgressInfo& rTaskBasicProgressInfo, chcore::TTaskConfigTracker& rCfgTracker, icpf::log_file& rLog, + chcore::IFeedbackHandler* piFeedbackHandler, chcore::TWorkerThreadController& rThreadController, chcore::TLocalFilesystem& rfsLocal); ~TSubTaskContext(); chcore::TTaskDefinition& GetTaskDefinition() { return m_rTaskDefinition; } @@ -58,14 +57,14 @@ chcore::TFileInfoArray& GetFilesCache() { return m_rFilesCache; } const chcore::TFileInfoArray& GetFilesCache() const { return m_rFilesCache; } - TTaskLocalStats& GetTaskLocalStats() { return m_rTaskLocalStats; } - const TTaskLocalStats& GetTaskLocalStats() const { return m_rTaskLocalStats; } + chcore::TTaskLocalStats& GetTaskLocalStats() { return m_rTaskLocalStats; } + const chcore::TTaskLocalStats& GetTaskLocalStats() const { return m_rTaskLocalStats; } - TTaskBasicProgressInfo& GetTaskBasicProgressInfo() { return m_rTaskBasicProgressInfo; } - const TTaskBasicProgressInfo& GetTaskBasicProgressInfo() const { return m_rTaskBasicProgressInfo; } + chcore::TTaskBasicProgressInfo& GetTaskBasicProgressInfo() { return m_rTaskBasicProgressInfo; } + const chcore::TTaskBasicProgressInfo& GetTaskBasicProgressInfo() const { return m_rTaskBasicProgressInfo; } - TTaskConfigTracker& GetCfgTracker() { return m_rCfgTracker; } - const TTaskConfigTracker& GetCfgTracker() const { return m_rCfgTracker; } + chcore::TTaskConfigTracker& GetCfgTracker() { return m_rCfgTracker; } + const chcore::TTaskConfigTracker& GetCfgTracker() const { return m_rCfgTracker; } icpf::log_file& GetLog() { return m_rLog; } const icpf::log_file& GetLog() const { return m_rLog; } @@ -76,8 +75,8 @@ chcore::TWorkerThreadController& GetThreadController() { return m_rThreadController; } const chcore::TWorkerThreadController& GetThreadController() const { return m_rThreadController; } - TLocalFilesystem& GetLocalFilesystem() { return m_rfsLocal; } - const TLocalFilesystem& GetLocalFilesystem() const { return m_rfsLocal; } + chcore::TLocalFilesystem& GetLocalFilesystem() { return m_rfsLocal; } + const chcore::TLocalFilesystem& GetLocalFilesystem() const { return m_rfsLocal; } private: chcore::TTaskDefinition& m_rTaskDefinition; @@ -89,14 +88,14 @@ chcore::TFileInfoArray& m_rFilesCache; // local stats for task - TTaskLocalStats& m_rTaskLocalStats; - TTaskBasicProgressInfo& m_rTaskBasicProgressInfo; + chcore::TTaskLocalStats& m_rTaskLocalStats; + chcore::TTaskBasicProgressInfo& m_rTaskBasicProgressInfo; // configuration changes tracking - TTaskConfigTracker& m_rCfgTracker; + chcore::TTaskConfigTracker& m_rCfgTracker; // local filesystem access functions - TLocalFilesystem& m_rfsLocal; + chcore::TLocalFilesystem& m_rfsLocal; // additional data icpf::log_file& m_rLog; @@ -108,4 +107,4 @@ chcore::TWorkerThreadController& m_rThreadController; }; -#endif // __TSUBTASKCONTEXT_H__ \ No newline at end of file +#endif // __TSUBTASKCONTEXT_H__ Index: src/ch/TSubTaskCopyMove.cpp =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -23,10 +23,10 @@ #include "stdafx.h" #include "TSubTaskCopyMove.h" #include "TSubTaskContext.h" -#include "TTaskConfiguration.h" +#include "../libchcore/TTaskConfiguration.h" #include "../libchcore/TTaskDefinition.h" #include "task.h" -#include "TLocalFilesystem.h" +#include "../libchcore/TLocalFilesystem.h" #include "FeedbackHandler.h" // assume max sectors of 4kB (for rounding) @@ -52,11 +52,11 @@ icpf::log_file& rLog = GetContext().GetLog(); chcore::TFileInfoArray& rFilesCache = GetContext().GetFilesCache(); chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); - TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); - TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); + chcore::TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); + chcore::TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); - TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); + chcore::TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); BOOST_ASSERT(piFeedbackHandler != NULL); if(piFeedbackHandler == NULL) @@ -75,24 +75,24 @@ // begin at index which wasn't processed previously size_t stSize = rFilesCache.GetSize(); - bool bIgnoreFolders = GetTaskPropValue(rTaskDefinition.GetConfiguration()); - bool bForceDirectories = GetTaskPropValue(rTaskDefinition.GetConfiguration()); + bool bIgnoreFolders = chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()); + bool bForceDirectories = chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()); // create a buffer of size m_nBufferSize CUSTOM_COPY_PARAMS ccp; ccp.bProcessed = false; - ccp.bOnlyCreate = GetTaskPropValue(rTaskDefinition.GetConfiguration()); + ccp.bOnlyCreate = chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()); // remove changes in buffer sizes to avoid re-creation later - rCfgTracker.RemoveModificationSet(TOptionsSet() % eTO_DefaultBufferSize % eTO_OneDiskBufferSize % eTO_TwoDisksBufferSize % eTO_CDBufferSize % eTO_LANBufferSize % eTO_UseOnlyDefaultBuffer); + rCfgTracker.RemoveModificationSet(chcore::TOptionsSet() % chcore::eTO_DefaultBufferSize % chcore::eTO_OneDiskBufferSize % chcore::eTO_TwoDisksBufferSize % chcore::eTO_CDBufferSize % chcore::eTO_LANBufferSize % chcore::eTO_UseOnlyDefaultBuffer); chcore::TBufferSizes bs; - bs.SetOnlyDefault(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetDefaultSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetOneDiskSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetTwoDisksSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetCDSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetLANSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetOnlyDefault(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetDefaultSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetOneDiskSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetTwoDisksSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetCDSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetLANSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); ccp.dbBuffer.Create(bs); @@ -140,7 +140,7 @@ if(bMove && wchDestinationDrive != L'\0' && wchDestinationDrive == pathCurrent.GetDriveLetter() && GetMove(spFileInfo)) { bool bRetry = true; - if(bRetry && !TLocalFilesystem::FastMove(pathCurrent, ccp.pathDstFile)) + if(bRetry && !chcore::TLocalFilesystem::FastMove(pathCurrent, ccp.pathDstFile)) { dwLastError=GetLastError(); //log @@ -180,7 +180,7 @@ if(spFileInfo->IsDirectory()) { bool bRetry = true; - if(bRetry && !TLocalFilesystem::CreateDirectory(ccp.pathDstFile, false) && (dwLastError=GetLastError()) != ERROR_ALREADY_EXISTS ) + if(bRetry && !chcore::TLocalFilesystem::CreateDirectory(ccp.pathDstFile, false) && (dwLastError=GetLastError()) != ERROR_ALREADY_EXISTS ) { // log fmt.SetFormat(_T("Error %errno while calling CreateDirectory %path (ProcessFiles)")); @@ -227,22 +227,22 @@ spFileInfo->SetFlags(ccp.bProcessed ? FIF_PROCESSED : 0, FIF_PROCESSED); // if moving - delete file (only if config flag is set) - if(bMove && spFileInfo->GetFlags() & FIF_PROCESSED && !GetTaskPropValue(rTaskDefinition.GetConfiguration())) + if(bMove && spFileInfo->GetFlags() & FIF_PROCESSED && !chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) { - if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) - TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); - TLocalFilesystem::DeleteFile(spFileInfo->GetFullFilePath()); // there will be another try later, so I don't check + if(!chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) + chcore::TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); + chcore::TLocalFilesystem::DeleteFile(spFileInfo->GetFullFilePath()); // there will be another try later, so I don't check // if succeeded } } // set a time - if(GetTaskPropValue(rTaskDefinition.GetConfiguration())) - TLocalFilesystem::SetFileDirectoryTime(ccp.pathDstFile, spFileInfo->GetCreationTime(), spFileInfo->GetLastAccessTime(), spFileInfo->GetLastWriteTime()); // no error checking (but most probably it should be checked) + if(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) + chcore::TLocalFilesystem::SetFileDirectoryTime(ccp.pathDstFile, spFileInfo->GetCreationTime(), spFileInfo->GetLastAccessTime(), spFileInfo->GetLastWriteTime()); // no error checking (but most probably it should be checked) // attributes - if(GetTaskPropValue(rTaskDefinition.GetConfiguration())) - TLocalFilesystem::SetAttributes(ccp.pathDstFile, spFileInfo->GetAttributes()); // as above + if(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) + chcore::TLocalFilesystem::SetAttributes(ccp.pathDstFile, spFileInfo->GetAttributes()); // as above } rBasicProgressInfo.SetCurrentIndex(stIndex + 1); @@ -284,19 +284,19 @@ chcore::TSmartPath pathSource = spFileInfo->GetFullFilePath(); chcore::TSmartPath pathDestination = GetContext().GetTaskDefinition().GetDestinationPath(); - TLocalFilesystem::EPathsRelation eRelation = GetContext().GetLocalFilesystem().GetPathsRelation(pathSource, pathDestination); + chcore::TLocalFilesystem::EPathsRelation eRelation = GetContext().GetLocalFilesystem().GetPathsRelation(pathSource, pathDestination); switch(eRelation) { - case TLocalFilesystem::eRelation_Network: + case chcore::TLocalFilesystem::eRelation_Network: return chcore::TBufferSizes::eBuffer_LAN; - case TLocalFilesystem::eRelation_CDRom: + case chcore::TLocalFilesystem::eRelation_CDRom: return chcore::TBufferSizes::eBuffer_CD; - case TLocalFilesystem::eRelation_TwoPhysicalDisks: + case chcore::TLocalFilesystem::eRelation_TwoPhysicalDisks: return chcore::TBufferSizes::eBuffer_TwoDisks; - case TLocalFilesystem::eRelation_SinglePhysicalDisk: + case chcore::TLocalFilesystem::eRelation_SinglePhysicalDisk: return chcore::TBufferSizes::eBuffer_OneDisk; //case eRelation_Other: @@ -308,14 +308,14 @@ TSubTaskBase::ESubOperationResult TSubTaskCopyMove::CustomCopyFileFB(CUSTOM_COPY_PARAMS* pData) { chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); - TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); + chcore::TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); - TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); + chcore::TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); icpf::log_file& rLog = GetContext().GetLog(); - TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); + chcore::TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); - TLocalFilesystemFile fileSrc = TLocalFilesystem::CreateFileObject(); - TLocalFilesystemFile fileDst = TLocalFilesystem::CreateFileObject(); + chcore::TLocalFilesystemFile fileSrc = chcore::TLocalFilesystem::CreateFileObject(); + chcore::TLocalFilesystemFile fileDst = chcore::TLocalFilesystem::CreateFileObject(); ictranslate::CFormat fmt; TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; @@ -325,8 +325,8 @@ // NOTE: we are using here the file size read when scanning directories for files; it might be // outdated at this point, but at present we don't want to re-read file size since it // will cost additional disk access - bool bNoBuffer = (GetTaskPropValue(rTaskDefinition.GetConfiguration()) && - pData->spSrcFile->GetLength64() >= GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bool bNoBuffer = (chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()) && + pData->spSrcFile->GetLength64() >= chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); // first open the source file and handle any failures eResult = OpenSourceFileFB(fileSrc, pData->spSrcFile->GetFullFilePath(), bNoBuffer); @@ -343,7 +343,7 @@ // change attributes of a dest file // NOTE: probably should be removed from here and report problems with read-only files // directly to the user (as feedback request) - if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) + if(!chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) SetFileAttributes(pData->pathDstFile.ToString(), FILE_ATTRIBUTE_NORMAL); // open destination file, handle the failures and possibly existence of the destination file @@ -448,15 +448,15 @@ } // recreate buffer if needed - if(rCfgTracker.IsModified() && rCfgTracker.IsModified(TOptionsSet() % eTO_DefaultBufferSize % eTO_OneDiskBufferSize % eTO_TwoDisksBufferSize % eTO_CDBufferSize % eTO_LANBufferSize % eTO_UseOnlyDefaultBuffer, true)) + if(rCfgTracker.IsModified() && rCfgTracker.IsModified(chcore::TOptionsSet() % chcore::eTO_DefaultBufferSize % chcore::eTO_OneDiskBufferSize % chcore::eTO_TwoDisksBufferSize % chcore::eTO_CDBufferSize % chcore::eTO_LANBufferSize % chcore::eTO_UseOnlyDefaultBuffer, true)) { chcore::TBufferSizes bs; - bs.SetOnlyDefault(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetDefaultSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetOneDiskSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetTwoDisksSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetCDSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); - bs.SetLANSize(GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetOnlyDefault(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetDefaultSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetOneDiskSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetTwoDisksSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetCDSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); + bs.SetLANSize(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())); // log const chcore::TBufferSizes& rbs1 = pData->dbBuffer.GetSizes(); @@ -481,7 +481,7 @@ } // establish count of data to read - if(GetTaskPropValue(rTaskDefinition.GetConfiguration())) + if(chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) iBufferIndex = chcore::TBufferSizes::eBuffer_Default; else iBufferIndex = GetBufferIndex(pData->spSrcFile); @@ -602,7 +602,7 @@ } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::OpenSourceFileFB(TLocalFilesystemFile& fileSrc, const chcore::TSmartPath& spPathToOpen, bool bNoBuffering) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::OpenSourceFileFB(chcore::TLocalFilesystemFile& fileSrc, const chcore::TSmartPath& spPathToOpen, bool bNoBuffering) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -670,7 +670,7 @@ return TSubTaskBase::eSubResult_Continue; } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::OpenDestinationFileFB(TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFile, bool bNoBuffering, const chcore::TFileInfoPtr& spSrcFileInfo, unsigned long long& ullSeekTo, bool& bFreshlyCreated) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::OpenDestinationFileFB(chcore::TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFile, bool bNoBuffering, const chcore::TFileInfoPtr& spSrcFileInfo, unsigned long long& ullSeekTo, bool& bFreshlyCreated) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -705,7 +705,7 @@ // reading parameters using opened handle; need to be tested in the future chcore::TFileInfoPtr spDstFileInfo(boost::make_shared()); - if(!TLocalFilesystem::GetFileInfo(pathDstFile, spDstFileInfo)) + if(!chcore::TLocalFilesystem::GetFileInfo(pathDstFile, spDstFileInfo)) THROW(_T("Cannot get information about file which has already been opened!"), 0, GetLastError(), 0); // src and dst files are the same @@ -793,7 +793,7 @@ return TSubTaskBase::eSubResult_Continue; } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::OpenExistingDestinationFileFB(TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFile, bool bNoBuffering) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::OpenExistingDestinationFileFB(chcore::TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFile, bool bNoBuffering) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -856,7 +856,7 @@ return TSubTaskBase::eSubResult_Continue; } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::SetFilePointerFB(TLocalFilesystemFile& file, long long llDistance, const chcore::TSmartPath& pathFile, bool& bSkip) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::SetFilePointerFB(chcore::TLocalFilesystemFile& file, long long llDistance, const chcore::TSmartPath& pathFile, bool& bSkip) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -909,7 +909,7 @@ return TSubTaskBase::eSubResult_Continue; } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::SetEndOfFileFB(TLocalFilesystemFile& file, const chcore::TSmartPath& pathFile, bool& bSkip) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::SetEndOfFileFB(chcore::TLocalFilesystemFile& file, const chcore::TSmartPath& pathFile, bool& bSkip) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -958,7 +958,7 @@ return TSubTaskBase::eSubResult_Continue; } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::ReadFileFB(TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead, const chcore::TSmartPath& pathFile, bool& bSkip) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::ReadFileFB(chcore::TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead, const chcore::TSmartPath& pathFile, bool& bSkip) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -1010,7 +1010,7 @@ return TSubTaskBase::eSubResult_Continue; } -TSubTaskBase::ESubOperationResult TSubTaskCopyMove::WriteFileFB(TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten, const chcore::TSmartPath& pathFile, bool& bSkip) +TSubTaskBase::ESubOperationResult TSubTaskCopyMove::WriteFileFB(chcore::TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten, const chcore::TSmartPath& pathFile, bool& bSkip) { chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); icpf::log_file& rLog = GetContext().GetLog(); @@ -1068,8 +1068,8 @@ icpf::log_file& rLog = GetContext().GetLog(); chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); - TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); - TLocalFilesystem& rLocalFilesystem = GetContext().GetLocalFilesystem(); + chcore::TTaskLocalStats& rLocalStats = GetContext().GetTaskLocalStats(); + chcore::TLocalFilesystem& rLocalFilesystem = GetContext().GetLocalFilesystem(); ull_t ullNeededSize = 0, ullAvailableSize = 0; bool bRetry = false; Index: src/ch/TSubTaskCopyMove.h =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -32,7 +32,10 @@ } struct CUSTOM_COPY_PARAMS; -class TLocalFilesystemFile; +namespace chcore +{ + class TLocalFilesystemFile; +} class TSubTaskCopyMove : public TSubTaskBase { @@ -47,15 +50,15 @@ ESubOperationResult CustomCopyFileFB(CUSTOM_COPY_PARAMS* pData); - ESubOperationResult OpenSourceFileFB(TLocalFilesystemFile& fileSrc, const chcore::TSmartPath& spPathToOpen, bool bNoBuffering); - ESubOperationResult OpenDestinationFileFB(TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFile, bool bNoBuffering, const chcore::TFileInfoPtr& spSrcFileInfo, unsigned long long& ullSeekTo, bool& bFreshlyCreated); - ESubOperationResult OpenExistingDestinationFileFB(TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFilePath, bool bNoBuffering); + ESubOperationResult OpenSourceFileFB(chcore::TLocalFilesystemFile& fileSrc, const chcore::TSmartPath& spPathToOpen, bool bNoBuffering); + ESubOperationResult OpenDestinationFileFB(chcore::TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFile, bool bNoBuffering, const chcore::TFileInfoPtr& spSrcFileInfo, unsigned long long& ullSeekTo, bool& bFreshlyCreated); + ESubOperationResult OpenExistingDestinationFileFB(chcore::TLocalFilesystemFile& fileDst, const chcore::TSmartPath& pathDstFilePath, bool bNoBuffering); - ESubOperationResult SetFilePointerFB(TLocalFilesystemFile& file, long long llDistance, const chcore::TSmartPath& pathFile, bool& bSkip); - ESubOperationResult SetEndOfFileFB(TLocalFilesystemFile& file, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult SetFilePointerFB(chcore::TLocalFilesystemFile& file, long long llDistance, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult SetEndOfFileFB(chcore::TLocalFilesystemFile& file, const chcore::TSmartPath& pathFile, bool& bSkip); - ESubOperationResult ReadFileFB(TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead, const chcore::TSmartPath& pathFile, bool& bSkip); - ESubOperationResult WriteFileFB(TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult ReadFileFB(chcore::TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult WriteFileFB(chcore::TLocalFilesystemFile& file, chcore::TDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten, const chcore::TSmartPath& pathFile, bool& bSkip); ESubOperationResult CreateDirectoryFB(const chcore::TSmartPath& pathDirectory); ESubOperationResult CheckForFreeSpaceFB(); Index: src/ch/TSubTaskDelete.cpp =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -23,12 +23,12 @@ #include "stdafx.h" #include "TSubTaskDelete.h" #include "TSubTaskContext.h" -#include "TBasicProgressInfo.h" +#include "../libchcore/TBasicProgressInfo.h" #include "../libchcore/TWorkerThreadController.h" -#include "TTaskConfiguration.h" +#include "../libchcore/TTaskConfiguration.h" #include "../libchcore/TTaskDefinition.h" #include "FeedbackHandler.h" -#include "TLocalFilesystem.h" +#include "../libchcore/TLocalFilesystem.h" TSubTaskDelete::TSubTaskDelete(TSubTaskContext& rContext) : TSubTaskBase(rContext) @@ -41,7 +41,7 @@ icpf::log_file& rLog = GetContext().GetLog(); chcore::TFileInfoArray& rFilesCache = GetContext().GetFilesCache(); chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); - TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); + chcore::TTaskBasicProgressInfo& rBasicProgressInfo = GetContext().GetTaskBasicProgressInfo(); chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); @@ -79,16 +79,16 @@ // delete data if(spFileInfo->IsDirectory()) { - if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) - TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); - bSuccess = TLocalFilesystem::RemoveDirectory(spFileInfo->GetFullFilePath()); + if(!chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) + chcore::TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + bSuccess = chcore::TLocalFilesystem::RemoveDirectory(spFileInfo->GetFullFilePath()); } else { // set files attributes to normal - it'd slow processing a bit, but it's better. - if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) - TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); - bSuccess = TLocalFilesystem::DeleteFile(spFileInfo->GetFullFilePath()); + if(!chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration())) + chcore::TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); + bSuccess = chcore::TLocalFilesystem::DeleteFile(spFileInfo->GetFullFilePath()); } // operation failed Index: src/ch/TSubTaskScanDirectory.cpp =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -23,14 +23,14 @@ #include "stdafx.h" #include "TSubTaskScanDirectory.h" #include "TSubTaskContext.h" -#include "TTaskConfiguration.h" +#include "../libchcore/TTaskConfiguration.h" #include "../libchcore/TTaskDefinition.h" #include "FeedbackHandler.h" -#include "TLocalFilesystem.h" +#include "../libchcore/TLocalFilesystem.h" #include "../libchcore/FeedbackHandlerBase.h" #include "../libchcore/TBasePathData.h" #include "../libchcore/TWorkerThreadController.h" -#include "TTaskLocalStats.h" +#include "../libchcore/TTaskLocalStats.h" TSubTaskScanDirectories::TSubTaskScanDirectories(TSubTaskContext& rContext) : TSubTaskBase(rContext) @@ -50,7 +50,7 @@ chcore::IFeedbackHandler* piFeedbackHandler = GetContext().GetFeedbackHandler(); const chcore::TBasePathDataContainer& rarrSourcePathsInfo = GetContext().GetBasePathDataContainer(); chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); - TTaskLocalStats& rTaskLocalStats = GetContext().GetTaskLocalStats(); + chcore::TTaskLocalStats& rTaskLocalStats = GetContext().GetTaskLocalStats(); rLog.logi(_T("Searching for files...")); @@ -63,13 +63,13 @@ // read filtering options chcore::TFiltersArray afFilters; - GetTaskPropValue(rTaskDefinition.GetConfiguration(), afFilters); + chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration(), afFilters); // enter some data to rFilesCache wchar_t wchDestinationDriveLetter = rTaskDefinition.GetDestinationPath().GetDriveLetter(); - bool bIgnoreDirs = GetTaskPropValue(rTaskDefinition.GetConfiguration()); - bool bForceDirectories = GetTaskPropValue(rTaskDefinition.GetConfiguration()); + bool bIgnoreDirs = chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()); + bool bForceDirectories = chcore::GetTaskPropValue(rTaskDefinition.GetConfiguration()); bool bMove = rTaskDefinition.GetOperationType() == chcore::eOperation_Move; // add everything @@ -92,7 +92,7 @@ bRetry = false; // read attributes of src file/folder - bool bExists = TLocalFilesystem::GetFileInfo(rTaskDefinition.GetSourcePathAt(stIndex), spFileInfo, stIndex, &rTaskDefinition.GetSourcePaths()); + bool bExists = chcore::TLocalFilesystem::GetFileInfo(rTaskDefinition.GetSourcePathAt(stIndex), spFileInfo, stIndex, &rTaskDefinition.GetSourcePaths()); if(!bExists) { FEEDBACK_FILEERROR ferr = { rTaskDefinition.GetSourcePathAt(stIndex).ToString(), NULL, eFastMoveError, ERROR_FILE_NOT_FOUND }; @@ -164,7 +164,7 @@ // don't add folder contents when moving inside one disk boundary if(bIgnoreDirs || !bMove || wchDestinationDriveLetter == L'\0' || wchDestinationDriveLetter != wchSourceDriveLetter || - TLocalFilesystem::PathExist(CalculateDestinationPath(spFileInfo, rTaskDefinition.GetDestinationPath(), ((int)bForceDirectories) << 1)) ) + chcore::TLocalFilesystem::PathExist(CalculateDestinationPath(spFileInfo, rTaskDefinition.GetDestinationPath(), ((int)bForceDirectories) << 1)) ) { // log fmt.SetFormat(_T("Recursing folder %path")); @@ -189,7 +189,7 @@ else { if(bMove && wchDestinationDriveLetter != L'\0' && wchDestinationDriveLetter == wchSourceDriveLetter && - !TLocalFilesystem::PathExist(CalculateDestinationPath(spFileInfo, rTaskDefinition.GetDestinationPath(), ((int)bForceDirectories) << 1)) ) + !chcore::TLocalFilesystem::PathExist(CalculateDestinationPath(spFileInfo, rTaskDefinition.GetDestinationPath(), ((int)bForceDirectories) << 1)) ) { // if moving within one partition boundary set the file size to 0 so the overall size will // be ok @@ -224,7 +224,7 @@ chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); chcore::TWorkerThreadController& rThreadController = GetContext().GetThreadController(); - TLocalFilesystemFind finder = TLocalFilesystem::CreateFinderObject(pathDirName, chcore::PathFromString(_T("*"))); + chcore::TLocalFilesystemFind finder = chcore::TLocalFilesystem::CreateFinderObject(pathDirName, chcore::PathFromString(_T("*"))); chcore::TFileInfoPtr spFileInfo(boost::make_shared()); while(finder.FindNext(spFileInfo)) Index: src/ch/ch.vc90.vcproj =================================================================== diff -u -rd12e49decb8a3df3e28f6786d38542390484ac07 -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision d12e49decb8a3df3e28f6786d38542390484ac07) +++ src/ch/ch.vc90.vcproj (.../ch.vc90.vcproj) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -435,45 +435,13 @@ > - - - - - - - - - - - - - - - - @@ -530,26 +498,6 @@ > - - - - - - - - - - (m_tTaskDefinition.GetConfiguration(), bsSizes.GetDefaultSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetOneDiskSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetTwoDisksSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetCDSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetLANSize()); - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.IsOnlyDefault()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetDefaultSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetOneDiskSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetTwoDisksSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetCDSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.GetLANSize()); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), bsSizes.IsOnlyDefault()); m_tTaskDefinition.GetConfiguration().ResumeNotifications(); } void CTask::GetBufferSizes(chcore::TBufferSizes& bsSizes) { - bsSizes.SetDefaultSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetOneDiskSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetTwoDisksSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetCDSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetLANSize(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetOnlyDefault(GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); } int CTask::GetCurrentBufferIndex() @@ -125,7 +125,7 @@ // thread void CTask::SetPriority(int nPriority) { - SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), nPriority); + chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), nPriority); } void CTask::CalculateProcessedSize() @@ -153,7 +153,7 @@ // update members according to the task definition // make sure to resize paths info array size to match source paths count m_arrSourcePathsInfo.SetCount(m_tTaskDefinition.GetSourcePathCount()); - GetTaskPropValue(m_tTaskDefinition.GetConfiguration(), m_afFilters); + chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration(), m_afFilters); //////////////////////////////// // now rarely changing task progress data @@ -278,7 +278,7 @@ m_bRareStateModified = true; m_bOftenStateModified = true; - m_workerThread.StartThread(DelegateThreadProc, this, GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + m_workerThread.StartThread(DelegateThreadProc, this, chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); } void CTask::ResumeProcessing() @@ -394,7 +394,7 @@ } } - pData->m_nPriority = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_nPriority = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); pData->m_pathDstPath = m_tTaskDefinition.GetDestinationPath(); pData->m_pafFilters = &m_afFilters; pData->m_eTaskState = m_eCurrentState; @@ -406,8 +406,8 @@ pData->m_eOperationType = m_tTaskDefinition.GetOperationType(); pData->m_eSubOperationType = m_tTaskDefinition.GetOperationPlan().GetSubOperationAt(m_tTaskBasicProgressInfo.GetSubOperationIndex()); - pData->m_bIgnoreDirectories = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); - pData->m_bCreateEmptyFiles = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_bIgnoreDirectories = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_bCreateEmptyFiles = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); if(m_files.GetSize() > 0) pData->m_iCurrentBufferIndex = m_localStats.GetCurrentBufferIndex(); @@ -417,19 +417,19 @@ switch(pData->m_iCurrentBufferIndex) { case chcore::TBufferSizes::eBuffer_Default: - pData->m_iCurrentBufferSize = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_iCurrentBufferSize = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); break; case chcore::TBufferSizes::eBuffer_OneDisk: - pData->m_iCurrentBufferSize = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_iCurrentBufferSize = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); break; case chcore::TBufferSizes::eBuffer_TwoDisks: - pData->m_iCurrentBufferSize = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_iCurrentBufferSize = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); break; case chcore::TBufferSizes::eBuffer_CD: - pData->m_iCurrentBufferSize = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_iCurrentBufferSize = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); break; case chcore::TBufferSizes::eBuffer_LAN: - pData->m_iCurrentBufferSize = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + pData->m_iCurrentBufferSize = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); break; default: THROW(_T("Unhandled case"), 0, 0, 0); @@ -611,15 +611,15 @@ OnBeginOperation(); // enable configuration changes tracking - m_tTaskDefinition.GetConfiguration().ConnectToNotifier(TTaskConfigTracker::NotificationProc, &m_cfgTracker); + m_tTaskDefinition.GetConfiguration().ConnectToNotifier(chcore::TTaskConfigTracker::NotificationProc, &m_cfgTracker); m_tTaskDefinition.GetConfiguration().ConnectToNotifier(CTask::OnCfgOptionChanged, this); // set thread options HANDLE hThread = GetCurrentThread(); - ::SetThreadPriorityBoost(hThread, GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + ::SetThreadPriorityBoost(hThread, chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); // determine when to scan directories - bool bReadTasksSize = GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + bool bReadTasksSize = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); // wait for permission to really start (but only if search for files is not allowed to start regardless of the lock) size_t stSubOperationIndex = m_tTaskBasicProgressInfo.GetSubOperationIndex(); @@ -741,15 +741,15 @@ // mark this task as dead, so other can start m_localStats.MarkTaskAsNotRunning(); - m_tTaskDefinition.GetConfiguration().DisconnectFromNotifier(TTaskConfigTracker::NotificationProc); + m_tTaskDefinition.GetConfiguration().DisconnectFromNotifier(chcore::TTaskConfigTracker::NotificationProc); m_tTaskDefinition.GetConfiguration().DisconnectFromNotifier(CTask::OnCfgOptionChanged); // and the real end OnEndOperation(); } catch(...) { - m_tTaskDefinition.GetConfiguration().DisconnectFromNotifier(TTaskConfigTracker::NotificationProc); + m_tTaskDefinition.GetConfiguration().DisconnectFromNotifier(chcore::TTaskConfigTracker::NotificationProc); m_tTaskDefinition.GetConfiguration().DisconnectFromNotifier(CTask::OnCfgOptionChanged); // refresh time @@ -855,9 +855,9 @@ if(!pTask) THROW(_T("Invalid pointer"), 0, 0, 0); - if(rsetChanges.HasValue(TaskPropData::GetPropertyName())) + if(rsetChanges.HasValue(chcore::TaskPropData::GetPropertyName())) { - pTask->m_workerThread.ChangePriority(GetTaskPropValue(pTask->GetTaskDefinition().GetConfiguration())); + pTask->m_workerThread.ChangePriority(chcore::GetTaskPropValue(pTask->GetTaskDefinition().GetConfiguration())); } } Index: src/ch/task.h =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/ch/task.h (.../task.h) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/task.h (.../task.h) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -19,20 +19,20 @@ #ifndef __TASK_H__ #define __TASK_H__ -#include "TAutoHandles.h" +#include "../libchcore/TAutoHandles.h" #include "../libchcore/TWorkerThreadController.h" #include "../libchcore/FileInfo.h" #include "../libchcore/DataBuffer.h" #include "../libchcore/FeedbackHandlerBase.h" #include "../libchcore/FileFilter.h" #include "../libchcore/TTaskDefinition.h" -#include "TTaskConfigTracker.h" +#include "../libchcore/TTaskConfigTracker.h" #include "../libchcore/TBasePathData.h" #include "TSubTaskBase.h" -#include "TTaskLocalStats.h" -#include "TTaskGlobalStats.h" -#include "TBasicProgressInfo.h" -#include "TLocalFilesystem.h" +#include "../libchcore/TTaskLocalStats.h" +#include "../libchcore/TTaskGlobalStats.h" +#include "../libchcore/TBasicProgressInfo.h" +#include "../libchcore/TLocalFilesystem.h" // enum representing current processing state of the task enum ETaskCurrentState @@ -157,7 +157,7 @@ // methods are called when task is being added or removed from the global task array /// Method is called when this task is being added to a CTaskArray object - void OnRegisterTask(TTasksGlobalStats& rtGlobalStats); + void OnRegisterTask(chcore::TTasksGlobalStats& rtGlobalStats); /// Method is called when task is being removed from the CTaskArray object void OnUnregisterTask(); @@ -208,7 +208,7 @@ // task initial information (needed to start a task); might be a bit processed. chcore::TTaskDefinition m_tTaskDefinition; - TTaskConfigTracker m_cfgTracker; + chcore::TTaskConfigTracker m_cfgTracker; chcore::TBasePathDataContainer m_arrSourcePathsInfo; @@ -219,10 +219,10 @@ // changing fast volatile ETaskCurrentState m_eCurrentState; // current state of processing this task represents - TTaskBasicProgressInfo m_tTaskBasicProgressInfo; // task progress information + chcore::TTaskBasicProgressInfo m_tTaskBasicProgressInfo; // task progress information // task control variables (per-session state) - TTaskLocalStats m_localStats; // local statistics + chcore::TTaskLocalStats m_localStats; // local statistics // task settings chcore::TFiltersArray m_afFilters; // filtering settings for files (will be filtered according to the rules inside when searching for files) @@ -242,7 +242,7 @@ icpf::log_file m_log; ///< Log file where task information will be stored // Local filesystem access - TLocalFilesystem m_fsLocal; + chcore::TLocalFilesystem m_fsLocal; /// Thread controlling object chcore::TWorkerThreadController m_workerThread; @@ -318,7 +318,7 @@ private: std::vector m_vTasks; // vector with tasks objects - TTasksGlobalStats m_globalStats; // global stats for all tasks + chcore::TTasksGlobalStats m_globalStats; // global stats for all tasks size_t m_stNextSessionUniqueID; // global counter for providing unique ids for tasks per session (launch of the program) Index: src/libchcore/ErrorCodes.h =================================================================== diff -u -rf46d334ffd78c7daa7626f214ae698adbac5f36d -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision f46d334ffd78c7daa7626f214ae698adbac5f36d) +++ src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -66,6 +66,9 @@ eErr_NodeDoesNotExist = 2504, eErr_UnsupportedMultipleSubnodesLevels = 2505, eErr_CannotWriteArchive = 2506, + + // Filesystem errors + eErr_FixedDriveWithoutDriveLetter = 3000, }; END_CHCORE_NAMESPACE Fisheye: tag 3aed0979e4af7cf1ab8083b835216b1edf5aba59 is not in file src/libchcore/TAutoHandles.h Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TAutoHandles.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 5fd6beaad9f1eccb664b997d151acb59961e4827 is not in file src/libchcore/TBasicProgressInfo.cpp Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TBasicProgressInfo.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 5fd6beaad9f1eccb664b997d151acb59961e4827 is not in file src/libchcore/TBasicProgressInfo.h Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TBasicProgressInfo.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 2aea3ad6f3c68be709ac65c70d9646eafe3b034c is not in file src/libchcore/TLocalFilesystem.cpp Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TLocalFilesystem.cpp'. Fisheye: No comparison available. Pass `N' to diff? Index: src/libchcore/TLocalFilesystem.h =================================================================== diff -u --- src/libchcore/TLocalFilesystem.h (revision 0) +++ src/libchcore/TLocalFilesystem.h (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -0,0 +1,138 @@ +// ============================================================================ +// Copyright (C) 2001-2010 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +/// @file TLocalFilesystem.h +/// @date 2011/03/24 +/// @brief Contains class responsible for accessing local filesystem. +// ============================================================================ +#ifndef __TLOCALFILESYSTEM_H__ +#define __TLOCALFILESYSTEM_H__ + +#include "libchcore.h" +#include "TPath.h" +#include + +BEGIN_CHCORE_NAMESPACE + +class TFileInfo; +typedef boost::shared_ptr TFileInfoPtr; + +class TAutoFileHandle; +class TLocalFilesystemFind; +class TLocalFilesystemFile; +class TDataBuffer; + +class LIBCHCORE_API TLocalFilesystem +{ +public: + enum EPathsRelation + { + eRelation_Network, // at least one of the paths is network one + eRelation_CDRom, // at least one of the paths relates to cd/dvd drive + eRelation_TwoPhysicalDisks, // paths lies on two separate physical disks + eRelation_SinglePhysicalDisk, // paths lies on the same physical disk + eRelation_Other // other type of relation + }; + +public: + static bool PathExist(TSmartPath strPath); // check for file or folder existence + + static bool SetFileDirectoryTime(const TSmartPath& pathFileDir, const FILETIME& ftCreationTime, const FILETIME& ftLastAccessTime, const FILETIME& ftLastWriteTime); + static bool SetAttributes(const TSmartPath& pathFileDir, DWORD dwAttributes); + + static bool CreateDirectory(const TSmartPath& pathDirectory, bool bCreateFullPath); + static bool RemoveDirectory(const TSmartPath& pathFile); + static bool DeleteFile(const TSmartPath& pathFile); + + static bool GetFileInfo(const TSmartPath& pathFile, TFileInfoPtr& rFileInfo, size_t stSrcIndex = std::numeric_limits::max(), const TPathContainer* pBasePaths = NULL); + static bool FastMove(const TSmartPath& pathSource, const TSmartPath& pathDestination); + + static TLocalFilesystemFind CreateFinderObject(const TSmartPath& pathDir, const TSmartPath& pathMask); + static TLocalFilesystemFile CreateFileObject(); + + EPathsRelation GetPathsRelation(const TSmartPath& pathFirst, const TSmartPath& pathSecond); + + bool GetDynamicFreeSpace(const TSmartPath& path, unsigned long long& rullFree); + +private: + static TSmartPath PrependPathExtensionIfNeeded(const TSmartPath& pathInput); + static UINT GetDriveData(const TSmartPath& spPath); + DWORD GetPhysicalDiskNumber(wchar_t wchDrive); + +private: +#pragma warning(push) +#pragma warning(disable: 4251) + std::map m_mapDriveLetterToPhysicalDisk; // caches drive letter -> physical disk number + boost::shared_mutex m_lockDriveLetterToPhysicalDisk; +#pragma warning(pop) + + friend class TLocalFilesystemFind; + friend class TLocalFilesystemFile; +}; + +class LIBCHCORE_API TLocalFilesystemFind +{ +public: + ~TLocalFilesystemFind(); + + bool FindNext(TFileInfoPtr& rspFileInfo); + void Close(); + +private: + TLocalFilesystemFind(const TSmartPath& pathDir, const TSmartPath& pathMask); + +private: + TSmartPath m_pathDir; + TSmartPath m_pathMask; + HANDLE m_hFind; + + friend class TLocalFilesystem; +}; + +class LIBCHCORE_API TLocalFilesystemFile +{ +public: + ~TLocalFilesystemFile(); + + bool OpenExistingForReading(const TSmartPath& pathFile, bool bNoBuffering); + bool CreateNewForWriting(const TSmartPath& pathFile, bool bNoBuffering); + bool OpenExistingForWriting(const TSmartPath& pathFile, bool bNoBuffering); + + bool SetFilePointer(long long llNewPos, DWORD dwMoveMethod); + bool SetEndOfFile(); + + bool ReadFile(TDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead); + bool WriteFile(TDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten); + + bool IsOpen() const { return m_hFile != INVALID_HANDLE_VALUE; } + + void Close(); + +private: + TLocalFilesystemFile(); + +private: + TSmartPath m_pathFile; + HANDLE m_hFile; + + friend class TLocalFilesystem; +}; + +END_CHCORE_NAMESPACE + +#endif Fisheye: tag 633a533cb6e741d44fe28aa56339e1d2709b1b27 is not in file src/libchcore/TTaskConfigTracker.cpp Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskConfigTracker.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 633a533cb6e741d44fe28aa56339e1d2709b1b27 is not in file src/libchcore/TTaskConfigTracker.h Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskConfigTracker.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 2aea3ad6f3c68be709ac65c70d9646eafe3b034c is not in file src/libchcore/TTaskConfiguration.h Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskConfiguration.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 6e8aa26e2428e3bc71099255c5911f57bc722100 is not in file src/libchcore/TTaskGlobalStats.cpp Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskGlobalStats.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 6e8aa26e2428e3bc71099255c5911f57bc722100 is not in file src/libchcore/TTaskGlobalStats.h Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskGlobalStats.h'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 6e8aa26e2428e3bc71099255c5911f57bc722100 is not in file src/libchcore/TTaskLocalStats.cpp Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskLocalStats.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 6e8aa26e2428e3bc71099255c5911f57bc722100 is not in file src/libchcore/TTaskLocalStats.h Fisheye: Tag fb4c4006dee5aaf815d08bc3e89312445b994307 refers to a dead (removed) revision in file `src/ch/TTaskLocalStats.h'. Fisheye: No comparison available. Pass `N' to diff? Index: src/libchcore/libchcore.vc90.vcproj =================================================================== diff -u -rf46d334ffd78c7daa7626f214ae698adbac5f36d -rfb4c4006dee5aaf815d08bc3e89312445b994307 --- src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision f46d334ffd78c7daa7626f214ae698adbac5f36d) +++ src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision fb4c4006dee5aaf815d08bc3e89312445b994307) @@ -364,13 +364,61 @@ > + + + + + + + + + + + + + + + + + + + + + + + +