private void Read(Stream stream) { byte[] numArray1 = new byte[12]; stream.ReadAll(numArray1, 0, numArray1.Length); this.BlockSize = (int)numArray1[0]; if (this.BlockSize != 11) { throw GifHelpers.InvalidBlockSizeException("Application Extension", 11, this.BlockSize); } this.ApplicationIdentifier = Encoding.ASCII.GetString(numArray1, 1, 8); byte[] numArray2 = new byte[3]; Array.Copy((Array)numArray1, 9, (Array)numArray2, 0, 3); this.AuthenticationCode = numArray2; this.Data = GifHelpers.ReadDataBlocks(stream, false); }
private void Read(Stream stream) { byte[] buffer = new byte[6]; stream.ReadAll(buffer, 0, buffer.Length); this.BlockSize = (int)buffer[0]; if (this.BlockSize != 4) { throw GifHelpers.InvalidBlockSizeException("Graphic Control Extension", 4, this.BlockSize); } byte num = buffer[1]; this.DisposalMethod = ((int)num & 28) >> 2; this.UserInput = ((uint)num & 2U) > 0U; this.HasTransparency = ((uint)num & 1U) > 0U; this.Delay = (int)BitConverter.ToUInt16(buffer, 2) * 10; this.TransparencyIndex = (int)buffer[4]; }
private void Read( Stream stream, IEnumerable <GifExtension> controlExtensions, bool metadataOnly) { byte[] buffer = new byte[13]; stream.ReadAll(buffer, 0, buffer.Length); this.BlockSize = (int)buffer[0]; if (this.BlockSize != 12) { throw GifHelpers.InvalidBlockSizeException("Plain Text Extension", 12, this.BlockSize); } this.Left = (int)BitConverter.ToUInt16(buffer, 1); this.Top = (int)BitConverter.ToUInt16(buffer, 3); this.Width = (int)BitConverter.ToUInt16(buffer, 5); this.Height = (int)BitConverter.ToUInt16(buffer, 7); this.CellWidth = (int)buffer[9]; this.CellHeight = (int)buffer[10]; this.ForegroundColorIndex = (int)buffer[11]; this.BackgroundColorIndex = (int)buffer[12]; this.Text = Encoding.ASCII.GetString(GifHelpers.ReadDataBlocks(stream, metadataOnly)); this.Extensions = (IList <GifExtension>)controlExtensions.ToList <GifExtension>().AsReadOnly(); }