Beispiel #1
0
        internal static async Task <GifGraphicControlExtension> ReadAsync(Stream stream)
        {
            GifGraphicControlExtension ext = new GifGraphicControlExtension();
            await ext.ReadInternalAsync(stream).ConfigureAwait(false);

            return(ext);
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        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);
            }
        }
 internal static async Task<GifGraphicControlExtension> ReadAsync(Stream stream)
 {
     var ext = new GifGraphicControlExtension();
     await ext.ReadInternalAsync(stream).ConfigureAwait(false);
     return ext;
 }