private void GetItemsCache(
            ICloudBlobContainer container,
            Dictionary <ThumbnailDefinition, ThumbnailSetItemData> data,
            IEnumerable <ThumbnailDefinition> items)
        {
            if (items == null)
            {
                return;
            }

            foreach (var item in items)
            {
                var blockBlob = container.GetBlockBlobReference(item.OutputBlobName);
                data.Add(item, new ThumbnailSetItemData(blockBlob));
                this.GetItemsCache(container, data, item.Children);
            }
        }
        public async Task <bool> TrySaveItemAsync(T item)
        {
            ICloudBlockBlob blockBlob = _container.GetBlockBlobReference(GetName(item));
            await blockBlob.UploadFromByteArrayAsync(_getBytes(item), 0, _getBytes(item).Length);

            foreach (var metaItem in GetMetaData(item).Where(pair => !string.IsNullOrWhiteSpace(pair.Value.Value)))
            {
                blockBlob.Metadata[$"meta_{metaItem.Key}"] = metaItem.Value.Value;
            }
            try
            {
                await blockBlob.SetMetadataAsync();
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }
Example #3
0
        private static ICloudBlockBlob GetCloudBlockBlob(ICloudBlobContainer cloudBlobContainer, Guid uuid)
        {
            var fileName = $"{uuid}.csv";

            return(cloudBlobContainer.GetBlockBlobReference(fileName));
        }