コード例 #1
0
ファイル: StreamBuffer.cs プロジェクト: ramarag/XTask
 public StreamBuffer(uint initialLength = 0, uint initialCapacity = 0)
 {
     if (initialCapacity < initialLength)
     {
         initialCapacity = initialLength;
     }
     this.buffer = new NativeBuffer(initialCapacity);
     this.SetLength(initialLength);
 }
コード例 #2
0
                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);
                        }
                    }
                }