コード例 #1
0
        internal static GifApplicationExtension ReadApplication(Stream stream)
        {
            var ext = new GifApplicationExtension();

            ext.Read(stream);
            return(ext);
        }
コード例 #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

            int 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);
            }
        }
コード例 #3
0
 public static ushort GetRepeatCount(GifApplicationExtension ext)
 {
     if (ext.Data.Length >= 3)
     {
         return(BitConverter.ToUInt16(ext.Data, 1));
     }
     return(1);
 }
コード例 #4
0
 public static bool IsNetscapeExtension(GifApplicationExtension ext)
 {
     return(ext.ApplicationIdentifier == "NETSCAPE" &&
            Encoding.ASCII.GetString(ext.AuthenticationCode) == "2.0");
 }