Exemplo n.º 1
0
        internal static GifGraphicControlExtension ReadGraphicsControl(Stream stream)
        {
            var ext = new GifGraphicControlExtension();

            ext.Read(stream);
            return(ext);
        }
Exemplo n.º 2
0
        internal static GifExtension ReadExtension(Stream stream, IEnumerable <GifExtension> controlExtensions,
                                                   bool metadataOnly)
        {
            // Note: at this point, the Extension Introducer (0x21) has already been read
            var label = stream.ReadByte();

            if (label < 0)
            {
                throw GifHelpers.UnexpectedEndOfStreamException();
            }
            switch (label)
            {
            case GifGraphicControlExtension.ExtensionLabel:
                return(GifGraphicControlExtension.ReadGraphicsControl(stream));

            case GifCommentExtension.ExtensionLabel:
                return(GifCommentExtension.ReadComment(stream));

            case GifPlainTextExtension.ExtensionLabel:
                return(GifPlainTextExtension.ReadPlainText(stream, controlExtensions, metadataOnly));

            case GifApplicationExtension.ExtensionLabel:
                return(GifApplicationExtension.ReadApplication(stream));

            default:
                throw GifHelpers.UnknownExtensionTypeException(label);
            }
        }