public StreamBuffer(uint initialLength = 0, uint initialCapacity = 0) { if (initialCapacity < initialLength) { initialCapacity = initialLength; } this.buffer = new NativeBuffer(initialCapacity); this.SetLength(initialLength); }
private void Dispose(bool disposing) { this.buffer.Dispose(); this.buffer = null; if (context != IntPtr.Zero) { uint bytesRead; if (!BackupRead( hFile: fileHandle, lpBuffer: EmptySafeHandle.Instance, nNumberOfBytesToRead: 0, lpNumberOfBytesRead: out bytesRead, bAbort: true, bProcessSecurity: false, context: ref this.context)) { int error = Marshal.GetLastWin32Error(); throw GetIoExceptionForError(error); } } }