public static FileStream OpenSequentialStream( string path, FileMode mode, FileAccess access, FileShare share ) {
FileOptions options = FileOptions.SequentialScan;
if ( concurrency > 0 ) {
options |= FileOptions.Asynchronous;
}
if ( unbuffered ) {
options |= NoBuffering;
} else {
return new FileStream( path, mode, access, share, bufferSize, options );
}
SafeFileHandle fileHandle = CreateFile( path, (int) access, share, IntPtr.Zero, mode, (int) options, IntPtr.Zero );
if ( fileHandle.IsInvalid ) {
throw new IOException();
}
return new UnbufferedFileStream( fileHandle, access, bufferSize, ( concurrency > 0 ) );
}