コード例 #1
0
        internal static async Task <GifCommentExtension> ReadAsync(Stream stream)
        {
            var comment = new GifCommentExtension();
            await comment.ReadInternalAsync(stream).ConfigureAwait(false);

            return(comment);
        }
コード例 #2
0
ファイル: GifExtension.cs プロジェクト: Makzz90/VKClient_re
        internal static async Task <GifExtension> ReadAsync(Stream stream, IEnumerable <GifExtension> controlExtensions)
        {
            int label = stream.ReadByte();

            if (label < 0)
            {
                throw GifHelpers.UnexpectedEndOfStreamException();
            }
            switch (label)
            {
            case 254:
                return((GifExtension)await GifCommentExtension.ReadAsync(stream).ConfigureAwait(false));

            case (int)byte.MaxValue:
                return((GifExtension)await GifApplicationExtension.ReadAsync(stream).ConfigureAwait(false));

            case 1:
                return((GifExtension)await GifPlainTextExtension.ReadAsync(stream, controlExtensions).ConfigureAwait(false));

            case 249:
                return((GifExtension)await GifGraphicControlExtension.ReadAsync(stream).ConfigureAwait(false));

            default:
                throw GifHelpers.UnknownExtensionTypeException(label);
            }
        }
コード例 #3
0
        internal new static async Task <GifExtension> ReadAsync(Stream stream, IEnumerable <GifExtension> controlExtensions)
        {
            // Note: at this point, the Extension Introducer (0x21) has already been read

            int label = stream.ReadByte();

            if (label < 0)
            {
                throw new EndOfStreamException();
            }
            switch (label)
            {
            case GifGraphicControlExtension.ExtensionLabel:
                return(await GifGraphicControlExtension.ReadAsync(stream).ConfigureAwait(false));

            case GifCommentExtension.ExtensionLabel:
                return(await GifCommentExtension.ReadAsync(stream).ConfigureAwait(false));

            case GifPlainTextExtension.ExtensionLabel:
                return(await GifPlainTextExtension.ReadAsync(stream, controlExtensions).ConfigureAwait(false));

            case GifApplicationExtension.ExtensionLabel:
                return(await GifApplicationExtension.ReadAsync(stream).ConfigureAwait(false));

            default:
                throw GifHelpers.UnknownExtensionTypeException(label);
            }
        }
コード例 #4
0
 internal static async Task<GifCommentExtension> ReadAsync(Stream stream)
 {
     var comment = new GifCommentExtension();
     await comment.ReadInternalAsync(stream).ConfigureAwait(false);
     return comment;
 }