internal static GifBlock ReadBlock(Stream stream, IEnumerable <GifExtension> controlExtensions, bool metadataOnly) { int blockId = stream.ReadByte(); if (blockId < 0) { throw GifHelpers.UnexpectedEndOfStreamException(); } switch (blockId) { case GifExtension.ExtensionIntroducer: return(GifExtension.ReadExtension(stream, controlExtensions, metadataOnly)); case GifFrame.ImageSeparator: return(GifFrame.ReadFrame(stream, controlExtensions, metadataOnly)); case GifTrailer.TrailerByte: return(GifTrailer.ReadTrailer()); default: throw GifHelpers.UnknownBlockTypeException(blockId); } }
internal static GifBlock ReadBlock(Stream stream, IEnumerable <GifExtension> controlExtensions, bool metadataOnly) { int blockId = stream.ReadByte(); if (blockId < 0) { throw GifHelpers.UnexpectedEndOfStreamException(); } int num2 = blockId; if (num2 == 0x21) { return(GifExtension.ReadExtension(stream, controlExtensions, metadataOnly)); } if (num2 == 0x2c) { return(GifFrame.ReadFrame(stream, controlExtensions, metadataOnly)); } if (num2 != 0x3b) { throw GifHelpers.UnknownBlockTypeException(blockId); } return(GifTrailer.ReadTrailer()); }