ScreenToGif/ImageUtil/Decoder/GifCommentExtension.cs

(完整代码) 917B

using System.IO;
using System.Text;

namespace ScreenToGif.ImageUtil.Decoder
{
    public class GifCommentExtension : GifExtension
    {
        public const int ExtensionLabel = 0xFE;

        public string Text { get; private set; }

        private GifCommentExtension()
        {
        }

        public override GifBlockKind Kind
        {
            get { return GifBlockKind.SpecialPurpose; }
        }

        public static GifCommentExtension ReadComment(Stream stream)
        {
            var comment = new GifCommentExtension();
            comment.Read(stream);
            return comment;
        }

        private void Read(Stream stream)
        {
            // Note: at this point, the label (0xFE) has already been read

            var bytes = GifHelpers.ReadDataBlocks(stream, false);
            if (bytes != null)
                Text = Encoding.ASCII.GetString(bytes);
        }
    }
}

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

AI 解读

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

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