private bool ProcessCode(int code, byte[] buffer, int offset, int count, ref int read)
 {
     if (code < this._codeTable.Count)
     {
         LzwDecompressStream.Sequence sequence = this._codeTable[code];
         if (sequence.IsStopCode)
         {
             return(false);
         }
         if (sequence.IsClearCode)
         {
             this.InitCodeTable();
             return(true);
         }
         this._remainingBytes = LzwDecompressStream.CopySequenceToBuffer(sequence.Bytes, buffer, offset, count, ref read);
         if (this._prevCode >= 0)
         {
             this._codeTable.Add(this._codeTable[this._prevCode].Append(sequence.Bytes[0]));
         }
     }
     else
     {
         LzwDecompressStream.Sequence sequence1 = this._codeTable[this._prevCode];
         LzwDecompressStream.Sequence local     = sequence1;
         //int num = (int)local.Bytes[0];
         LzwDecompressStream.Sequence sequence2 = (local).Append(/*(byte)num*/ local.Bytes[0]);
         this._codeTable.Add(sequence2);
         this._remainingBytes = LzwDecompressStream.CopySequenceToBuffer(sequence2.Bytes, buffer, offset, count, ref read);
     }
     this._prevCode = code;
     return(true);
 }
            public void Add(LzwDecompressStream.Sequence sequence)
            {
                if (this._count >= this._table.Length)
                {
                    return;
                }
                LzwDecompressStream.Sequence[] table = this._table;
                int count = this._count;

                this._count = count + 1;
                int index = count;

                LzwDecompressStream.Sequence sequence1 = sequence;
                table[index] = sequence1;
                if ((this._count & this._count - 1) != 0 || this._codeLength >= 12)
                {
                    return;
                }
                this._codeLength = this._codeLength + 1;
            }
            public CodeTable(int minimumCodeLength)
            {
                this._minimumCodeLength = minimumCodeLength;
                this._codeLength        = this._minimumCodeLength + 1;
                int num = 1 << minimumCodeLength;

                this._table = new LzwDecompressStream.Sequence[4096];
                for (int index1 = 0; index1 < num; ++index1)
                {
                    LzwDecompressStream.Sequence[] table = this._table;
                    int count = this._count;
                    this._count = count + 1;
                    int index2 = count;
                    LzwDecompressStream.Sequence sequence = new LzwDecompressStream.Sequence(new byte[1] {
                        (byte)index1
                    });
                    table[index2] = sequence;
                }
                this.Add(LzwDecompressStream.Sequence.ClearCode);
                this.Add(LzwDecompressStream.Sequence.StopCode);
            }
 private Sequence(bool isClearCode, bool isStopCode)
 {
     this             = new LzwDecompressStream.Sequence();
     this.IsClearCode = isClearCode;
     this.IsStopCode  = isStopCode;
 }
 public Sequence(byte[] bytes)
 {
     this       = new LzwDecompressStream.Sequence();
     this.Bytes = bytes;
 }