public static GifApplicationExtension ReadApplication(Stream stream) { var ext = new GifApplicationExtension(); ext.Read(stream); return(ext); }
public 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); } }
public static ushort GetRepeatCount(GifApplicationExtension ext) { if (ext.Data.Length >= 3) { return(BitConverter.ToUInt16(ext.Data, 1)); } return(1); }
public static bool IsNetscapeExtension(GifApplicationExtension ext) { return(ext.ApplicationIdentifier == "NETSCAPE" && Encoding.ASCII.GetString(ext.AuthenticationCode) == "2.0"); }