Cleans up some pragmas (#136)
This commit is contained in:
parent
32ac48657a
commit
739e77a973
5 changed files with 13 additions and 149 deletions
|
|
@ -18,12 +18,11 @@
|
|||
*
|
||||
***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
#if !MONO
|
||||
#if WINDOWS
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Server
|
||||
|
|
@ -37,12 +36,12 @@ namespace Server
|
|||
|
||||
public static int Concurrency { get; set; } = 1;
|
||||
|
||||
#if WINDOWS
|
||||
public static bool Unbuffered { get; set; } = true;
|
||||
#endif
|
||||
|
||||
public static bool AreSynchronous => Concurrency < 1;
|
||||
|
||||
public static bool AreAsynchronous => Concurrency > 0;
|
||||
|
||||
public static FileStream OpenSequentialStream(string path, FileMode mode, FileAccess access, FileShare share)
|
||||
{
|
||||
var options = FileOptions.SequentialScan;
|
||||
|
|
@ -50,7 +49,7 @@ namespace Server
|
|||
if (Concurrency > 0)
|
||||
options |= FileOptions.Asynchronous;
|
||||
|
||||
#if MONO
|
||||
#if !WINDOWS
|
||||
return new FileStream( path, mode, access, share, BufferSize, options );
|
||||
#else
|
||||
if (Unbuffered)
|
||||
|
|
@ -67,7 +66,7 @@ namespace Server
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
#if WINDOWS
|
||||
private class UnbufferedFileStream : FileStream
|
||||
{
|
||||
private readonly SafeFileHandle fileHandle;
|
||||
|
|
@ -94,7 +93,7 @@ namespace Server
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !MONO
|
||||
#if WINDOWS
|
||||
private const FileOptions NoBuffering = (FileOptions)0x20000000;
|
||||
|
||||
internal static class UnsafeNativeMethods
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue