using System; namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams { // Token: 0x0200003E RID: 62 public class StreamManipulator { // Token: 0x0600026E RID: 622 RVA: 0x0000CB18 File Offset: 0x0000BB18 public int PeekBits(int bitCount) { if (this.bitsInBuffer_ < bitCount) { if (this.windowStart_ == this.windowEnd_) { return -1; } this.buffer_ |= (uint)((uint)((int)(this.window_[this.windowStart_++] & byte.MaxValue) | ((int)(this.window_[this.windowStart_++] & byte.MaxValue) << 8)) << this.bitsInBuffer_); this.bitsInBuffer_ += 16; } return (int)((ulong)this.buffer_ & (ulong)((long)((1 << bitCount) - 1))); } // Token: 0x0600026F RID: 623 RVA: 0x0000CBB5 File Offset: 0x0000BBB5 public void DropBits(int bitCount) { this.buffer_ >>= bitCount; this.bitsInBuffer_ -= bitCount; } // Token: 0x06000270 RID: 624 RVA: 0x0000CBD8 File Offset: 0x0000BBD8 public int GetBits(int bitCount) { int num = this.PeekBits(bitCount); if (num >= 0) { this.DropBits(bitCount); } return num; } // Token: 0x17000089 RID: 137 // (get) Token: 0x06000271 RID: 625 RVA: 0x0000CBF9 File Offset: 0x0000BBF9 public int AvailableBits { get { return this.bitsInBuffer_; } } // Token: 0x1700008A RID: 138 // (get) Token: 0x06000272 RID: 626 RVA: 0x0000CC01 File Offset: 0x0000BC01 public int AvailableBytes { get { return this.windowEnd_ - this.windowStart_ + (this.bitsInBuffer_ >> 3); } } // Token: 0x06000273 RID: 627 RVA: 0x0000CC19 File Offset: 0x0000BC19 public void SkipToByteBoundary() { this.buffer_ >>= this.bitsInBuffer_ & 7; this.bitsInBuffer_ &= -8; } // Token: 0x1700008B RID: 139 // (get) Token: 0x06000274 RID: 628 RVA: 0x0000CC42 File Offset: 0x0000BC42 public bool IsNeedingInput { get { return this.windowStart_ == this.windowEnd_; } } // Token: 0x06000275 RID: 629 RVA: 0x0000CC54 File Offset: 0x0000BC54 public int CopyBytes(byte[] output, int offset, int length) { if (length < 0) { throw new ArgumentOutOfRangeException("length"); } if ((this.bitsInBuffer_ & 7) != 0) { throw new InvalidOperationException("Bit buffer is not byte aligned!"); } int num = 0; while (this.bitsInBuffer_ > 0 && length > 0) { output[offset++] = (byte)this.buffer_; this.buffer_ >>= 8; this.bitsInBuffer_ -= 8; length--; num++; } if (length == 0) { return num; } int num2 = this.windowEnd_ - this.windowStart_; if (length > num2) { length = num2; } Array.Copy(this.window_, this.windowStart_, output, offset, length); this.windowStart_ += length; if (((this.windowStart_ - this.windowEnd_) & 1) != 0) { this.buffer_ = (uint)(this.window_[this.windowStart_++] & byte.MaxValue); this.bitsInBuffer_ = 8; } return num + length; } // Token: 0x06000276 RID: 630 RVA: 0x0000CD48 File Offset: 0x0000BD48 public void Reset() { this.buffer_ = 0U; this.windowStart_ = (this.windowEnd_ = (this.bitsInBuffer_ = 0)); } // Token: 0x06000277 RID: 631 RVA: 0x0000CD78 File Offset: 0x0000BD78 public void SetInput(byte[] buffer, int offset, int count) { if (buffer == null) { throw new ArgumentNullException("buffer"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Cannot be negative"); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Cannot be negative"); } if (this.windowStart_ < this.windowEnd_) { throw new InvalidOperationException("Old input was not completely processed"); } int num = offset + count; if (offset > num || num > buffer.Length) { throw new ArgumentOutOfRangeException("count"); } if ((count & 1) != 0) { this.buffer_ |= (uint)((uint)(buffer[offset++] & byte.MaxValue) << this.bitsInBuffer_); this.bitsInBuffer_ += 8; } this.window_ = buffer; this.windowStart_ = offset; this.windowEnd_ = num; } // Token: 0x04000155 RID: 341 private byte[] window_; // Token: 0x04000156 RID: 342 private int windowStart_; // Token: 0x04000157 RID: 343 private int windowEnd_; // Token: 0x04000158 RID: 344 private uint buffer_; // Token: 0x04000159 RID: 345 private int bitsInBuffer_; } }