Created
September 26, 2013 19:28
-
-
Save alexandrnikitin/6719301 to your computer and use it in GitHub Desktop.
For Ayende
This file contains 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
public MemoryMapPager(string fileName, FlushMode flushMode = FlushMode.Full) | |
{ | |
_flushMode = flushMode; | |
var fileInfo = new FileInfo(fileName); | |
var fileLength = fileInfo.Length; | |
var isFileEmpty = fileLength == 0 || fileInfo.Exists == false; | |
_fileStream = fileInfo.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read); | |
_allocatedPages = isFileEmpty ? 0 : (long) Math.Ceiling((float) fileLength/PageSize); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment