private void Read(Stream stream)
 {
     byte[] bytes = GifHelpers.ReadDataBlocks(stream, false);
     if (bytes == null)
     {
         return;
     }
     this.Text = Encoding.ASCII.GetString(bytes);
 }
Example #2
0
 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,
     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();
 }
 private void Read(Stream stream, bool metadataOnly)
 {
     this.LzwMinimumCodeSize = (byte)stream.ReadByte();
     this.CompressedData     = GifHelpers.ReadDataBlocks(stream, metadataOnly);
 }