示例#1
0
        internal static async Task <GifHeader> ReadAsync(Stream stream)
        {
            var header = new GifHeader();
            await header.ReadInternalAsync(stream).ConfigureAwait(false);

            return(header);
        }
示例#2
0
        private async Task ReadInternalAsync(Stream stream)
        {
            this.Header = await GifHeader.ReadAsync(stream).ConfigureAwait(false);

            if (this.Header.LogicalScreenDescriptor.HasGlobalColorTable)
            {
                this.GlobalColorTable = await GifHelpers.ReadColorTableAsync(stream, this.Header.LogicalScreenDescriptor.GlobalColorTableSize).ConfigureAwait(false);
            }
            await this.ReadFramesAsync(stream).ConfigureAwait(false);

            GifApplicationExtension ext = this.Extensions.OfType <GifApplicationExtension>().FirstOrDefault <GifApplicationExtension>(new Func <GifApplicationExtension, bool>(GifHelpers.IsNetscapeExtension));

            this.RepeatCount = ext != null?GifHelpers.GetRepeatCount(ext) : (ushort)1;
        }
示例#3
0
        private async Task ReadInternalAsync(Stream stream)
        {
            Header = await GifHeader.ReadAsync(stream).ConfigureAwait(false);

            if (Header.LogicalScreenDescriptor.HasGlobalColorTable)
            {
                GlobalColorTable = await GifHelpers.ReadColorTableAsync(stream, Header.LogicalScreenDescriptor.GlobalColorTableSize).ConfigureAwait(false);
            }
            await ReadFramesAsync(stream).ConfigureAwait(false);

            var netscapeExtension =
                Extensions
                .OfType <GifApplicationExtension>()
                .FirstOrDefault(GifHelpers.IsNetscapeExtension);

            RepeatCount = netscapeExtension != null
                ? GifHelpers.GetRepeatCount(netscapeExtension)
                : (ushort)1;
        }
示例#4
0
 internal static async Task<GifHeader> ReadAsync(Stream stream)
 {
     var header = new GifHeader();
     await header.ReadInternalAsync(stream).ConfigureAwait(false);
     return header;
 }