ScreenToGif/ImageUtil/Decoder/GifBlock.cs

(完整代码) 1016B

using System.Collections.Generic;
using System.IO;

namespace ScreenToGif.ImageUtil.Decoder
{
    public abstract class GifBlock
    {
        public 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);
            }
        }

        public abstract GifBlockKind Kind { get; }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。