using System; namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams { // Token: 0x0200003D RID: 61 public class OutputWindow { // Token: 0x06000263 RID: 611 RVA: 0x0000C7BC File Offset: 0x0000B7BC public void Write(int value) { if (this.windowFilled++ == 32768) { throw new InvalidOperationException("Window full"); } this.window[this.windowEnd++] = (byte)value; this.windowEnd &= 32767; } // Token: 0x06000264 RID: 612 RVA: 0x0000C818 File Offset: 0x0000B818 private void SlowRepeat(int repStart, int length, int distance) { while (length-- > 0) { this.window[this.windowEnd++] = this.window[repStart++]; this.windowEnd &= 32767; repStart &= 32767; } } // Token: 0x06000265 RID: 613 RVA: 0x0000C870 File Offset: 0x0000B870 public void Repeat(int length, int distance) { if ((this.windowFilled += length) > 32768) { throw new InvalidOperationException("Window full"); } int num = (this.windowEnd - distance) & 32767; int num2 = 32768 - length; if (num > num2 || this.windowEnd >= num2) { this.SlowRepeat(num, length, distance); return; } if (length <= distance) { Array.Copy(this.window, num, this.window, this.windowEnd, length); this.windowEnd += length; return; } while (length-- > 0) { this.window[this.windowEnd++] = this.window[num++]; } } // Token: 0x06000266 RID: 614 RVA: 0x0000C928 File Offset: 0x0000B928 public int CopyStored(StreamManipulator input, int length) { length = Math.Min(Math.Min(length, 32768 - this.windowFilled), input.AvailableBytes); int num = 32768 - this.windowEnd; int num2; if (length > num) { num2 = input.CopyBytes(this.window, this.windowEnd, num); if (num2 == num) { num2 += input.CopyBytes(this.window, 0, length - num); } } else { num2 = input.CopyBytes(this.window, this.windowEnd, length); } this.windowEnd = (this.windowEnd + num2) & 32767; this.windowFilled += num2; return num2; } // Token: 0x06000267 RID: 615 RVA: 0x0000C9CC File Offset: 0x0000B9CC public void CopyDict(byte[] dictionary, int offset, int length) { if (dictionary == null) { throw new ArgumentNullException("dictionary"); } if (this.windowFilled > 0) { throw new InvalidOperationException(); } if (length > 32768) { offset += length - 32768; length = 32768; } Array.Copy(dictionary, offset, this.window, 0, length); this.windowEnd = length & 32767; } // Token: 0x06000268 RID: 616 RVA: 0x0000CA2C File Offset: 0x0000BA2C public int GetFreeSpace() { return 32768 - this.windowFilled; } // Token: 0x06000269 RID: 617 RVA: 0x0000CA3A File Offset: 0x0000BA3A public int GetAvailable() { return this.windowFilled; } // Token: 0x0600026A RID: 618 RVA: 0x0000CA44 File Offset: 0x0000BA44 public int CopyOutput(byte[] output, int offset, int len) { int num = this.windowEnd; if (len > this.windowFilled) { len = this.windowFilled; } else { num = (this.windowEnd - this.windowFilled + len) & 32767; } int num2 = len; int num3 = len - num; if (num3 > 0) { Array.Copy(this.window, 32768 - num3, output, offset, num3); offset += num3; len = num; } Array.Copy(this.window, num - len, output, offset, len); this.windowFilled -= num2; if (this.windowFilled < 0) { throw new InvalidOperationException(); } return num2; } // Token: 0x0600026B RID: 619 RVA: 0x0000CAD8 File Offset: 0x0000BAD8 public void Reset() { this.windowFilled = (this.windowEnd = 0); } // Token: 0x04000150 RID: 336 private const int WindowSize = 32768; // Token: 0x04000151 RID: 337 private const int WindowMask = 32767; // Token: 0x04000152 RID: 338 private byte[] window = new byte[32768]; // Token: 0x04000153 RID: 339 private int windowEnd; // Token: 0x04000154 RID: 340 private int windowFilled; } }