Пример #1
0
        /// <inheritdoc/>
        public async Task <IImage> SaveAsync(Stream stream, IImageFormat format = null)
        {
            Guard.NotNull(stream, nameof(stream));

            if (stream.CanSeek)
            {
                stream.SetLength(0);
            }

            await InStream.CopyToAsync(stream);

            if (stream.CanSeek)
            {
                stream.Position = 0;
            }

            if (InStream.CanSeek)
            {
                InStream.Position = 0;
            }

            return(this);
        }