public int CopyFrom(InputBuffer input, int length) {
int num;
length = Math.Min(Math.Min(length, 0x8000 - this.bytesUsed), input.AvailableBytes);
int num2 = 0x8000 - this.end;
if (length > num2) {
num = input.CopyTo(this.window, this.end, num2);
if (num == num2) {
num += input.CopyTo(this.window, 0, length - num2);
}
}
else {
num = input.CopyTo(this.window, this.end, length);
}
this.end = (this.end + num) & 0x7fff;
this.bytesUsed += num;
return num;
}