Example #1
0
 // Token: 0x06000739 RID: 1849 RVA: 0x00030028 File Offset: 0x0002E228
 internal int Flush(int r)
 {
     for (int i = 0; i < 2; i++)
     {
         int num;
         if (i == 0)
         {
             num = ((this.readAt <= this.writeAt) ? this.writeAt : this.end) - this.readAt;
         }
         else
         {
             num = this.writeAt - this.readAt;
         }
         if (num == 0)
         {
             if (r == -5)
             {
                 r = 0;
             }
             return(r);
         }
         if (num > this._codec.AvailableBytesOut)
         {
             num = this._codec.AvailableBytesOut;
         }
         if (num != 0 && r == -5)
         {
             r = 0;
         }
         this._codec.AvailableBytesOut -= num;
         this._codec.TotalBytesOut     += (long)num;
         if (this.checkfn != null)
         {
             this._codec._Adler32 = (this.check = Class_209.Adler32(this.check, this.window, this.readAt, num));
         }
         Array.Copy(this.window, this.readAt, this._codec.OutputBuffer, this._codec.NextOut, num);
         this._codec.NextOut += num;
         this.readAt         += num;
         if (this.readAt == this.end && i == 0)
         {
             this.readAt = 0;
             if (this.writeAt == this.end)
             {
                 this.writeAt = 0;
             }
         }
         else
         {
             i++;
         }
     }
     return(r);
 }
Example #2
0
        // Token: 0x06000734 RID: 1844 RVA: 0x0002EF34 File Offset: 0x0002D134
        internal uint Reset()
        {
            uint result = this.check;

            this.mode   = Class_193.InflateBlockMode.TYPE;
            this.bitk   = 0;
            this.bitb   = 0;
            this.readAt = (this.writeAt = 0);
            if (this.checkfn != null)
            {
                this._codec._Adler32 = (this.check = Class_209.Adler32(0U, null, 0, 0));
            }
            return(result);
        }
Example #3
0
        // Token: 0x060007BB RID: 1979 RVA: 0x00034BC0 File Offset: 0x00032DC0
        internal int read_buf(byte[] buf, int start, int size)
        {
            int num = this.AvailableBytesIn;

            if (num > size)
            {
                num = size;
            }
            if (num == 0)
            {
                return(0);
            }
            this.AvailableBytesIn -= num;
            if (this.dstate.WantRfc1950HeaderBytes)
            {
                this._Adler32 = Class_209.Adler32(this._Adler32, this.InputBuffer, this.NextIn, num);
            }
            Array.Copy(this.InputBuffer, this.NextIn, buf, start, num);
            this.NextIn       += num;
            this.TotalBytesIn += (long)num;
            return(num);
        }
Example #4
0
        // Token: 0x06000748 RID: 1864 RVA: 0x00031BD8 File Offset: 0x0002FDD8
        internal int SetDictionary(byte[] dictionary)
        {
            int start = 0;
            int num   = dictionary.Length;

            if (this.mode != Class_196.InflateManagerMode.DICT0)
            {
                throw new Class_205("Stream error.");
            }
            if (Class_209.Adler32(1U, dictionary, 0, dictionary.Length) != this._codec._Adler32)
            {
                return(-3);
            }
            this._codec._Adler32 = Class_209.Adler32(0U, null, 0, 0);
            if (num >= 1 << this.wbits)
            {
                num   = (1 << this.wbits) - 1;
                start = dictionary.Length - num;
            }
            this.blocks.SetDictionary(dictionary, start, num);
            this.mode = Class_196.InflateManagerMode.BLOCKS;
            return(0);
        }