@@ -28,8 +28,7 @@ private static void RunSync()
2828 while ( true )
2929 {
3030 CheckForMissingDirs ( ) ;
31- CheckForMoodifiedFiles ( ) ;
32- CheckForMovedFiles ( ) ;
31+ CheckForModifiedFiles ( ) ;
3332 CheckForCopiesInSource ( ) ;
3433 CheckForMissingFiles ( ) ;
3534 CheckForDeletedFiles ( ) ;
@@ -114,14 +113,14 @@ private static void CheckForMissingDirs()
114113 }
115114 }
116115
117- private static void CheckForMoodifiedFiles ( )
116+ private static void CheckForModifiedFiles ( )
118117 {
119118 List < FileProps > sourceFileList = GetAllFilesInDirectory ( sourceRoot ) ;
120119 List < FileProps > backupFileList = GetAllFilesInDirectory ( backupRoot ) ;
121120
122121 foreach ( var sourceFile in sourceFileList )
123122 {
124- var backup = backupFileList . Find ( backup => backup . IsFileModified ( sourceFile . GetRelativeFilePath , sourceFile . GetMD5Code ) ) ;
123+ var backup = backupFileList . Find ( backup => backup . IsFileModified ( sourceFile ) ) ;
125124 if ( backup != null )
126125 {
127126 EditFile ( sourceFile , backup ) ;
@@ -136,28 +135,6 @@ private static void EditFile(FileProps sourceFile, FileProps backupFile)
136135 File . Copy ( sourceFile . GetAbsoluteFilePath , fullBackupPath ) ;
137136 Log ( sourceFile . GetFileName , backupFile . GetAbsolutePath , Actions . edited ) ;
138137 }
139- // check for move is still not working properly
140- private static void CheckForMovedFiles ( )
141- {
142- List < FileProps > sourceFileList = GetAllFilesInDirectory ( sourceRoot ) ;
143- List < FileProps > backupFileList = GetAllFilesInDirectory ( backupRoot ) ;
144-
145- foreach ( var sourceFile in sourceFileList )
146- {
147- var backup = backupFileList . Find ( backup => backup . IsFileMoved ( sourceFile . GetRelativeFilePath , sourceFile . GetMD5Code ) ) ;
148- if ( backup != null && ! File . Exists ( backup . GetAbsoluteFilePath ) )
149- {
150- MoveFile ( sourceFile , backup ) ;
151- }
152- }
153- }
154-
155- private static void MoveFile ( FileProps sourceFile , FileProps backupFile )
156- {
157- string newFile = Path . Combine ( backupRoot , sourceFile . GetRelativeFilePath ) ;
158- File . Move ( backupFile . GetAbsoluteFilePath , newFile ) ;
159- Log ( sourceFile . GetFileName , newFile , Actions . moved ) ;
160- }
161138
162139 private static void CheckForCopiesInSource ( )
163140 {
@@ -166,12 +143,12 @@ private static void CheckForCopiesInSource()
166143
167144 foreach ( var sourceFile in sourceFileList )
168145 {
169- var matches = sourceFileList . Where ( source => source . IsFileCopied ( sourceFile . GetFileName , sourceFile . GetMD5Code , sourceFile . GetRelativePath ) ) . ToList ( ) ;
146+ var matches = sourceFileList . Where ( source => source . IsFileCopied ( sourceFile ) ) . ToList ( ) ;
170147 if ( matches . Count > 0 )
171148 {
172149 foreach ( var match in matches )
173150 {
174- var backup = backupFileList . Find ( backup => backup . IsFileTheSame ( match . GetRelativeFilePath , match . GetMD5Code ) ) ;
151+ var backup = backupFileList . Find ( backup => backup . IsFileTheSame ( match ) ) ;
175152 if ( backup == null )
176153 {
177154 CopyFile ( match ) ;
@@ -195,7 +172,7 @@ private static void CheckForMissingFiles()
195172
196173 foreach ( var sourceFile in sourceFileList )
197174 {
198- var backup = backupFileList . Find ( backup => backup . IsFileTheSame ( sourceFile . GetRelativeFilePath , sourceFile . GetMD5Code ) ) ;
175+ var backup = backupFileList . Find ( backup => backup . IsFileTheSame ( sourceFile ) ) ;
199176 if ( backup == null )
200177 {
201178 CreateFile ( sourceFile ) ;
@@ -217,7 +194,7 @@ private static void CheckForDeletedFiles()
217194
218195 foreach ( var backupFile in backupFileList )
219196 {
220- var source = sourceFileList . Find ( source => source . IsFileTheSame ( backupFile . GetRelativeFilePath , backupFile . GetMD5Code ) ) ;
197+ var source = sourceFileList . Find ( source => source . IsFileTheSame ( backupFile ) ) ;
221198 if ( source == null )
222199 {
223200 DeleteFile ( backupFile ) ;
@@ -284,7 +261,7 @@ private static void Log(string filename, string fullDestinationName, Actions act
284261 default :
285262 break ;
286263 }
287- string logTemplate = $ "{ dt } - { filename } was { action } { grammar } { fullDestinationName } ";
264+ string logTemplate = $ "{ dt } - { filename } was { action } { grammar } { Path . GetDirectoryName ( fullDestinationName ) } ";
288265 Console . WriteLine ( logTemplate ) ;
289266
290267 if ( ! Directory . Exists ( Path . GetDirectoryName ( logFilePath ) ) )
0 commit comments