Created
July 3, 2013 12:17
-
-
Save leppie/5917429 to your computer and use it in GitHub Desktop.
.NET 4.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SecuritySafeCritical] | |
public virtual void Flush(bool flushToDisk) | |
{ | |
if (this._handle.IsClosed) | |
{ | |
__Error.FileNotOpen(); | |
} | |
this.FlushInternalBuffer(); | |
if (flushToDisk && this.CanWrite) | |
{ | |
this.FlushOSBuffer(); | |
} | |
} | |
private void FlushInternalBuffer() | |
{ | |
if (this._writePos > 0) | |
{ | |
this.FlushWrite(false); | |
return; | |
} | |
if (this._readPos < this._readLen && this.CanSeek) | |
{ | |
this.FlushRead(); | |
} | |
} | |
[SecuritySafeCritical] | |
private void FlushOSBuffer() | |
{ | |
if (!Win32Native.FlushFileBuffers(this._handle)) | |
{ | |
__Error.WinIOError(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment