private int OnWrite(IntPtr buffer, int count) { if (writeBuffer.Length < count) { writeBuffer = new byte[count]; } var oldPos = OriStream.Position; OriStream.Write(writeBuffer, 0, count); Marshal.Copy(buffer, writeBuffer, 0, count); return((int)(OriStream.Position - oldPos)); }
private int OnRead(IntPtr buffer, int count) { if (this.readBuffer.Length < count) { this.readBuffer = new byte[count]; } var readCount = OriStream.Read(readBuffer, 0, count); #if DEBUG if (count == 30380032) { } if (count != readCount && OriStream.Length == 13878934528) { } #endif Marshal.Copy(readBuffer, 0, buffer, readCount); return(readCount); }