public void Remove(StorageFileId storageFileId) { var blob = _blobContainer.Value; var blobRef = GetBlobRef(storageFileId, blob); if (!blobRef.Exists()) { return; } blobRef.Delete(); }
public StorageData Get(StorageFileId storageFileId) { using var memorySteam = new MemoryStream(); var blob = _blobContainer.Value; var blobRef = GetBlobRef(storageFileId, blob); if (!blobRef.Exists()) { throw new InvalidOperationException($"Tried to open non existent blob '{GetBlobName(storageFileId)}'"); } blobRef.DownloadToStream(memorySteam); var asDataArray = memorySteam.ToArray(); return(new StorageData(storageFileId, asDataArray)); }
private static string GetBlobName(StorageFileId storageFileId) { return($"{storageFileId.Group}_{storageFileId.Id}.{storageFileId.Extension}"); }
private static CloudBlockBlob GetBlobRef(StorageFileId storageFileId, CloudBlobContainer blob) { return(blob.GetBlockBlobReference(GetBlobName(storageFileId))); }