internal static async Task <GifCommentExtension> ReadAsync(Stream stream) { var comment = new GifCommentExtension(); await comment.ReadInternalAsync(stream).ConfigureAwait(false); return(comment); }
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 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); } }
internal static async Task<GifCommentExtension> ReadAsync(Stream stream) { var comment = new GifCommentExtension(); await comment.ReadInternalAsync(stream).ConfigureAwait(false); return comment; }