Index: src/ch/FeedbackReplaceDlg.cpp =================================================================== diff -u -r25b3c85ea493809ee084271d5101a015d349da95 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/ch/FeedbackReplaceDlg.cpp (.../FeedbackReplaceDlg.cpp) (revision 25b3c85ea493809ee084271d5101a015d349da95) +++ src/ch/FeedbackReplaceDlg.cpp (.../FeedbackReplaceDlg.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -99,15 +99,15 @@ fmt.SetParam(_T("%filename"), m_spSrcFile->GetFullFilePath().ToString()); fmt.SetParam(_T("%size"), m_spSrcFile->GetLength64()); - COleDateTime dtTemp = m_spSrcFile->GetLastWriteTime(); + COleDateTime dtTemp = m_spSrcFile->GetLastWriteTime().GetAsFiletime(); fmt.SetParam(_T("%datemod"), dtTemp.Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT)); m_ctlSrcInfo.SetWindowText(fmt); fmt.SetFormat(strTemplate); fmt.SetParam(_T("%filename"), m_spDstFile->GetFullFilePath().ToString()); fmt.SetParam(_T("%size"), m_spDstFile->GetLength64()); - dtTemp = m_spDstFile->GetLastWriteTime(); + dtTemp = m_spDstFile->GetLastWriteTime().GetAsFiletime(); fmt.SetParam(_T("%datemod"), dtTemp.Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT)); m_ctlDstInfo.SetWindowText(fmt); Index: src/libchcore/ISerializerRowReader.h =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/ISerializerRowReader.h (.../ISerializerRowReader.h) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/libchcore/ISerializerRowReader.h (.../ISerializerRowReader.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -40,6 +40,8 @@ virtual void GetValue(const TString& strColName, unsigned short& uiValue) = 0; virtual void GetValue(const TString& strColName, int& iValue) = 0; virtual void GetValue(const TString& strColName, unsigned int& uiValue) = 0; + virtual void GetValue(const TString& strColName, long& lValue) = 0; + virtual void GetValue(const TString& strColName, unsigned long& ulValue) = 0; virtual void GetValue(const TString& strColName, long long& llValue) = 0; virtual void GetValue(const TString& strColName, unsigned long long& llValue) = 0; virtual void GetValue(const TString& strColName, double& dValue) = 0; Index: src/libchcore/TBasePathData.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -27,6 +27,7 @@ #include "TCoreException.h" #include "ErrorCodes.h" #include "TRowData.h" +#include "ISerializerContainer.h" #include "ISerializerRowData.h" #include #include "TPathContainer.h" @@ -221,12 +222,25 @@ m_vEntries.erase(m_vEntries.begin() + stIndex); } -chcore::TBasePathDataPtr TBasePathDataContainer::GetAt(size_t stIndex) const +TBasePathDataPtr TBasePathDataContainer::GetAt(size_t stIndex) const { boost::shared_lock lock(m_lock); return m_vEntries.at(stIndex); } + +TBasePathDataPtr TBasePathDataContainer::FindByID(size_t stObjectID) const +{ + boost::shared_lock lock(m_lock); + BOOST_FOREACH(const TBasePathDataPtr& spItem, m_vEntries) + { + if(spItem->GetObjectID() == stObjectID) + return spItem; + } + + THROW_CORE_EXCEPTION(eErr_InvalidArgument); +} + void TBasePathDataContainer::ClearNL() { BOOST_FOREACH(const TBasePathDataPtr& spItem, m_vEntries) Index: src/libchcore/TBasePathData.h =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -25,10 +25,12 @@ #include "libchcore.h" #include "TPath.h" -#include "TModPathContainer.h" #include #include "TSharedModificationTracker.h" #include "TRemovedObjects.h" +#include "ISerializerRowData.h" +#include "IColumnsDefinition.h" +#include "ISerializerRowReader.h" BEGIN_CHCORE_NAMESPACE @@ -104,6 +106,8 @@ void Add(const TBasePathDataPtr& spEntry); void RemoveAt(size_t stIndex); TBasePathDataPtr GetAt(size_t stIndex) const; + TBasePathDataPtr FindByID(size_t stObjectID) const; + void Clear(); bool IsEmpty() const; Index: src/libchcore/TFileFilter.cpp =================================================================== diff -u -rba802caea92ee56a154d1da3fe89a4b2f7875f0e -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) +++ src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -433,13 +433,13 @@ switch(m_eDateType) { case eDateType_Created: - tDateTime = spInfo->GetCreationTime(); + tDateTime = spInfo->GetCreationTime().GetAsFiletime(); break; case eDateType_Modified: - tDateTime = spInfo->GetLastWriteTime(); + tDateTime = spInfo->GetLastWriteTime().GetAsFiletime(); break; case eDateType_LastAccessed: - tDateTime = spInfo->GetLastAccessTime(); + tDateTime = spInfo->GetLastAccessTime().GetAsFiletime(); break; } Index: src/libchcore/TFileInfo.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -20,11 +20,11 @@ // Almost everything has changed since then. #include "stdafx.h" #include "TFileInfo.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TCoreException.h" #include "ErrorCodes.h" -#include "TModPathContainer.h" +#include "TRowData.h" +#include "ISerializerRowData.h" +#include "ISerializerContainer.h" BEGIN_CHCORE_NAMESPACE @@ -33,14 +33,17 @@ ////////////////////////////////////////////////////////////////////// TFileInfo::TFileInfo() : - m_pathFile(), - m_dwAttributes(0), - m_uhFileSize(0), - m_uiFlags(0) + m_pathFile(m_setModifications), + m_spBasePathData(m_setModifications), + m_dwAttributes(m_setModifications, 0), + m_uhFileSize(m_setModifications, 0), + m_ftCreation(m_setModifications), + m_ftLastAccess(m_setModifications), + m_ftLastWrite(m_setModifications), + m_uiFlags(m_setModifications, 0), + m_stObjectID(0) { - m_ftCreation.dwHighDateTime = m_ftCreation.dwLowDateTime = 0; - m_ftLastAccess.dwHighDateTime = m_ftLastAccess.dwLowDateTime = 0; - m_ftLastWrite.dwHighDateTime = m_ftLastWrite.dwLowDateTime = 0; + m_setModifications[eMod_Added] = true; } TFileInfo::TFileInfo(const TFileInfo& rSrc) : @@ -51,14 +54,33 @@ m_ftCreation(rSrc.m_ftCreation), m_ftLastAccess(rSrc.m_ftLastAccess), m_ftLastWrite(rSrc.m_ftLastWrite), - m_uiFlags(rSrc.m_uiFlags) + m_uiFlags(rSrc.m_uiFlags), + m_stObjectID(rSrc.m_stObjectID) { } TFileInfo::~TFileInfo() { } +TFileInfo& TFileInfo::operator=(const TFileInfo& rSrc) +{ + if(this != & rSrc) + { + m_pathFile = rSrc.m_pathFile; + m_spBasePathData = rSrc.m_spBasePathData; + m_dwAttributes = rSrc.m_dwAttributes; + m_uhFileSize = rSrc.m_uhFileSize; + m_ftCreation = rSrc.m_ftCreation; + m_ftLastAccess = rSrc.m_ftLastAccess; + m_ftLastWrite = rSrc.m_ftLastWrite; + m_uiFlags = rSrc.m_uiFlags; + m_stObjectID = rSrc.m_stObjectID; + } + + return *this; +} + void TFileInfo::Init(const TBasePathDataPtr& spBasePathData, const TSmartPath& rpathFile, DWORD dwAttributes, ULONGLONG uhFileSize, FILETIME ftCreation, FILETIME ftLastAccess, FILETIME ftLastWrite, uint_t uiFlags) @@ -72,15 +94,15 @@ m_ftLastWrite = ftLastWrite; m_uiFlags = uiFlags; - if(m_spBasePathData) - m_pathFile.MakeRelativePath(m_spBasePathData->GetSrcPath()); + if(m_spBasePathData.Get()) + m_pathFile.Modify().MakeRelativePath(m_spBasePathData.Get()->GetSrcPath()); } void TFileInfo::Init(const TSmartPath& rpathFile, DWORD dwAttributes, ULONGLONG uhFileSize, FILETIME ftCreation, FILETIME ftLastAccess, FILETIME ftLastWrite, uint_t uiFlags) { m_pathFile = rpathFile; - m_spBasePathData.reset(); + m_spBasePathData.Modify().reset(); m_dwAttributes = dwAttributes; m_uhFileSize = uhFileSize; m_ftCreation = ftCreation; @@ -92,25 +114,27 @@ void TFileInfo::SetParentObject(const TBasePathDataPtr& spBasePathData) { // cannot set parent object if there is already one specified - if(m_spBasePathData) + if(m_spBasePathData.Get()) THROW_CORE_EXCEPTION(eErr_InvalidArgument); m_spBasePathData = spBasePathData; - if(m_spBasePathData) - m_pathFile.MakeRelativePath(m_spBasePathData->GetSrcPath()); + if(m_spBasePathData.Get()) + m_pathFile.Modify().MakeRelativePath(m_spBasePathData.Get()->GetSrcPath()); } -bool TFileInfo::operator==(const TFileInfo& rInfo) +bool TFileInfo::operator==(const TFileInfo& rInfo) const { - return (rInfo.m_dwAttributes == m_dwAttributes && rInfo.m_ftCreation.dwHighDateTime == m_ftCreation.dwHighDateTime && rInfo.m_ftCreation.dwLowDateTime == m_ftCreation.dwLowDateTime - && rInfo.m_ftLastWrite.dwHighDateTime == m_ftLastWrite.dwHighDateTime && rInfo.m_ftLastWrite.dwLowDateTime == m_ftLastWrite.dwLowDateTime && rInfo.m_uhFileSize == m_uhFileSize); + return (rInfo.m_dwAttributes == m_dwAttributes && + rInfo.m_ftCreation.Get() == m_ftCreation.Get() && + rInfo.m_ftLastWrite.Get() == m_ftLastWrite.Get() && + rInfo.m_uhFileSize == m_uhFileSize); } TSmartPath TFileInfo::GetFullFilePath() const { - if(m_spBasePathData) + if(m_spBasePathData.Get()) { - TSmartPath pathCombined = m_spBasePathData->GetSrcPath(); + TSmartPath pathCombined = m_spBasePathData.Get()->GetSrcPath(); pathCombined += m_pathFile; return pathCombined; } @@ -120,8 +144,8 @@ size_t TFileInfo::GetSrcObjectID() const { - if(m_spBasePathData) - return m_spBasePathData->GetObjectID(); + if(m_spBasePathData.Get()) + return m_spBasePathData.Get()->GetObjectID(); return std::numeric_limits::max(); } @@ -130,4 +154,168 @@ return m_spBasePathData; } +void TFileInfo::MarkAsProcessed(bool bProcessed) +{ + if(bProcessed) + m_uiFlags.Modify() |= eFlag_Processed; + else + m_uiFlags.Modify() &= ~eFlag_Processed; +} + +bool TFileInfo::IsProcessed() const +{ + return m_uiFlags & eFlag_Processed; +} + +ULONGLONG TFileInfo::GetLength64() const +{ + return m_uhFileSize; +} + +void TFileInfo::SetLength64(ULONGLONG uhSize) +{ + m_uhFileSize=uhSize; +} + +const TSmartPath& TFileInfo::GetFilePath() const +{ + return m_pathFile; +} + +void TFileInfo::SetFilePath(const TSmartPath& tPath) +{ + m_pathFile = tPath; +} + +const TFileTime& TFileInfo::GetCreationTime() const +{ + return m_ftCreation; +} + +const TFileTime& TFileInfo::GetLastAccessTime() const +{ + return m_ftLastAccess; +} + +const TFileTime& TFileInfo::GetLastWriteTime() const +{ + return m_ftLastWrite; +} + +DWORD TFileInfo::GetAttributes() const +{ + return m_dwAttributes; +} + +bool TFileInfo::IsDirectory() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; +} + +bool TFileInfo::IsArchived() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_ARCHIVE) != 0; +} + +bool TFileInfo::IsReadOnly() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_READONLY) != 0; +} + +bool TFileInfo::IsCompressed() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_COMPRESSED) != 0; +} + +bool TFileInfo::IsSystem() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_SYSTEM) != 0; +} + +bool TFileInfo::IsHidden() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_HIDDEN) != 0; +} + +bool TFileInfo::IsTemporary() const +{ + return (m_dwAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0; +} + +bool TFileInfo::IsNormal() const +{ + return m_dwAttributes == 0; +} + +void TFileInfo::Store(const ISerializerContainerPtr& spContainer) const +{ + ISerializerRowDataPtr spRow; + if(m_setModifications[eMod_Added]) + spRow = spContainer->AddRow(m_stObjectID); + else if(m_setModifications.any()) + spRow = spContainer->GetRow(m_stObjectID); + else + return; + + if(m_setModifications[eMod_Path]) + *spRow % TRowData(_T("rel_path"), m_pathFile); + if(m_setModifications[eMod_BasePath]) + *spRow % TRowData(_T("base_path_id"), m_spBasePathData.Get()->GetObjectID()); + if(m_setModifications[eMod_Attributes]) + *spRow % TRowData(_T("attr"), m_dwAttributes); + if(m_setModifications[eMod_FileSize]) + *spRow % TRowData(_T("size"), m_uhFileSize); + if(m_setModifications[eMod_TimeCreated]) + *spRow % TRowData(_T("time_created"), m_ftCreation.Get().ToUInt64()); + if(m_setModifications[eMod_TimeLastWrite]) + *spRow % TRowData(_T("time_last_write"), m_ftLastWrite.Get().ToUInt64()); + if(m_setModifications[eMod_TimeLastAccess]) + *spRow % TRowData(_T("time_last_access"), m_ftLastAccess.Get().ToUInt64()); + if(m_setModifications[eMod_Flags]) + *spRow % TRowData(_T("flags"), m_uiFlags); + + m_setModifications.reset(); +} + +void TFileInfo::InitLoader(const IColumnsDefinitionPtr& spColumns) +{ + *spColumns % _T("id") % _T("rel_path") % _T("base_path_id") % _T("attr") % _T("size") % _T("time_created") % _T("time_last_write") % _T("time_last_access") % _T("flags"); +} + +void TFileInfo::Load(const ISerializerRowReaderPtr& spRowReader, const TBasePathDataContainerPtr& spSrcContainer) +{ + size_t stBaseObjectID = 0; + unsigned long long ullTime = 0; + spRowReader->GetValue(_T("id"), m_stObjectID); + spRowReader->GetValue(_T("rel_path"), m_pathFile.Modify()); + spRowReader->GetValue(_T("base_path_id"), stBaseObjectID); + spRowReader->GetValue(_T("attr"), m_dwAttributes.Modify()); + spRowReader->GetValue(_T("size"), m_uhFileSize.Modify()); + + spRowReader->GetValue(_T("time_created"), ullTime); + m_ftCreation.Modify().FromUInt64(ullTime); + + spRowReader->GetValue(_T("time_last_write"), ullTime); + m_ftLastWrite.Modify().FromUInt64(ullTime); + + spRowReader->GetValue(_T("time_last_access"), ullTime); + m_ftLastAccess.Modify().FromUInt64(ullTime); + + spRowReader->GetValue(_T("flags"), m_uiFlags.Modify()); + + m_spBasePathData = spSrcContainer->FindByID(stBaseObjectID); + + m_setModifications.reset(); +} + +size_t TFileInfo::GetObjectID() const +{ + return m_stObjectID; +} + +void TFileInfo::SetObjectID(size_t stObjectID) +{ + m_stObjectID = stObjectID; +} + END_CHCORE_NAMESPACE Index: src/libchcore/TFileInfo.h =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -25,24 +25,33 @@ #include "libchcore.h" #include "TPath.h" #include "TBasePathData.h" +#include +#include "TSharedModificationTracker.h" +#include "TFileTime.h" BEGIN_CHCORE_NAMESPACE -class TModPathContainer; -class TReadBinarySerializer; -class TWriteBinarySerializer; - // CFileInfo flags -// flag stating that file has been processed (used to determine if file can be deleted at the end of copying) -#define FIF_PROCESSED 0x00000001 class LIBCHCORE_API TFileInfo { public: + enum EFlags + { + // flag stating that file has been processed (used to determine if file can be deleted at the end of copying) + eFlag_Processed = 1, + }; + +public: TFileInfo(); - TFileInfo(const TFileInfo& finf); + TFileInfo(const TFileInfo& rSrc); ~TFileInfo(); + TFileInfo& operator=(const TFileInfo& rSrc); + + // operators + bool operator==(const TFileInfo& rInfo) const; + // with base path void Init(const TBasePathDataPtr& spBasePathData, const TSmartPath& rpathFile, DWORD dwAttributes, ULONGLONG uhFileSize, FILETIME ftCreation, FILETIME ftLastAccess, FILETIME ftLastWrite, @@ -52,57 +61,81 @@ void Init(const TSmartPath& rpathFile, DWORD dwAttributes, ULONGLONG uhFileSize, FILETIME ftCreation, FILETIME ftLastAccess, FILETIME ftLastWrite, uint_t uiFlags); - // setting parent object - TBasePathDataPtr GetBasePathData() const; + // unique object id + size_t GetObjectID() const; + void SetObjectID(size_t stObjectID); + // parent object + TBasePathDataPtr GetBasePathData() const; void SetParentObject(const TBasePathDataPtr& spBasePathData); + size_t GetSrcObjectID() const; - ULONGLONG GetLength64() const { return m_uhFileSize; } - void SetLength64(ULONGLONG uhSize) { m_uhFileSize=uhSize; } - - const TSmartPath& GetFilePath() const { return m_pathFile; } // returns path with m_pathFile (probably not full) + // file path + const TSmartPath& GetFilePath() const; // returns path with m_pathFile (probably not full) TSmartPath GetFullFilePath() const; // returns full path - void SetFilePath(const TSmartPath& tPath) { m_pathFile = tPath; }; + void SetFilePath(const TSmartPath& tPath); - /* Get File times info (equivalent to CFindFile members) */ - const FILETIME& GetCreationTime() const { return m_ftCreation; }; - const FILETIME& GetLastAccessTime() const { return m_ftLastAccess; }; - const FILETIME& GetLastWriteTime() const { return m_ftLastWrite; }; + // file size + ULONGLONG GetLength64() const; + void SetLength64(ULONGLONG uhSize); - /* Get File attributes info (equivalent to CFindFile members) */ - DWORD GetAttributes() const { return m_dwAttributes; } - bool IsDirectory() const { return (m_dwAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; } - bool IsArchived() const { return (m_dwAttributes & FILE_ATTRIBUTE_ARCHIVE) != 0; } - bool IsReadOnly() const { return (m_dwAttributes & FILE_ATTRIBUTE_READONLY) != 0; } - bool IsCompressed() const { return (m_dwAttributes & FILE_ATTRIBUTE_COMPRESSED) != 0; } - bool IsSystem() const { return (m_dwAttributes & FILE_ATTRIBUTE_SYSTEM) != 0; } - bool IsHidden() const { return (m_dwAttributes & FILE_ATTRIBUTE_HIDDEN) != 0; } - bool IsTemporary() const { return (m_dwAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0; } - bool IsNormal() const { return m_dwAttributes == 0; } + // file times + const TFileTime& GetCreationTime() const; + const TFileTime& GetLastAccessTime() const; + const TFileTime& GetLastWriteTime() const; - uint_t GetFlags() const { return m_uiFlags; } - void SetFlags(uint_t uiFlags, uint_t uiMask = 0xffffffff) { m_uiFlags = (m_uiFlags & ~(uiFlags & uiMask)) | (uiFlags & uiMask); } + // attributes + DWORD GetAttributes() const; + bool IsDirectory() const; + bool IsArchived() const; + bool IsReadOnly() const; + bool IsCompressed() const; + bool IsSystem() const; + bool IsHidden() const; + bool IsTemporary() const; + bool IsNormal() const; - size_t GetSrcObjectID() const; + void MarkAsProcessed(bool bProcessed); + bool IsProcessed() const; - // operators - bool operator==(const TFileInfo& rInfo); + void Store(const ISerializerContainerPtr& spContainer) const; + static void InitLoader(const IColumnsDefinitionPtr& spColumns); + void Load(const ISerializerRowReaderPtr& spRowReader, const TBasePathDataContainerPtr& spSrcContainer); private: - TSmartPath m_pathFile; // contains relative path (first path is in CClipboardArray) + enum EModifications + { + eMod_None = 0, + eMod_Added, + eMod_Path, + eMod_BasePath, + eMod_Attributes, + eMod_FileSize, + eMod_TimeCreated, + eMod_TimeLastAccess, + eMod_TimeLastWrite, + eMod_Flags, + // do not use - must be the last value in this enum + eMod_Last + }; + #pragma warning(push) #pragma warning(disable: 4251) - TBasePathDataPtr m_spBasePathData; -#pragma warning(pop) + typedef std::bitset Bitset; + mutable Bitset m_setModifications; - DWORD m_dwAttributes; // attributes - ULONGLONG m_uhFileSize; - FILETIME m_ftCreation; - FILETIME m_ftLastAccess; - FILETIME m_ftLastWrite; + size_t m_stObjectID; - uint_t m_uiFlags; + TSharedModificationTracker m_pathFile; + TSharedModificationTracker m_spBasePathData; + TSharedModificationTracker m_dwAttributes; // attributes + TSharedModificationTracker m_uhFileSize; + TSharedModificationTracker m_ftCreation; + TSharedModificationTracker m_ftLastAccess; + TSharedModificationTracker m_ftLastWrite; + TSharedModificationTracker m_uiFlags; +#pragma warning(pop) }; typedef boost::shared_ptr TFileInfoPtr; Index: src/libchcore/TFileInfoArray.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -25,13 +25,15 @@ #include "TBinarySerializer.h" #include "SerializationHelpers.h" #include "TFileInfo.h" +#include "ISerializerContainer.h" BEGIN_CHCORE_NAMESPACE /////////////////////////////////////////////////////////////////////// // Array TFileInfoArray::TFileInfoArray() : - m_bComplete(false) + m_bComplete(false), + m_stLastObjectID(0) { } @@ -42,6 +44,7 @@ void TFileInfoArray::AddFileInfo(const TFileInfoPtr& spFileInfo) { boost::unique_lock lock(m_lock); + spFileInfo->SetObjectID(++m_stLastObjectID); m_vFiles.push_back(spFileInfo); } @@ -79,6 +82,10 @@ boost::unique_lock lock(m_lock); m_vFiles.clear(); m_bComplete = false; + BOOST_FOREACH(const TFileInfoPtr& spFileInfo, m_vFiles) + { + m_setRemovedObjects.Add(spFileInfo->GetObjectID()); + } } unsigned long long TFileInfoArray::CalculateTotalSize() const @@ -122,4 +129,44 @@ return ullSize; } +void TFileInfoArray::Store(const ISerializerContainerPtr& spContainer) const +{ + boost::shared_lock lock(m_lock); + + // store only if there is a complete collection of items inside + // (this container is used in the directory scanning process. There is no + // point storing only partially scanned data in the serializer as we + // can't use this data after loading serialized data (dir scan will have + // to scan again)). + if(m_bComplete) + { + BOOST_FOREACH(const TFileInfoPtr& spFileInfo, m_vFiles) + { + spFileInfo->Store(spContainer); + } + } +} + +void TFileInfoArray::Load(const ISerializerContainerPtr& spContainer, const TBasePathDataContainerPtr& spBasePaths) +{ + IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); + if(spColumns->IsEmpty()) + TFileInfo::InitLoader(spColumns); + + std::vector vEntries; + ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); + while(spRowReader->Next()) + { + TFileInfoPtr spFileInfo(new TFileInfo); + spFileInfo->Load(spRowReader, spBasePaths); + + vEntries.push_back(spFileInfo); + + m_stLastObjectID = std::max(m_stLastObjectID, spFileInfo->GetObjectID()); + } + + boost::unique_lock lock(m_lock); + m_vFiles = vEntries; +} + END_CHCORE_NAMESPACE Index: src/libchcore/TFileInfoArray.h =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TFileInfoArray.h (.../TFileInfoArray.h) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TFileInfoArray.h (.../TFileInfoArray.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -24,13 +24,10 @@ #include "libchcore.h" #include "TPath.h" +#include "TBasePathData.h" BEGIN_CHCORE_NAMESPACE -// CFileInfo flags -// flag stating that file has been processed (used to determine if file can be deleted at the end of copying) -#define FIF_PROCESSED 0x00000001 - class TFileInfo; typedef boost::shared_ptr TFileInfoPtr; @@ -65,18 +62,19 @@ void SetComplete(bool bComplete); bool IsComplete() const; - /// Stores infos about elements in the archive - void Serialize(TReadBinarySerializer& rSerializer, bool bOnlyFlags); - void Serialize(TWriteBinarySerializer& rSerializer, bool bOnlyFlags) const; + void Store(const ISerializerContainerPtr& spContainer) const; + void Load(const ISerializerContainerPtr& spContainer, const TBasePathDataContainerPtr& spBasePaths); protected: bool m_bComplete; #pragma warning(push) #pragma warning(disable: 4251) + TRemovedObjects m_setRemovedObjects; std::vector m_vFiles; mutable boost::shared_mutex m_lock; #pragma warning(pop) + size_t m_stLastObjectID; }; END_CHCORE_NAMESPACE Index: src/libchcore/TFileTime.cpp =================================================================== diff -u --- src/libchcore/TFileTime.cpp (revision 0) +++ src/libchcore/TFileTime.cpp (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -0,0 +1,94 @@ +// ============================================================================ +// Copyright (C) 2001-2014 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. +// ============================================================================ +#include "stdafx.h" +#include "TFileTime.h" + +BEGIN_CHCORE_NAMESPACE + +TFileTime::TFileTime() +{ + m_ftTime.dwHighDateTime = 0; + m_ftTime.dwLowDateTime = 0; +} + +TFileTime::TFileTime(const TFileTime& rSrc) : + m_ftTime(rSrc.m_ftTime) +{ +} + +TFileTime::TFileTime(const FILETIME& rftTime) : + m_ftTime(rftTime) +{ +} + +TFileTime::~TFileTime() +{ +} + +TFileTime& TFileTime::operator=(const TFileTime& rSrc) +{ + if(this != &rSrc) + { + m_ftTime = rSrc.m_ftTime; + } + + return *this; +} + +TFileTime& TFileTime::operator=(const FILETIME& rSrc) +{ + m_ftTime = rSrc; + + return *this; +} + + +bool TFileTime::operator==(const TFileTime& rSrc) const +{ + return m_ftTime.dwHighDateTime == rSrc.m_ftTime.dwHighDateTime && m_ftTime.dwLowDateTime == rSrc.m_ftTime.dwLowDateTime; +} + +bool TFileTime::operator!=(const TFileTime& rSrc) const +{ + return m_ftTime.dwHighDateTime != rSrc.m_ftTime.dwHighDateTime || m_ftTime.dwLowDateTime != rSrc.m_ftTime.dwLowDateTime; +} + +void TFileTime::FromUInt64(unsigned long long ullTime) +{ + ULARGE_INTEGER uli; + uli.QuadPart = ullTime; + m_ftTime.dwLowDateTime = uli.LowPart; + m_ftTime.dwHighDateTime = uli.HighPart; +} + +unsigned long long TFileTime::ToUInt64() const +{ + ULARGE_INTEGER uli; + uli.HighPart = m_ftTime.dwHighDateTime; + uli.LowPart = m_ftTime.dwLowDateTime; + + return uli.QuadPart; +} + +const FILETIME& TFileTime::GetAsFiletime() const +{ + return m_ftTime; +} + +END_CHCORE_NAMESPACE Index: src/libchcore/TFileTime.h =================================================================== diff -u --- src/libchcore/TFileTime.h (revision 0) +++ src/libchcore/TFileTime.h (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -0,0 +1,53 @@ +// ============================================================================ +// Copyright (C) 2001-2014 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. +// ============================================================================ +#ifndef __TFILETIME_H__ +#define __TFILETIME_H__ + +#include "libchcore.h" + +BEGIN_CHCORE_NAMESPACE + +class LIBCHCORE_API TFileTime +{ +public: + TFileTime(); + TFileTime(const FILETIME& rftTime); + TFileTime(const TFileTime& rSrc); + ~TFileTime(); + + TFileTime& operator=(const TFileTime& rSrc); + TFileTime& operator=(const FILETIME& rSrc); + + bool operator==(const TFileTime& rSrc) const; + bool operator!=(const TFileTime& rSrc) const; + + const FILETIME& GetAsFiletime() const; + + void FromUInt64(unsigned long long ullTime); + unsigned long long ToUInt64() const; + +private: + FILETIME m_ftTime; +}; + +typedef boost::shared_ptr TFileTimePtr; + +END_CHCORE_NAMESPACE + +#endif Index: src/libchcore/TLocalFilesystem.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -37,7 +37,7 @@ #include "TCoreException.h" #include "ErrorCodes.h" #include "TPathContainer.h" -#include "TModPathContainer.h" +#include "TFileTime.h" BEGIN_CHCORE_NAMESPACE @@ -90,13 +90,13 @@ return false; } -bool TLocalFilesystem::SetFileDirectoryTime(const TSmartPath& pathFileDir, const FILETIME& ftCreationTime, const FILETIME& ftLastAccessTime, const FILETIME& ftLastWriteTime) +bool TLocalFilesystem::SetFileDirectoryTime(const TSmartPath& pathFileDir, const TFileTime& ftCreationTime, const TFileTime& ftLastAccessTime, const TFileTime& ftLastWriteTime) { TAutoFileHandle hFile = CreateFile(PrependPathExtensionIfNeeded(pathFileDir).ToString(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL); if(hFile == INVALID_HANDLE_VALUE) return false; - BOOL bResult = SetFileTime(hFile, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime); + BOOL bResult = SetFileTime(hFile, &ftCreationTime.GetAsFiletime(), &ftLastAccessTime.GetAsFiletime(), &ftLastWriteTime.GetAsFiletime()); if(!hFile.Close()) return false; Index: src/libchcore/TLocalFilesystem.h =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TLocalFilesystem.h (.../TLocalFilesystem.h) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TLocalFilesystem.h (.../TLocalFilesystem.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -36,7 +36,7 @@ class TLocalFilesystemFind; class TLocalFilesystemFile; class TSimpleDataBuffer; -class TModPathContainer; +class TFileTime; class LIBCHCORE_API TLocalFilesystem { @@ -53,7 +53,7 @@ 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 SetFileDirectoryTime(const TSmartPath& pathFileDir, const TFileTime& ftCreationTime, const TFileTime& ftLastAccessTime, const TFileTime& ftLastWriteTime); static bool SetAttributes(const TSmartPath& pathFileDir, DWORD dwAttributes); static bool CreateDirectory(const TSmartPath& pathDirectory, bool bCreateFullPath); Index: src/libchcore/TRowData.cpp =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TRowData.cpp (.../TRowData.cpp) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/libchcore/TRowData.cpp (.../TRowData.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -81,6 +81,18 @@ { } +TRowData::TRowData(const TString& strColName, long lValue) : + m_strColName(strColName), + m_varValue(lValue) +{ +} + +TRowData::TRowData(const TString& strColName, unsigned long ulValue) : + m_strColName(strColName), + m_varValue(ulValue) +{ +} + TRowData::~TRowData() { } Index: src/libchcore/TRowData.h =================================================================== diff -u -r31c4b1fc46687ed2cf35dd9fa0acec2543ae1886 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TRowData.h (.../TRowData.h) (revision 31c4b1fc46687ed2cf35dd9fa0acec2543ae1886) +++ src/libchcore/TRowData.h (.../TRowData.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -39,6 +39,8 @@ TRowData(const TString& strColName, unsigned short uiValue); TRowData(const TString& strColName, int iValue); TRowData(const TString& strColName, unsigned int uiValue); + TRowData(const TString& strColName, long lValue); + TRowData(const TString& strColName, unsigned long ulValue); TRowData(const TString& strColName, long long llValue); TRowData(const TString& strColName, unsigned long long llValue); TRowData(const TString& strColName, double dValue); Index: src/libchcore/TSQLiteSerializerRowReader.cpp =================================================================== diff -u -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -100,6 +100,22 @@ m_spStatement->GetValue(GetColumnIndex(strColName), uiValue); } +void TSQLiteSerializerRowReader::GetValue(const TString& strColName, long& lValue) +{ + if(!m_bInitialized) + THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + + m_spStatement->GetValue(GetColumnIndex(strColName), lValue); +} + +void TSQLiteSerializerRowReader::GetValue(const TString& strColName, unsigned long& ulValue) +{ + if(!m_bInitialized) + THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + + m_spStatement->GetValue(GetColumnIndex(strColName), ulValue); +} + void TSQLiteSerializerRowReader::GetValue(const TString& strColName, long long& llValue) { if(!m_bInitialized) Index: src/libchcore/TSQLiteSerializerRowReader.h =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSQLiteSerializerRowReader.h (.../TSQLiteSerializerRowReader.h) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/libchcore/TSQLiteSerializerRowReader.h (.../TSQLiteSerializerRowReader.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -41,6 +41,8 @@ virtual void GetValue(const TString& strColName, unsigned short& uiValue); virtual void GetValue(const TString& strColName, int& iValue); virtual void GetValue(const TString& strColName, unsigned int& uiValue); + virtual void GetValue(const TString& strColName, long& lValue); + virtual void GetValue(const TString& strColName, unsigned long& ulValue); virtual void GetValue(const TString& strColName, long long& llValue); virtual void GetValue(const TString& strColName, unsigned long long& ullValue); virtual void GetValue(const TString& strColName, double& dValue); Index: src/libchcore/TSQLiteStatement.cpp =================================================================== diff -u -r1875711000138ff9d4185c2e3e74d455533de8a8 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSQLiteStatement.cpp (.../TSQLiteStatement.cpp) (revision 1875711000138ff9d4185c2e3e74d455533de8a8) +++ src/libchcore/TSQLiteStatement.cpp (.../TSQLiteStatement.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -299,6 +299,16 @@ uiValue = GetUInt(iCol); } + void TSQLiteStatement::GetValue(int iCol, long& lValue) + { + lValue = GetLong(iCol); + } + + void TSQLiteStatement::GetValue(int iCol, unsigned long& ulValue) + { + ulValue = GetULong(iCol); + } + void TSQLiteStatement::GetValue(int iCol, long long& llValue) { llValue = GetInt64(iCol); Index: src/libchcore/TSQLiteStatement.h =================================================================== diff -u -r1875711000138ff9d4185c2e3e74d455533de8a8 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSQLiteStatement.h (.../TSQLiteStatement.h) (revision 1875711000138ff9d4185c2e3e74d455533de8a8) +++ src/libchcore/TSQLiteStatement.h (.../TSQLiteStatement.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -85,6 +85,8 @@ void GetValue(int iCol, unsigned short& uiValue); void GetValue(int iCol, int& iValue); void GetValue(int iCol, unsigned int& uiValue); + void GetValue(int iCol, long& lValue); + void GetValue(int iCol, unsigned long& ulValue); void GetValue(int iCol, long long& llValue); void GetValue(int iCol, unsigned long long& ullValue); void GetValue(int iCol, double& dValue); Index: src/libchcore/TSQLiteTaskSchema.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSQLiteTaskSchema.cpp (.../TSQLiteTaskSchema.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TSQLiteTaskSchema.cpp (.../TSQLiteTaskSchema.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -49,6 +49,9 @@ tStatement.Prepare(_T("CREATE TABLE base_paths(id BIGINT UNIQUE, src_path varchar(32768) NOT NULL, skip_processing boolean NOT NULL, dst_path varchar(32768) NOT NULL)")); tStatement.Step(); + tStatement.Prepare(_T("CREATE TABLE scanned_files(id BIGINT UNIQUE, rel_path varchar(32768) NOT NULL, base_path_id BIGINT NOT NULL, attr INT NOT NULL, size BIGINT NOT NULL, time_created BIGINT NOT NULL, time_last_write BIGINT NOT NULL, time_last_access BIGINT NOT NULL, flags INT NOT NULL)")); + tStatement.Step(); + // and finally set the database version to current one tVersion.SetVersion(1); } Index: src/libchcore/TSharedModificationTracker.h =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSharedModificationTracker.h (.../TSharedModificationTracker.h) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TSharedModificationTracker.h (.../TSharedModificationTracker.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -31,19 +31,22 @@ m_tValue(), m_rBitset(rBitset) { + m_rBitset[ChangeBit] = true; } TSharedModificationTracker(const TSharedModificationTracker& rSrc) : m_tValue(rSrc.m_tValue), m_rBitset(rSrc.m_rBitset) { + m_rBitset[ChangeBit] = true; } template TSharedModificationTracker(Bitset& rBitset, const V& rValue) : m_tValue(rValue), m_rBitset(rBitset) { + m_rBitset[ChangeBit] = true; } TSharedModificationTracker& operator=(const TSharedModificationTracker& rValue) @@ -57,8 +60,7 @@ return *this; } - template - TSharedModificationTracker& operator=(const V& rValue) + TSharedModificationTracker& operator=(const T& rValue) { if(m_tValue != rValue) { @@ -69,6 +71,15 @@ return *this; } + template + TSharedModificationTracker& operator=(const V& rValue) + { + m_tValue = rValue; + m_rBitset[ChangeBit] = true; + + return *this; + } + operator const T&() const { return m_tValue; Index: src/libchcore/TSubTaskContext.h =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TSubTaskContext.h (.../TSubTaskContext.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -37,7 +37,6 @@ BEGIN_CHCORE_NAMESPACE class TWorkerThreadController; -class TModPathContainer; class TTaskConfigTracker; class TLocalFilesystem; class TTaskLocalStatsInfo; Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -254,7 +254,7 @@ m_tSubTaskStats.IncreaseProcessedSize(spFileInfo->GetLength64()); m_tSubTaskStats.IncreaseCurrentItemProcessedSize(spFileInfo->GetLength64()); - spFileInfo->SetFlags(FIF_PROCESSED, FIF_PROCESSED); + spFileInfo->MarkAsProcessed(true); } else { @@ -267,10 +267,10 @@ if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; - spFileInfo->SetFlags(ccp.bProcessed ? FIF_PROCESSED : 0, FIF_PROCESSED); + spFileInfo->MarkAsProcessed(ccp.bProcessed); // if moving - delete file (only if config flag is set) - if(bMove && spFileInfo->GetFlags() & FIF_PROCESSED && !GetTaskPropValue(rConfig)) + if(bMove && spFileInfo->IsProcessed() && !GetTaskPropValue(rConfig)) { if(!GetTaskPropValue(rConfig)) TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); Index: src/libchcore/TSubTaskDelete.cpp =================================================================== diff -u -r458af7bf8c35950fdeb4b906950437596324aea1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 458af7bf8c35950fdeb4b906950437596324aea1) +++ src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -154,7 +154,7 @@ } // current processed element - if(!(spFileInfo->GetFlags() & FIF_PROCESSED)) + if(!spFileInfo->IsProcessed()) { ++stIndex; continue; Index: src/libchcore/TTask.cpp =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -136,6 +136,9 @@ spContainer = m_spSerializer->GetContainer(_T("base_paths")); m_spSrcPaths->Load(spContainer); + + spContainer = m_spSerializer->GetContainer(_T("scanned_files")); + m_files.Load(spContainer, m_spSrcPaths); } } @@ -152,6 +155,9 @@ // base paths spContainer = m_spSerializer->GetContainer(_T("base_paths")); m_spSrcPaths->Store(spContainer); + + spContainer = m_spSerializer->GetContainer(_T("scanned_files")); + m_files.Store(spContainer); } m_spSerializer->Flush(); Index: src/libchcore/TTask.h =================================================================== diff -u -ra7834ba278464cb62739f22d35f9bc16269706a1 -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/TTask.h (.../TTask.h) (revision a7834ba278464cb62739f22d35f9bc16269706a1) +++ src/libchcore/TTask.h (.../TTask.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -34,7 +34,6 @@ #include "TSubTaskContext.h" #include "TTaskStatsSnapshot.h" #include "ISerializer.h" -#include "TModPathContainer.h" #include "TTaskBaseData.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/libchcore.vc90.vcproj =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 --- src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) @@ -1100,6 +1100,14 @@ > + + + +