【发布时间】:2021-01-15 10:46:24
【问题描述】:
我正在尝试从 Azure Blob 存储下载一些图像,我需要在其中添加一些条件。到目前为止,我一直在处理文件名,将它们与名称上的数据一起上传,以便以后可以将其用作条件,但我想知道其他方法。
到目前为止,我试图从日期间隔获取图像:
public async void DownloadBlobAsync(string blobName, string savePath, System.DateTime fromThisDate, System.DateTime toThisDate)
{
var blobs = ListBlobsAsync(); //List all blobs in the current container
var wantedBlobs = new List<string>(); //After conditionals work, I'll fill up this list with the blob names I want to download
foreach (var blob in blobs.Result)
{
//All stuff about convertion from string do DateTime
}
foreach (var blob in wantedBlobs)
{
var blobClient = blobContainerClient.GetBlobClient(blob);
var downloadedBlob = await blobClient.DownloadAsync();
System.Drawing.Image.FromStream(downloadedBlob.Value.Content).Save(savePath);
}
}
【问题讨论】: