示例#1
0
 /// <summary>
 ///
 /// </summary>
 public override void Dispose()
 {
     Close();
     if (mStream != null)
     {
         mStream.DisposeAsync();
         mStream = null;
     }
 }
示例#2
0
        private async Task ComputeOtherSizesAsync(Entry entry, Image image, Stream originalContent, bool canSeek)
        {
            if (!canSeek)
            {
                var memoryStream = new MemoryStream();
                await originalContent.CopyToAsync(memoryStream);

                await originalContent.DisposeAsync();

                originalContent          = memoryStream;
                originalContent.Position = 0;
                canSeek = true;
            }

            using (var thumbnailContent = new MemoryStream())
                using (var originalCopy = new MemoryStream())
                {
                    await originalContent.CopyToAsync(originalCopy);

                    originalCopy.Position = 0;

                    resizeService.Thumbnail(originalCopy, thumbnailContent, ThumbnailWidth, ThumbnailHeight);
                    thumbnailContent.Position = 0;

                    await fileStorage.SaveAsync(entry, image, thumbnailContent, ImageType.Thumbnail);
                }

            if (canSeek)
            {
                originalContent.Position = 0;
            }
            else
            {
                originalContent = await fileStorage.FindAsync(entry, image, ImageType.Original);
            }

            using (var previewContent = new MemoryStream())
                using (var originalCopy = new MemoryStream())
                {
                    await originalContent.CopyToAsync(originalCopy);

                    originalCopy.Position = 0;

                    resizeService.Resize(originalCopy, previewContent, PreviewWidth);
                    previewContent.Position = 0;

                    await fileStorage.SaveAsync(entry, image, previewContent, ImageType.Preview);
                }
        }
示例#3
0
 public override ValueTask DisposeAsync()
 {
     return(_innerStream.DisposeAsync());
 }
示例#4
0
 public override ValueTask DisposeAsync() => _innerStream.DisposeAsync();