using System; using System.IO; using System.Security.Cryptography; namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams { // Token: 0x0200003C RID: 60 public class InflaterInputBuffer { // Token: 0x06000251 RID: 593 RVA: 0x0000C425 File Offset: 0x0000B425 public InflaterInputBuffer(Stream stream) : this(stream, 4096) { } // Token: 0x06000252 RID: 594 RVA: 0x0000C433 File Offset: 0x0000B433 public InflaterInputBuffer(Stream stream, int bufferSize) { this.inputStream = stream; if (bufferSize < 1024) { bufferSize = 1024; } this.rawData = new byte[bufferSize]; this.clearText = this.rawData; } // Token: 0x17000083 RID: 131 // (get) Token: 0x06000253 RID: 595 RVA: 0x0000C469 File Offset: 0x0000B469 public int RawLength { get { return this.rawLength; } } // Token: 0x17000084 RID: 132 // (get) Token: 0x06000254 RID: 596 RVA: 0x0000C471 File Offset: 0x0000B471 public byte[] RawData { get { return this.rawData; } } // Token: 0x17000085 RID: 133 // (get) Token: 0x06000255 RID: 597 RVA: 0x0000C479 File Offset: 0x0000B479 public int ClearTextLength { get { return this.clearTextLength; } } // Token: 0x17000086 RID: 134 // (get) Token: 0x06000256 RID: 598 RVA: 0x0000C481 File Offset: 0x0000B481 public byte[] ClearText { get { return this.clearText; } } // Token: 0x17000087 RID: 135 // (get) Token: 0x06000257 RID: 599 RVA: 0x0000C489 File Offset: 0x0000B489 // (set) Token: 0x06000258 RID: 600 RVA: 0x0000C491 File Offset: 0x0000B491 public int Available { get { return this.available; } set { this.available = value; } } // Token: 0x06000259 RID: 601 RVA: 0x0000C49A File Offset: 0x0000B49A public void SetInflaterInput(Inflater inflater) { if (this.available > 0) { inflater.SetInput(this.clearText, this.clearTextLength - this.available, this.available); this.available = 0; } } // Token: 0x0600025A RID: 602 RVA: 0x0000C4CC File Offset: 0x0000B4CC public void Fill() { this.rawLength = 0; int num; for (int i = this.rawData.Length; i > 0; i -= num) { num = this.inputStream.Read(this.rawData, this.rawLength, i); if (num <= 0) { break; } this.rawLength += num; } if (this.cryptoTransform != null) { this.clearTextLength = this.cryptoTransform.TransformBlock(this.rawData, 0, this.rawLength, this.clearText, 0); } else { this.clearTextLength = this.rawLength; } this.available = this.clearTextLength; } // Token: 0x0600025B RID: 603 RVA: 0x0000C565 File Offset: 0x0000B565 public int ReadRawBuffer(byte[] buffer) { return this.ReadRawBuffer(buffer, 0, buffer.Length); } // Token: 0x0600025C RID: 604 RVA: 0x0000C574 File Offset: 0x0000B574 public int ReadRawBuffer(byte[] outBuffer, int offset, int length) { if (length < 0) { throw new ArgumentOutOfRangeException("length"); } int num = offset; int i = length; while (i > 0) { if (this.available <= 0) { this.Fill(); if (this.available <= 0) { return 0; } } int num2 = Math.Min(i, this.available); Array.Copy(this.rawData, this.rawLength - this.available, outBuffer, num, num2); num += num2; i -= num2; this.available -= num2; } return length; } // Token: 0x0600025D RID: 605 RVA: 0x0000C5F4 File Offset: 0x0000B5F4 public int ReadClearTextBuffer(byte[] outBuffer, int offset, int length) { if (length < 0) { throw new ArgumentOutOfRangeException("length"); } int num = offset; int i = length; while (i > 0) { if (this.available <= 0) { this.Fill(); if (this.available <= 0) { return 0; } } int num2 = Math.Min(i, this.available); Array.Copy(this.clearText, this.clearTextLength - this.available, outBuffer, num, num2); num += num2; i -= num2; this.available -= num2; } return length; } // Token: 0x0600025E RID: 606 RVA: 0x0000C674 File Offset: 0x0000B674 public int ReadLeByte() { if (this.available <= 0) { this.Fill(); if (this.available <= 0) { throw new ZipException("EOF in header"); } } byte b = this.rawData[this.rawLength - this.available]; this.available--; return (int)b; } // Token: 0x0600025F RID: 607 RVA: 0x0000C6C8 File Offset: 0x0000B6C8 public int ReadLeShort() { return this.ReadLeByte() | (this.ReadLeByte() << 8); } // Token: 0x06000260 RID: 608 RVA: 0x0000C6D9 File Offset: 0x0000B6D9 public int ReadLeInt() { return this.ReadLeShort() | (this.ReadLeShort() << 16); } // Token: 0x06000261 RID: 609 RVA: 0x0000C6EB File Offset: 0x0000B6EB public long ReadLeLong() { return (long)((ulong)this.ReadLeInt() | (ulong)((ulong)((long)this.ReadLeInt()) << 32)); } // Token: 0x17000088 RID: 136 // (set) Token: 0x06000262 RID: 610 RVA: 0x0000C700 File Offset: 0x0000B700 public ICryptoTransform CryptoTransform { set { this.cryptoTransform = value; if (this.cryptoTransform != null) { if (this.rawData == this.clearText) { if (this.internalClearText == null) { this.internalClearText = new byte[this.rawData.Length]; } this.clearText = this.internalClearText; } this.clearTextLength = this.rawLength; if (this.available > 0) { this.cryptoTransform.TransformBlock(this.rawData, this.rawLength - this.available, this.available, this.clearText, this.rawLength - this.available); return; } } else { this.clearText = this.rawData; this.clearTextLength = this.rawLength; } } } // Token: 0x04000148 RID: 328 private int rawLength; // Token: 0x04000149 RID: 329 private byte[] rawData; // Token: 0x0400014A RID: 330 private int clearTextLength; // Token: 0x0400014B RID: 331 private byte[] clearText; // Token: 0x0400014C RID: 332 private byte[] internalClearText; // Token: 0x0400014D RID: 333 private int available; // Token: 0x0400014E RID: 334 private ICryptoTransform cryptoTransform; // Token: 0x0400014F RID: 335 private Stream inputStream; } }