コード例 #1
0
ファイル: JpegDecoder.cs プロジェクト: liuhuixin/ImageSharp
        /// <inheritdoc/>
        public Task <IImageInfo> IdentifyAsync(Configuration configuration, Stream stream)
        {
            Guard.NotNull(stream, nameof(stream));

            using var decoder        = new JpegDecoderCore(configuration, this);
            using var bufferedStream = new BufferedReadStream(configuration, stream);

            return(decoder.IdentifyAsync(bufferedStream));
        }
コード例 #2
0
ファイル: JpegDecoder.cs プロジェクト: wilka/ImageSharp
        /// <inheritdoc/>
        public async Task <IImageInfo> IdentifyAsync(Configuration configuration, Stream stream)
        {
            Guard.NotNull(stream, nameof(stream));

            using (var decoder = new JpegDecoderCore(configuration, this))
            {
                return(await decoder.IdentifyAsync(stream).ConfigureAwait(false));
            }
        }
コード例 #3
0
ファイル: JpegDecoder.cs プロジェクト: br3aker/ImageSharp
        /// <inheritdoc/>
        public async Task <IImageInfo> IdentifyAsync(Configuration configuration, Stream stream, CancellationToken cancellationToken)
        {
            Guard.NotNull(stream, nameof(stream));

            // The introduction of a local variable that refers to an object the implements
            // IDisposable means you must use async/await, where the compiler generates the
            // state machine and a continuation.
            using (var decoder = new JpegDecoderCore(configuration, this))
            {
                return(await decoder.IdentifyAsync(configuration, stream, cancellationToken)
                       .ConfigureAwait(false));
            }
        }