Always use Ionic.Zlib for decompression.

This commit is contained in:
UnknownShadow200 2015-06-25 19:39:28 +10:00
parent d2310076c0
commit b11969837e
5 changed files with 5 additions and 29 deletions

View file

@ -1,11 +1,7 @@
using System;
using System.Drawing;
using System.IO;
#if __MonoCS__
using Ionic.Zlib;
#else
using System.IO.Compression;
#endif
using System.Net;
using System.Net.Sockets;
using ClassicalSharp;
@ -248,19 +244,7 @@ namespace DefaultPlugin.Network {
}
receivedFirstPosition = false;
gzipHeader = new GZipHeaderReader();
// Workaround because built in mono stream assumes that the end of stream
// has been reached the first time a read call returns 0. (MS.NET doesn't)
#if __MonoCS__
gzipStream = new DeflateStream( gzippedMap, true );
#else
gzipStream = new DeflateStream( gzippedMap, CompressionMode.Decompress );
if( OpenTK.Configuration.RunningOnMono ) {
Utils.LogWarning( "You are running on Mono, but this build does not support the Mono workaround." );
Utils.LogWarning( "You should either download the Mono compatible build or define '__MonoCS__' when targeting Mono. " +
"(The Mono compiler already defines this by default)" );
Utils.LogWarning( "You will likely experience an 'Internal error (no progress possible) ReadInternal' exception when decompressing the map." );
}
#endif
mapSizeIndex = 0;
mapIndex = 0;
receiveStart = DateTime.UtcNow;

View file

@ -1,13 +1,12 @@
// Originally copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
// All rights reserved.
// See license.txt, section Ionic.Zlib license
#if __MonoCS__
using System;
using System.IO;
namespace Ionic.Zlib {
internal class DeflateStream {
public class DeflateStream {
ZlibCodec z;
bool _leaveOpen;
@ -71,5 +70,4 @@ namespace Ionic.Zlib {
return count - z.AvailableBytesOut;
}
}
}
#endif
}

View file

@ -1,7 +1,6 @@
// Originally copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
// All rights reserved.
// See license.txt, section Ionic.Zlib license
#if __MonoCS__
using System;
namespace Ionic.Zlib {
@ -292,5 +291,4 @@ namespace Ionic.Zlib {
return (int)( (uint)value >> bits );
}
}
}
#endif
}

View file

@ -1,7 +1,6 @@
// Originally copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
// All rights reserved.
// See license.txt, section Ionic.Zlib license
#if __MonoCS__
using System;
using System.IO;
@ -977,5 +976,4 @@ namespace Ionic.Zlib
return RCode.StreamEnd;
}
}
}
#endif
}

View file

@ -1,7 +1,6 @@
// Originally copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
// All rights reserved.
// See license.txt, section Ionic.Zlib license
#if __MonoCS__
using System;
namespace Ionic.Zlib {
@ -40,5 +39,4 @@ namespace Ionic.Zlib {
public const int DataError = -3;
public const int BufferError = -5;
}
}
#endif
}