Cleans up some pragmas (#136)

This commit is contained in:
Kamron Batman 2020-05-14 01:52:42 -07:00 • committed by GitHub
parent 32ac48657a
commit 739e77a973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 149 deletions

View file

@ -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