public Dictionary <string, FileInfo> GetFilesDictionary() { _log.PutOut($"Try to receive files dictionary."); var files = _inner.GetFilesDictionary(); _log.PutOut($"FileInfo dictionary received."); return(files); }
public async Task Synchronize() { await _synchronizationFunctions.Purge().ConfigureAwait(false); var filesInfo = _synchronizationFunctions.GetFilesDictionary(); foreach (var s3Object in await _synchronizationFunctions.GetObjectsList().ConfigureAwait(false)) { if (filesInfo.TryGetValue(s3Object.Key, out var fileInfo)) { filesInfo.Remove(s3Object.Key); if (!_synchronizationFunctions.FileEqualsObject(fileInfo, s3Object)) { await _synchronizationFunctions.UploadMismatchedFile(fileInfo).ConfigureAwait(false); } } else { await _synchronizationFunctions.DeleteExcessObject(s3Object).ConfigureAwait(false); } } await _synchronizationFunctions.UploadMissingFiles(filesInfo.Values).ConfigureAwait(false); }