Fixes mono builds. (#16)

This commit is contained in:
Kamron Batman 2019-03-03 15:49:10 -08:00 • committed by GitHub
parent 90ffe0ea3c
commit 1c8f044476
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 30 deletions

View file

@ -22,10 +22,7 @@ namespace Server.RemoteAdmin
public static void Configure() public static void Configure()
{ {
PacketHandlers.Register(0xF1, 0, false, OnReceive); PacketHandlers.Register(0xF1, 0, false, OnReceive);
#if !MONO
Core.MultiConsoleOut.Add(new EventTextWriter(OnConsoleChar, OnConsoleLine, OnConsoleString)); Core.MultiConsoleOut.Add(new EventTextWriter(OnConsoleChar, OnConsoleLine, OnConsoleString));
#endif
Timer.DelayCall(TimeSpan.FromMinutes(2.5), TimeSpan.FromMinutes(2.5), CleanUp); Timer.DelayCall(TimeSpan.FromMinutes(2.5), TimeSpan.FromMinutes(2.5), CleanUp);
} }

View file

@ -51,7 +51,6 @@ namespace Server
{ {
public unsafe void Read(IntPtr ptr, void* buffer, int length) public unsafe void Read(IntPtr ptr, void* buffer, int length)
{ {
//UnsafeNativeMethods._lread( ptr, buffer, length );
uint lpNumberOfBytesRead = 0; uint lpNumberOfBytesRead = 0;
UnsafeNativeMethods.ReadFile(ptr, buffer, (uint)length, ref lpNumberOfBytesRead, null); UnsafeNativeMethods.ReadFile(ptr, buffer, (uint)length, ref lpNumberOfBytesRead, null);
} }

View file

@ -48,10 +48,11 @@ namespace Server
{ {
FileOptions options = FileOptions.SequentialScan; FileOptions options = FileOptions.SequentialScan;
if (Concurrency > 0) options |= FileOptions.Asynchronous; if (Concurrency > 0)
options |= FileOptions.Asynchronous;
#if MONO #if MONO
return new FileStream( path, mode, access, share, bufferSize, options ); return new FileStream( path, mode, access, share, BufferSize, options );
#else #else
if (Unbuffered) if (Unbuffered)
options |= NoBuffering; options |= NoBuffering;

View file

@ -79,10 +79,8 @@ namespace Server
) )
); );
#if !MONO
PerformanceCounterCategory.Create(PerformanceCategoryName, PerformanceCategoryDesc, PerformanceCounterCategory.Create(PerformanceCategoryName, PerformanceCategoryDesc,
PerformanceCounterCategoryType.SingleInstance, counters); PerformanceCounterCategoryType.SingleInstance, counters);
#endif
} }
numberOfWorldSaves = new PerformanceCounter(PerformanceCategoryName, "Save - Count", false); numberOfWorldSaves = new PerformanceCounter(PerformanceCategoryName, "Save - Count", false);

View file

@ -388,11 +388,7 @@ namespace Server
fixed (StaticTile* pTiles = staTiles) fixed (StaticTile* pTiles = staTiles)
{ {
#if !MONO
NativeReader.Read(DataStream.SafeFileHandle.DangerousGetHandle(), pTiles, length); NativeReader.Read(DataStream.SafeFileHandle.DangerousGetHandle(), pTiles, length);
#else
NativeReader.Read( m_Statics.Handle, pTiles, length );
#endif
if (m_Lists == null) if (m_Lists == null)
{ {
m_Lists = new TileList[8][]; m_Lists = new TileList[8][];
@ -463,11 +459,7 @@ namespace Server
fixed (LandTile* pTiles = tiles) fixed (LandTile* pTiles = tiles)
{ {
#if !MONO
NativeReader.Read(MapStream.SafeFileHandle.DangerousGetHandle(), pTiles, 192); NativeReader.Read(MapStream.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
#else
NativeReader.Read( m_Map.Handle, pTiles, 192 );
#endif
} }
return tiles; return tiles;

View file

@ -95,11 +95,7 @@ namespace Server
fixed (LandTile* pTiles = tiles) fixed (LandTile* pTiles = tiles)
{ {
#if !MONO
NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192); NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, 192);
#else
NativeReader.Read( fsData.Handle, pTiles, 192 );
#endif
} }
matrix.SetLandBlock(x, y, tiles); matrix.SetLandBlock(x, y, tiles);
@ -163,11 +159,7 @@ namespace Server
fixed (StaticTile* pTiles = staTiles) fixed (StaticTile* pTiles = staTiles)
{ {
#if !MONO
NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length); NativeReader.Read(fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length);
#else
NativeReader.Read( fsData.Handle, pTiles, length );
#endif
StaticTile* pCur = pTiles, pEnd = pTiles + tileCount; StaticTile* pCur = pTiles, pEnd = pTiles + tileCount;
while (pCur < pEnd) while (pCur < pEnd)