diff options
Diffstat (limited to 'FreeFileSync.h')
-rw-r--r-- | FreeFileSync.h | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/FreeFileSync.h b/FreeFileSync.h index c0e4c367..3132a214 100644 --- a/FreeFileSync.h +++ b/FreeFileSync.h @@ -5,8 +5,6 @@ #include <set> #include <vector> #include <wx/dir.h> -#include <windows.h> -#include "library/gmp/include/gmpxx.h" #include <wx/log.h> #include "library/multithreading.h" @@ -33,7 +31,7 @@ struct FileInfo { wxULongLong fileSize; wxString lastWriteTime; - wxULongLong lastWriteTimeUTC; + wxULongLong lastWriteTimeRaw; }; enum ObjectType @@ -51,7 +49,7 @@ struct FileDescrLine wxString directory; //directory to be synced wxString relFilename; //filename without directory that is being synchronized wxString lastWriteTime; - wxULongLong lastWriteTimeUTC; + wxULongLong lastWriteTimeRaw; wxULongLong fileSize; ObjectType objType; //is it a file or directory or initial? @@ -118,7 +116,7 @@ typedef vector<FileCompareLine> FileCompareResult; enum CompareVariant { - compareByMD5, + compareByContent, compareByTimeAndSize }; @@ -163,7 +161,7 @@ void removeRowsFromVector(vector<T>& grid, const set<int>& rowsToRemove) temp.push_back(grid[i]); else { - rowToSkipIndex++; + ++rowToSkipIndex; if (rowToSkipIndex != rowsToRemove.end()) rowToSkip = *rowToSkipIndex; } @@ -171,13 +169,13 @@ void removeRowsFromVector(vector<T>& grid, const set<int>& rowsToRemove) grid.swap(temp); } +class RecycleBin; -typedef WINSHELLAPI int (*DLLFUNC)(LPSHFILEOPSTRUCT lpFileOp); class FreeFileSync { public: - FreeFileSync(); + FreeFileSync(bool useRecycleBin); ~FreeFileSync(); friend class MainDialog; @@ -185,9 +183,9 @@ public: friend class CopyThread; //identifiers of different processed - static const int scanningFilesProcess = 1; - static const int calcMD5Process = 2; - static const int synchronizeFilesProcess = 3; + static const int scanningFilesProcess = 1; + static const int compareFileContentProcess = 2; + static const int synchronizeFilesProcess = 3; //main function for compare static void startCompareProcess(FileCompareResult& output, const wxString& dirLeft, const wxString& dirRight, CompareVariant cmpVar, StatusUpdater* statusUpdater); @@ -195,8 +193,7 @@ public: //main function for synchronization static void startSynchronizationProcess(FileCompareResult& grid, const SyncConfiguration& config, StatusUpdater* statusUpdater, bool useRecycleBin); - static bool recycleBinExists(); //test existence of Recycle Bin API - bool setRecycleBinUsage(bool activate); //enables/disables Recycle Bin usage (but only if usage is possible at all): RV: Setting was successful or not + static bool recycleBinExists(); //test existence of Recycle Bin API on current system static void deleteOnGridAndHD(FileCompareResult& grid, const set<int>& rowsToDelete, StatusUpdater* statusUpdater, bool useRecycleBin); static void addSubElements(set<int>& subElements, const FileCompareResult& grid, const FileCompareLine& relevantRow); @@ -204,46 +201,36 @@ public: static void filterCurrentGridData(FileCompareResult& currentGridData, const wxString& includeFilter, const wxString& excludeFilter); static void removeFilterOnCurrentGridData(FileCompareResult& currentGridData); - static wxString formatFilesizeToShortString(const mpz_class& filesize); + static wxString formatFilesizeToShortString(const wxULongLong& filesize); + static wxString formatFilesizeToShortString(const double filesize); static wxString getFormattedDirectoryName(const wxString& dirname); static void calcTotalBytesToSync(int& objectsTotal, double& dataTotal, const FileCompareResult& fileCmpResult, const SyncConfiguration& config); static void swapGrids(FileCompareResult& grid); - static void wxULongLongToMpz(mpz_t& output, const wxULongLong& input); - - static string calculateMD5Hash(const wxString& filename); - static string calculateMD5HashMultithreaded(const wxString& filename, StatusUpdater* updateClass); - static bool isFFS_ConfigFile(const wxString& filename); static const wxString FFS_ConfigFileID; static const wxString FFS_LastConfigFile; private: - bool synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing was to be done - bool synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing was to be done + bool synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing had to be done + bool synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing had to be done //file copy functionality -> keep instance-bound to to be able to prevent wxWidgets-logging void removeDirectory(const wxString& directory); void removeFile(const wxString& filename); - void copyOverwriting(const wxString& source, const wxString& target); - void copyfile(const wxString& source, const wxString& target); - void copyCreatingDirs(const wxString& source, const wxString& target); + void copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass); void createDirectory(const wxString& directory, int level = 0); //level is used internally only - //some special file functions - void moveToRecycleBin(const wxString& filename); - static void copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass); + //some special file functions static void generateFileAndFolderDescriptions(DirectoryDescrType& output, const wxString& directory, StatusUpdater* updateClass = 0); - static void getFileInformation(FileInfo& output, const wxString& filename); - bool recycleBinAvailable; + bool recycleBinShouldBeUsed; + static RecycleBin recycler; wxLogNull* noWxLogs; - HINSTANCE hinstShell; - DLLFUNC fileOperation; }; |