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)); }); } }
public TaskRunner CreateFileNotExistsTaskRunner(CloudBlob blob, string basePath) { this._statistics.FileNotExistCount++; return new SingleActionTaskRunner(() => { string relativePath = blob.GetRelativeFilePath(); string fullFilePath = this._fileSystem.Combine(basePath, relativePath); _messageBus.Publish(new FileProgressedMessage(fullFilePath, 0)); blob.DeleteIfExists(); _messageBus.Publish(new FileProgressedMessage(fullFilePath, 1)); }); }