public TaskRunner CreateUpdateTaskRunner(CloudBlob blob, FileInformation fileInfo) { this._statistics.UpdatedCount++; return new SingleActionTaskRunner(() => { _messageBus.Publish(new FileProgressedMessage(fileInfo.FullPath, 0)); blob.DownloadToFile(fileInfo.FullPath); _fileSystem.SetLastWriteTimeUtc(fileInfo.FullPath, blob.GetFileLastModifiedUtc()); _messageBus.Publish(new FileProgressedMessage(fileInfo.FullPath, 1)); }); }
public TaskRunner CreateFileNotExistsTaskRunner(CloudBlob blob, string basePath) { this._statistics.FileNotExistCount++; string relativePath = blob.GetRelativeFilePath(); string fullFilePath = this._fileSystem.Combine(basePath, relativePath); if (blob.Properties.Length > CloudBlobConstants.FileSizeThresholdInBytes) { return new DownloadLargeFileTaskRunner(_messageBus, _fileSystem, blob, fullFilePath); } else { return new SingleActionTaskRunner(() => { _messageBus.Publish(new FileProgressedMessage(fullFilePath, 0)); _fileSystem.EnsureFileDirectory(fullFilePath); blob.DownloadToFile(fullFilePath); _fileSystem.SetLastWriteTimeUtc(fullFilePath, blob.GetFileLastModifiedUtc()); _messageBus.Publish(new FileProgressedMessage(fullFilePath, 1)); }); } }