public async Task UploadMismatchedFile(FileInfo fileInfo) { if (fileInfo is null) { throw new ArgumentNullException(nameof(fileInfo)); } _log.PutOut($"File {fileInfo.Name} does not match object."); await _inner.UploadMismatchedFile(fileInfo).ConfigureAwait(false); }
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); }