From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc.meta | 9 + .../Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs | 286 +++ .../Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs.meta | 12 + .../XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs | 210 ++ .../Ionic/Crc/CrcCalculatorStream.cs.meta | 12 + Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib.meta | 9 + .../Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs | 81 + .../Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs | 12 + .../XUtliPoolLib/Ionic/Zlib/BlockState.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs | 22 + .../Ionic/Zlib/CompressionLevel.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/CompressionMode.cs | 10 + .../Ionic/Zlib/CompressionMode.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs | 11 + .../Ionic/Zlib/CompressionStrategy.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs | 11 + .../XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/DeflateManager.cs | 1592 +++++++++++++++ .../XUtliPoolLib/Ionic/Zlib/DeflateManager.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/DeflateStream.cs | 288 +++ .../XUtliPoolLib/Ionic/Zlib/DeflateStream.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs | 13 + .../XUtliPoolLib/Ionic/Zlib/FlushType.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs | 417 ++++ .../XUtliPoolLib/Ionic/Zlib/GZipStream.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs | 2154 ++++++++++++++++++++ .../XUtliPoolLib/Ionic/Zlib/InfTree.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs | 740 +++++++ .../XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/InflateCodes.cs | 696 +++++++ .../XUtliPoolLib/Ionic/Zlib/InflateCodes.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/InflateManager.cs | 523 +++++ .../XUtliPoolLib/Ionic/Zlib/InflateManager.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/InternalConstants.cs | 27 + .../Ionic/Zlib/InternalConstants.cs.meta | 12 + .../Ionic/Zlib/InternalInflateConstants.cs | 28 + .../Ionic/Zlib/InternalInflateConstants.cs.meta | 12 + .../Ionic/Zlib/ParallelDeflateOutputStream.cs | 630 ++++++ .../Ionic/Zlib/ParallelDeflateOutputStream.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs | 53 + .../XUtliPoolLib/Ionic/Zlib/SharedUtils.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs | 676 ++++++ .../XUtliPoolLib/Ionic/Zlib/StaticTree.cs.meta | 12 + .../Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs | 1184 +++++++++++ .../Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs | 35 + .../XUtliPoolLib/Ionic/Zlib/WorkItem.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs | 718 +++++++ .../XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs | 315 +++ .../XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs | 27 + .../XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/ZlibException.cs | 17 + .../XUtliPoolLib/Ionic/Zlib/ZlibException.cs.meta | 12 + .../Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs | 278 +++ .../XUtliPoolLib/Ionic/Zlib/ZlibStream.cs.meta | 12 + .../XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs | 11 + .../Ionic/Zlib/ZlibStreamFlavor.cs.meta | 12 + 60 files changed, 11431 insertions(+) create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs.meta create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs create mode 100644 Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs.meta (limited to 'Client/Assets/Scripts/XUtliPoolLib/Ionic') diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc.meta new file mode 100644 index 00000000..6d786460 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 058a44ad22d74f1458b1d9515bf232c2 +folderAsset: yes +timeCreated: 1611465283 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs new file mode 100644 index 00000000..c73c17eb --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs @@ -0,0 +1,286 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace Ionic.Crc +{ + [Guid("ebc25cf6-9120-4283-b972-0e5520d0000C")] + [ComVisible(true)] + [ClassInterface(ClassInterfaceType.AutoDispatch)] + public class CRC32 + { + public long TotalBytesRead + { + get + { + return this._TotalBytesRead; + } + } + + public int Crc32Result + { + get + { + return (int)(~(int)this._register); + } + } + + private uint dwPolynomial; + + private long _TotalBytesRead; + + private bool reverseBits; + + private uint[] crc32Table; + + private const int BUFFER_SIZE = 8192; + + private uint _register = uint.MaxValue; + + public int GetCrc32(Stream input) + { + return this.GetCrc32AndCopy(input, null); + } + + public int GetCrc32AndCopy(Stream input, Stream output) + { + bool flag = input == null; + if (flag) + { + throw new Exception("The input stream must not be null."); + } + byte[] array = new byte[8192]; + int count = 8192; + this._TotalBytesRead = 0L; + int i = input.Read(array, 0, count); + bool flag2 = output != null; + if (flag2) + { + output.Write(array, 0, i); + } + this._TotalBytesRead += (long)i; + while (i > 0) + { + this.SlurpBlock(array, 0, i); + i = input.Read(array, 0, count); + bool flag3 = output != null; + if (flag3) + { + output.Write(array, 0, i); + } + this._TotalBytesRead += (long)i; + } + return (int)(~(int)this._register); + } + + public int ComputeCrc32(int W, byte B) + { + return this._InternalComputeCrc32((uint)W, B); + } + + internal int _InternalComputeCrc32(uint W, byte B) + { + return (int)(this.crc32Table[(int)((W ^ (uint)B) & 255u)] ^ W >> 8); + } + + public void SlurpBlock(byte[] block, int offset, int count) + { + bool flag = block == null; + if (flag) + { + throw new Exception("The data buffer must not be null."); + } + for (int i = 0; i < count; i++) + { + int num = offset + i; + byte b = block[num]; + bool flag2 = this.reverseBits; + if (flag2) + { + uint num2 = this._register >> 24 ^ (uint)b; + this._register = (this._register << 8 ^ this.crc32Table[(int)num2]); + } + else + { + uint num3 = (this._register & 255u) ^ (uint)b; + this._register = (this._register >> 8 ^ this.crc32Table[(int)num3]); + } + } + this._TotalBytesRead += (long)count; + } + + public void UpdateCRC(byte b) + { + bool flag = this.reverseBits; + if (flag) + { + uint num = this._register >> 24 ^ (uint)b; + this._register = (this._register << 8 ^ this.crc32Table[(int)num]); + } + else + { + uint num2 = (this._register & 255u) ^ (uint)b; + this._register = (this._register >> 8 ^ this.crc32Table[(int)num2]); + } + } + + public void UpdateCRC(byte b, int n) + { + while (n-- > 0) + { + bool flag = this.reverseBits; + if (flag) + { + uint num = this._register >> 24 ^ (uint)b; + this._register = (this._register << 8 ^ this.crc32Table[(int)((num >= 0u) ? num : (num + 256u))]); + } + else + { + uint num2 = (this._register & 255u) ^ (uint)b; + this._register = (this._register >> 8 ^ this.crc32Table[(int)((num2 >= 0u) ? num2 : (num2 + 256u))]); + } + } + } + + private static uint ReverseBits(uint data) + { + uint num = (data & 1431655765u) << 1 | (data >> 1 & 1431655765u); + num = ((num & 858993459u) << 2 | (num >> 2 & 858993459u)); + num = ((num & 252645135u) << 4 | (num >> 4 & 252645135u)); + return num << 24 | (num & 65280u) << 8 | (num >> 8 & 65280u) | num >> 24; + } + + private static byte ReverseBits(byte data) + { + uint num = (uint)data * 131586u; + uint num2 = 17055760u; + uint num3 = num & num2; + uint num4 = num << 2 & num2 << 1; + return (byte)(16781313u * (num3 + num4) >> 24); + } + + private void GenerateLookupTable() + { + this.crc32Table = new uint[256]; + byte b = 0; + do + { + uint num = (uint)b; + for (byte b2 = 8; b2 > 0; b2 -= 1) + { + bool flag = (num & 1u) == 1u; + if (flag) + { + num = (num >> 1 ^ this.dwPolynomial); + } + else + { + num >>= 1; + } + } + bool flag2 = this.reverseBits; + if (flag2) + { + this.crc32Table[(int)CRC32.ReverseBits(b)] = CRC32.ReverseBits(num); + } + else + { + this.crc32Table[(int)b] = num; + } + b += 1; + } + while (b > 0); + } + + private uint gf2_matrix_times(uint[] matrix, uint vec) + { + uint num = 0u; + int num2 = 0; + while (vec > 0u) + { + bool flag = (vec & 1u) == 1u; + if (flag) + { + num ^= matrix[num2]; + } + vec >>= 1; + num2++; + } + return num; + } + + private void gf2_matrix_square(uint[] square, uint[] mat) + { + for (int i = 0; i < 32; i++) + { + square[i] = this.gf2_matrix_times(mat, mat[i]); + } + } + + public void Combine(int crc, int length) + { + uint[] array = new uint[32]; + uint[] array2 = new uint[32]; + bool flag = length == 0; + if (!flag) + { + uint num = ~this._register; + array2[0] = this.dwPolynomial; + uint num2 = 1u; + for (int i = 1; i < 32; i++) + { + array2[i] = num2; + num2 <<= 1; + } + this.gf2_matrix_square(array, array2); + this.gf2_matrix_square(array2, array); + uint num3 = (uint)length; + do + { + this.gf2_matrix_square(array, array2); + bool flag2 = (num3 & 1u) == 1u; + if (flag2) + { + num = this.gf2_matrix_times(array, num); + } + num3 >>= 1; + bool flag3 = num3 == 0u; + if (flag3) + { + break; + } + this.gf2_matrix_square(array2, array); + bool flag4 = (num3 & 1u) == 1u; + if (flag4) + { + num = this.gf2_matrix_times(array2, num); + } + num3 >>= 1; + } + while (num3 > 0u); + num ^= (uint)crc; + this._register = ~num; + } + } + + public CRC32() : this(false) + { + } + + public CRC32(bool reverseBits) : this(-306674912, reverseBits) + { + } + + public CRC32(int polynomial, bool reverseBits) + { + this.reverseBits = reverseBits; + this.dwPolynomial = (uint)polynomial; + this.GenerateLookupTable(); + } + + public void Reset() + { + this._register = uint.MaxValue; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs.meta new file mode 100644 index 00000000..15ba7c25 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CRC32.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e7561e05e3adb2248a384ca19e751de7 +timeCreated: 1611465802 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs new file mode 100644 index 00000000..fb6dc520 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs @@ -0,0 +1,210 @@ +using System; +using System.IO; + +namespace Ionic.Crc +{ + public class CrcCalculatorStream : Stream, IDisposable + { + public long TotalBytesSlurped + { + get + { + return this._Crc32.TotalBytesRead; + } + } + + public int Crc + { + get + { + return this._Crc32.Crc32Result; + } + } + + public bool LeaveOpen + { + get + { + return this._leaveOpen; + } + set + { + this._leaveOpen = value; + } + } + + public override bool CanRead + { + get + { + return this._innerStream.CanRead; + } + } + + public override bool CanSeek + { + get + { + return false; + } + } + + public override bool CanWrite + { + get + { + return this._innerStream.CanWrite; + } + } + + public override long Length + { + get + { + bool flag = this._lengthLimit == CrcCalculatorStream.UnsetLengthLimit; + long result; + if (flag) + { + result = this._innerStream.Length; + } + else + { + result = this._lengthLimit; + } + return result; + } + } + + public override long Position + { + get + { + return this._Crc32.TotalBytesRead; + } + set + { + throw new NotSupportedException(); + } + } + + private static readonly long UnsetLengthLimit = -99L; + + internal Stream _innerStream; + + private CRC32 _Crc32; + + private long _lengthLimit = -99L; + + private bool _leaveOpen; + + public CrcCalculatorStream(Stream stream) : this(true, CrcCalculatorStream.UnsetLengthLimit, stream, null) + { + } + + public CrcCalculatorStream(Stream stream, bool leaveOpen) : this(leaveOpen, CrcCalculatorStream.UnsetLengthLimit, stream, null) + { + } + + public CrcCalculatorStream(Stream stream, long length) : this(true, length, stream, null) + { + bool flag = length < 0L; + if (flag) + { + throw new ArgumentException("length"); + } + } + + public CrcCalculatorStream(Stream stream, long length, bool leaveOpen) : this(leaveOpen, length, stream, null) + { + bool flag = length < 0L; + if (flag) + { + throw new ArgumentException("length"); + } + } + + public CrcCalculatorStream(Stream stream, long length, bool leaveOpen, CRC32 crc32) : this(leaveOpen, length, stream, crc32) + { + bool flag = length < 0L; + if (flag) + { + throw new ArgumentException("length"); + } + } + + private CrcCalculatorStream(bool leaveOpen, long length, Stream stream, CRC32 crc32) + { + this._innerStream = stream; + this._Crc32 = (crc32 ?? new CRC32()); + this._lengthLimit = length; + this._leaveOpen = leaveOpen; + } + + public override int Read(byte[] buffer, int offset, int count) + { + int count2 = count; + bool flag = this._lengthLimit != CrcCalculatorStream.UnsetLengthLimit; + if (flag) + { + bool flag2 = this._Crc32.TotalBytesRead >= this._lengthLimit; + if (flag2) + { + return 0; + } + long num = this._lengthLimit - this._Crc32.TotalBytesRead; + bool flag3 = num < (long)count; + if (flag3) + { + count2 = (int)num; + } + } + int num2 = this._innerStream.Read(buffer, offset, count2); + bool flag4 = num2 > 0; + if (flag4) + { + this._Crc32.SlurpBlock(buffer, offset, num2); + } + return num2; + } + + public override void Write(byte[] buffer, int offset, int count) + { + bool flag = count > 0; + if (flag) + { + this._Crc32.SlurpBlock(buffer, offset, count); + } + this._innerStream.Write(buffer, offset, count); + } + + public override void Flush() + { + this._innerStream.Flush(); + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotSupportedException(); + } + + public override void SetLength(long value) + { + throw new NotSupportedException(); + } + + void IDisposable.Dispose() + { + this.Close(); + } + + public override void Close() + { + base.Close(); + bool flag = !this._leaveOpen; + if (flag) + { + this._innerStream.Close(); + } + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs.meta new file mode 100644 index 00000000..7004d0d4 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Crc/CrcCalculatorStream.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 997359f18cd5d9f4eb28827ec896167a +timeCreated: 1611465710 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib.meta new file mode 100644 index 00000000..6d828dab --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: daa797353e7a07b42baaba72ced4a26b +folderAsset: yes +timeCreated: 1611465283 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs new file mode 100644 index 00000000..f58e0e4a --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs @@ -0,0 +1,81 @@ +using System; + +namespace Ionic.Zlib +{ + public sealed class Adler + { + private static readonly uint BASE = 65521u; + + private static readonly int NMAX = 5552; + + public static uint Adler32(uint adler, byte[] buf, int index, int len) + { + bool flag = buf == null; + uint result; + if (flag) + { + result = 1u; + } + else + { + uint num = adler & 65535u; + uint num2 = adler >> 16 & 65535u; + while (len > 0) + { + int i = (len < Adler.NMAX) ? len : Adler.NMAX; + len -= i; + while (i >= 16) + { + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + num += (uint)buf[index++]; + num2 += num; + i -= 16; + } + bool flag2 = i != 0; + if (flag2) + { + do + { + num += (uint)buf[index++]; + num2 += num; + } + while (--i != 0); + } + num %= Adler.BASE; + num2 %= Adler.BASE; + } + result = (num2 << 16 | num); + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs.meta new file mode 100644 index 00000000..3847336e --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Adler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b41ba122cd186414691f6541fad6c9a4 +timeCreated: 1611465745 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs new file mode 100644 index 00000000..821394fd --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs @@ -0,0 +1,12 @@ +using System; + +namespace Ionic.Zlib +{ + internal enum BlockState + { + NeedMore, + BlockDone, + FinishStarted, + FinishDone + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs.meta new file mode 100644 index 00000000..21ad02f0 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/BlockState.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 68827052e097f0a47ad03b99e6ebc69b +timeCreated: 1611465683 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs new file mode 100644 index 00000000..7b9dfefa --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs @@ -0,0 +1,22 @@ +using System; + +namespace Ionic.Zlib +{ + public enum CompressionLevel + { + None, + Level0 = 0, + BestSpeed, + Level1 = 1, + Level2, + Level3, + Level4, + Level5, + Default, + Level6 = 6, + Level7, + Level8, + BestCompression, + Level9 = 9 + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs.meta new file mode 100644 index 00000000..01346c39 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionLevel.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 84e41608826132c4a92549cfdc37f19d +timeCreated: 1611465695 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs new file mode 100644 index 00000000..60c9981c --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs @@ -0,0 +1,10 @@ +using System; + +namespace Ionic.Zlib +{ + public enum CompressionMode + { + Compress, + Decompress + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs.meta new file mode 100644 index 00000000..987fd513 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionMode.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 33117e8b329a46e4ba3118e4cc32200d +timeCreated: 1611465310 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs new file mode 100644 index 00000000..30e740d8 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs @@ -0,0 +1,11 @@ +using System; + +namespace Ionic.Zlib +{ + public enum CompressionStrategy + { + Default, + Filtered, + HuffmanOnly + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs.meta new file mode 100644 index 00000000..7684d477 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/CompressionStrategy.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 726df2559ddc4e748a2f85bac5421329 +timeCreated: 1611465688 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs new file mode 100644 index 00000000..46f9234a --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs @@ -0,0 +1,11 @@ +using System; + +namespace Ionic.Zlib +{ + internal enum DeflateFlavor + { + Store, + Fast, + Slow + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs.meta new file mode 100644 index 00000000..cc9fa9df --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateFlavor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2a0eff7773320894e9ae38e9438d323e +timeCreated: 1611465303 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs new file mode 100644 index 00000000..45f89851 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs @@ -0,0 +1,1592 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class DeflateManager + { + internal bool WantRfc1950HeaderBytes + { + get + { + return this._WantRfc1950HeaderBytes; + } + set + { + this._WantRfc1950HeaderBytes = value; + } + } + + private static readonly int MEM_LEVEL_MAX = 9; + + private static readonly int MEM_LEVEL_DEFAULT = 8; + + private DeflateManager.CompressFunc DeflateFunction; + + private static readonly string[] _ErrorMessage = new string[] + { + "need dictionary", + "stream end", + "", + "file error", + "stream error", + "data error", + "insufficient memory", + "buffer error", + "incompatible version", + "" + }; + + private static readonly int PRESET_DICT = 32; + + private static readonly int INIT_STATE = 42; + + private static readonly int BUSY_STATE = 113; + + private static readonly int FINISH_STATE = 666; + + private static readonly int Z_DEFLATED = 8; + + private static readonly int STORED_BLOCK = 0; + + private static readonly int STATIC_TREES = 1; + + private static readonly int DYN_TREES = 2; + + private static readonly int Z_BINARY = 0; + + private static readonly int Z_ASCII = 1; + + private static readonly int Z_UNKNOWN = 2; + + private static readonly int Buf_size = 16; + + private static readonly int MIN_MATCH = 3; + + private static readonly int MAX_MATCH = 258; + + private static readonly int MIN_LOOKAHEAD = DeflateManager.MAX_MATCH + DeflateManager.MIN_MATCH + 1; + + private static readonly int HEAP_SIZE = 2 * InternalConstants.L_CODES + 1; + + private static readonly int END_BLOCK = 256; + + internal ZlibCodec _codec; + + internal int status; + + internal byte[] pending; + + internal int nextPending; + + internal int pendingCount; + + internal sbyte data_type; + + internal int last_flush; + + internal int w_size; + + internal int w_bits; + + internal int w_mask; + + internal byte[] window; + + internal int window_size; + + internal short[] prev; + + internal short[] head; + + internal int ins_h; + + internal int hash_size; + + internal int hash_bits; + + internal int hash_mask; + + internal int hash_shift; + + internal int block_start; + + private DeflateManager.Config config; + + internal int match_length; + + internal int prev_match; + + internal int match_available; + + internal int strstart; + + internal int match_start; + + internal int lookahead; + + internal int prev_length; + + internal CompressionLevel compressionLevel; + + internal CompressionStrategy compressionStrategy; + + internal short[] dyn_ltree; + + internal short[] dyn_dtree; + + internal short[] bl_tree; + + internal Tree treeLiterals = new Tree(); + + internal Tree treeDistances = new Tree(); + + internal Tree treeBitLengths = new Tree(); + + internal short[] bl_count = new short[InternalConstants.MAX_BITS + 1]; + + internal int[] heap = new int[2 * InternalConstants.L_CODES + 1]; + + internal int heap_len; + + internal int heap_max; + + internal sbyte[] depth = new sbyte[2 * InternalConstants.L_CODES + 1]; + + internal int _lengthOffset; + + internal int lit_bufsize; + + internal int last_lit; + + internal int _distanceOffset; + + internal int opt_len; + + internal int static_len; + + internal int matches; + + internal int last_eob_len; + + internal short bi_buf; + + internal int bi_valid; + + private bool Rfc1950BytesEmitted = false; + + private bool _WantRfc1950HeaderBytes = true; + + internal delegate BlockState CompressFunc(FlushType flush); + + internal class Config + { + internal int GoodLength; + + internal int MaxLazy; + + internal int NiceLength; + + internal int MaxChainLength; + + internal DeflateFlavor Flavor; + + private static readonly DeflateManager.Config[] Table = new DeflateManager.Config[] + { + new DeflateManager.Config(0, 0, 0, 0, DeflateFlavor.Store), + new DeflateManager.Config(4, 4, 8, 4, DeflateFlavor.Fast), + new DeflateManager.Config(4, 5, 16, 8, DeflateFlavor.Fast), + new DeflateManager.Config(4, 6, 32, 32, DeflateFlavor.Fast), + new DeflateManager.Config(4, 4, 16, 16, DeflateFlavor.Slow), + new DeflateManager.Config(8, 16, 32, 32, DeflateFlavor.Slow), + new DeflateManager.Config(8, 16, 128, 128, DeflateFlavor.Slow), + new DeflateManager.Config(8, 32, 128, 256, DeflateFlavor.Slow), + new DeflateManager.Config(32, 128, 258, 1024, DeflateFlavor.Slow), + new DeflateManager.Config(32, 258, 258, 4096, DeflateFlavor.Slow) + }; + + private Config(int goodLength, int maxLazy, int niceLength, int maxChainLength, DeflateFlavor flavor) + { + this.GoodLength = goodLength; + this.MaxLazy = maxLazy; + this.NiceLength = niceLength; + this.MaxChainLength = maxChainLength; + this.Flavor = flavor; + } + + public static DeflateManager.Config Lookup(CompressionLevel level) + { + return DeflateManager.Config.Table[(int)level]; + } + } + + internal DeflateManager() + { + this.dyn_ltree = new short[DeflateManager.HEAP_SIZE * 2]; + this.dyn_dtree = new short[(2 * InternalConstants.D_CODES + 1) * 2]; + this.bl_tree = new short[(2 * InternalConstants.BL_CODES + 1) * 2]; + } + + private void _InitializeLazyMatch(bool setDeflater) + { + this.window_size = 2 * this.w_size; + Array.Clear(this.head, 0, this.hash_size); + this.config = DeflateManager.Config.Lookup(this.compressionLevel); + if (setDeflater) + { + this.SetDeflater(); + } + this.strstart = 0; + this.block_start = 0; + this.lookahead = 0; + this.match_length = (this.prev_length = DeflateManager.MIN_MATCH - 1); + this.match_available = 0; + this.ins_h = 0; + } + + private void _InitializeTreeData() + { + this.treeLiterals.dyn_tree = this.dyn_ltree; + this.treeLiterals.staticTree = StaticTree.Literals; + this.treeDistances.dyn_tree = this.dyn_dtree; + this.treeDistances.staticTree = StaticTree.Distances; + this.treeBitLengths.dyn_tree = this.bl_tree; + this.treeBitLengths.staticTree = StaticTree.BitLengths; + this.bi_buf = 0; + this.bi_valid = 0; + this.last_eob_len = 8; + this._InitializeBlocks(); + } + + internal void _InitializeBlocks() + { + for (int i = 0; i < InternalConstants.L_CODES; i++) + { + this.dyn_ltree[i * 2] = 0; + } + for (int j = 0; j < InternalConstants.D_CODES; j++) + { + this.dyn_dtree[j * 2] = 0; + } + for (int k = 0; k < InternalConstants.BL_CODES; k++) + { + this.bl_tree[k * 2] = 0; + } + this.dyn_ltree[DeflateManager.END_BLOCK * 2] = 1; + this.opt_len = (this.static_len = 0); + this.last_lit = (this.matches = 0); + } + + internal void pqdownheap(short[] tree, int k) + { + int num = this.heap[k]; + for (int i = k << 1; i <= this.heap_len; i <<= 1) + { + bool flag = i < this.heap_len && DeflateManager._IsSmaller(tree, this.heap[i + 1], this.heap[i], this.depth); + if (flag) + { + i++; + } + bool flag2 = DeflateManager._IsSmaller(tree, num, this.heap[i], this.depth); + if (flag2) + { + break; + } + this.heap[k] = this.heap[i]; + k = i; + } + this.heap[k] = num; + } + + internal static bool _IsSmaller(short[] tree, int n, int m, sbyte[] depth) + { + short num = tree[n * 2]; + short num2 = tree[m * 2]; + return num < num2 || (num == num2 && depth[n] <= depth[m]); + } + + internal void scan_tree(short[] tree, int max_code) + { + int num = -1; + int num2 = (int)tree[1]; + int num3 = 0; + int num4 = 7; + int num5 = 4; + bool flag = num2 == 0; + if (flag) + { + num4 = 138; + num5 = 3; + } + tree[(max_code + 1) * 2 + 1] = short.MaxValue; + for (int i = 0; i <= max_code; i++) + { + int num6 = num2; + num2 = (int)tree[(i + 1) * 2 + 1]; + bool flag2 = ++num3 < num4 && num6 == num2; + if (!flag2) + { + bool flag3 = num3 < num5; + if (flag3) + { + this.bl_tree[num6 * 2] = (short)((int)this.bl_tree[num6 * 2] + num3); + } + else + { + bool flag4 = num6 != 0; + if (flag4) + { + bool flag5 = num6 != num; + if (flag5) + { + short[] array = this.bl_tree; + int num7 = num6 * 2; + array[num7] += 1; + } + short[] array2 = this.bl_tree; + int num8 = InternalConstants.REP_3_6 * 2; + array2[num8] += 1; + } + else + { + bool flag6 = num3 <= 10; + if (flag6) + { + short[] array3 = this.bl_tree; + int num9 = InternalConstants.REPZ_3_10 * 2; + array3[num9] += 1; + } + else + { + short[] array4 = this.bl_tree; + int num10 = InternalConstants.REPZ_11_138 * 2; + array4[num10] += 1; + } + } + } + num3 = 0; + num = num6; + bool flag7 = num2 == 0; + if (flag7) + { + num4 = 138; + num5 = 3; + } + else + { + bool flag8 = num6 == num2; + if (flag8) + { + num4 = 6; + num5 = 3; + } + else + { + num4 = 7; + num5 = 4; + } + } + } + } + } + + internal int build_bl_tree() + { + this.scan_tree(this.dyn_ltree, this.treeLiterals.max_code); + this.scan_tree(this.dyn_dtree, this.treeDistances.max_code); + this.treeBitLengths.build_tree(this); + int i; + for (i = InternalConstants.BL_CODES - 1; i >= 3; i--) + { + bool flag = this.bl_tree[(int)(Tree.bl_order[i] * 2 + 1)] != 0; + if (flag) + { + break; + } + } + this.opt_len += 3 * (i + 1) + 5 + 5 + 4; + return i; + } + + internal void send_all_trees(int lcodes, int dcodes, int blcodes) + { + this.send_bits(lcodes - 257, 5); + this.send_bits(dcodes - 1, 5); + this.send_bits(blcodes - 4, 4); + for (int i = 0; i < blcodes; i++) + { + this.send_bits((int)this.bl_tree[(int)(Tree.bl_order[i] * 2 + 1)], 3); + } + this.send_tree(this.dyn_ltree, lcodes - 1); + this.send_tree(this.dyn_dtree, dcodes - 1); + } + + internal void send_tree(short[] tree, int max_code) + { + int num = -1; + int num2 = (int)tree[1]; + int num3 = 0; + int num4 = 7; + int num5 = 4; + bool flag = num2 == 0; + if (flag) + { + num4 = 138; + num5 = 3; + } + for (int i = 0; i <= max_code; i++) + { + int num6 = num2; + num2 = (int)tree[(i + 1) * 2 + 1]; + bool flag2 = ++num3 < num4 && num6 == num2; + if (!flag2) + { + bool flag3 = num3 < num5; + if (flag3) + { + do + { + this.send_code(num6, this.bl_tree); + } + while (--num3 != 0); + } + else + { + bool flag4 = num6 != 0; + if (flag4) + { + bool flag5 = num6 != num; + if (flag5) + { + this.send_code(num6, this.bl_tree); + num3--; + } + this.send_code(InternalConstants.REP_3_6, this.bl_tree); + this.send_bits(num3 - 3, 2); + } + else + { + bool flag6 = num3 <= 10; + if (flag6) + { + this.send_code(InternalConstants.REPZ_3_10, this.bl_tree); + this.send_bits(num3 - 3, 3); + } + else + { + this.send_code(InternalConstants.REPZ_11_138, this.bl_tree); + this.send_bits(num3 - 11, 7); + } + } + } + num3 = 0; + num = num6; + bool flag7 = num2 == 0; + if (flag7) + { + num4 = 138; + num5 = 3; + } + else + { + bool flag8 = num6 == num2; + if (flag8) + { + num4 = 6; + num5 = 3; + } + else + { + num4 = 7; + num5 = 4; + } + } + } + } + } + + private void put_bytes(byte[] p, int start, int len) + { + Array.Copy(p, start, this.pending, this.pendingCount, len); + this.pendingCount += len; + } + + internal void send_code(int c, short[] tree) + { + int num = c * 2; + this.send_bits((int)tree[num] & 65535, (int)tree[num + 1] & 65535); + } + + internal void send_bits(int value, int length) + { + bool flag = this.bi_valid > DeflateManager.Buf_size - length; + if (flag) + { + this.bi_buf |= (short)(value << this.bi_valid & 65535); + byte[] array = this.pending; + int num = this.pendingCount; + this.pendingCount = num + 1; + array[num] = (byte)this.bi_buf; + byte[] array2 = this.pending; + num = this.pendingCount; + this.pendingCount = num + 1; + array2[num] = (byte)(this.bi_buf >> 8); + this.bi_buf = (short)((uint)value >> DeflateManager.Buf_size - this.bi_valid); + this.bi_valid += length - DeflateManager.Buf_size; + } + else + { + this.bi_buf |= (short)(value << this.bi_valid & 65535); + this.bi_valid += length; + } + } + + internal void _tr_align() + { + this.send_bits(DeflateManager.STATIC_TREES << 1, 3); + this.send_code(DeflateManager.END_BLOCK, StaticTree.lengthAndLiteralsTreeCodes); + this.bi_flush(); + bool flag = 1 + this.last_eob_len + 10 - this.bi_valid < 9; + if (flag) + { + this.send_bits(DeflateManager.STATIC_TREES << 1, 3); + this.send_code(DeflateManager.END_BLOCK, StaticTree.lengthAndLiteralsTreeCodes); + this.bi_flush(); + } + this.last_eob_len = 7; + } + + internal bool _tr_tally(int dist, int lc) + { + this.pending[this._distanceOffset + this.last_lit * 2] = (byte)((uint)dist >> 8); + this.pending[this._distanceOffset + this.last_lit * 2 + 1] = (byte)dist; + this.pending[this._lengthOffset + this.last_lit] = (byte)lc; + this.last_lit++; + bool flag = dist == 0; + if (flag) + { + short[] array = this.dyn_ltree; + int num = lc * 2; + array[num] += 1; + } + else + { + this.matches++; + dist--; + short[] array2 = this.dyn_ltree; + int num2 = ((int)Tree.LengthCode[lc] + InternalConstants.LITERALS + 1) * 2; + array2[num2] += 1; + short[] array3 = this.dyn_dtree; + int num3 = Tree.DistanceCode(dist) * 2; + array3[num3] += 1; + } + bool flag2 = (this.last_lit & 8191) == 0 && this.compressionLevel > CompressionLevel.Level2; + if (flag2) + { + int num4 = this.last_lit << 3; + int num5 = this.strstart - this.block_start; + for (int i = 0; i < InternalConstants.D_CODES; i++) + { + num4 = (int)((long)num4 + (long)this.dyn_dtree[i * 2] * (5L + (long)Tree.ExtraDistanceBits[i])); + } + num4 >>= 3; + bool flag3 = this.matches < this.last_lit / 2 && num4 < num5 / 2; + if (flag3) + { + return true; + } + } + return this.last_lit == this.lit_bufsize - 1 || this.last_lit == this.lit_bufsize; + } + + internal void send_compressed_block(short[] ltree, short[] dtree) + { + int num = 0; + bool flag = this.last_lit != 0; + if (flag) + { + do + { + int num2 = this._distanceOffset + num * 2; + int num3 = ((int)this.pending[num2] << 8 & 65280) | (int)(this.pending[num2 + 1] & byte.MaxValue); + int num4 = (int)(this.pending[this._lengthOffset + num] & byte.MaxValue); + num++; + bool flag2 = num3 == 0; + if (flag2) + { + this.send_code(num4, ltree); + } + else + { + int num5 = (int)Tree.LengthCode[num4]; + this.send_code(num5 + InternalConstants.LITERALS + 1, ltree); + int num6 = Tree.ExtraLengthBits[num5]; + bool flag3 = num6 != 0; + if (flag3) + { + num4 -= Tree.LengthBase[num5]; + this.send_bits(num4, num6); + } + num3--; + num5 = Tree.DistanceCode(num3); + this.send_code(num5, dtree); + num6 = Tree.ExtraDistanceBits[num5]; + bool flag4 = num6 != 0; + if (flag4) + { + num3 -= Tree.DistanceBase[num5]; + this.send_bits(num3, num6); + } + } + } + while (num < this.last_lit); + } + this.send_code(DeflateManager.END_BLOCK, ltree); + this.last_eob_len = (int)ltree[DeflateManager.END_BLOCK * 2 + 1]; + } + + internal void set_data_type() + { + int i = 0; + int num = 0; + int num2 = 0; + while (i < 7) + { + num2 += (int)this.dyn_ltree[i * 2]; + i++; + } + while (i < 128) + { + num += (int)this.dyn_ltree[i * 2]; + i++; + } + while (i < InternalConstants.LITERALS) + { + num2 += (int)this.dyn_ltree[i * 2]; + i++; + } + this.data_type = (sbyte)((num2 > num >> 2) ? DeflateManager.Z_BINARY : DeflateManager.Z_ASCII); + } + + internal void bi_flush() + { + bool flag = this.bi_valid == 16; + if (flag) + { + byte[] array = this.pending; + int num = this.pendingCount; + this.pendingCount = num + 1; + array[num] = (byte)this.bi_buf; + byte[] array2 = this.pending; + num = this.pendingCount; + this.pendingCount = num + 1; + array2[num] = (byte)(this.bi_buf >> 8); + this.bi_buf = 0; + this.bi_valid = 0; + } + else + { + bool flag2 = this.bi_valid >= 8; + if (flag2) + { + byte[] array3 = this.pending; + int num = this.pendingCount; + this.pendingCount = num + 1; + array3[num] = (byte)this.bi_buf; + this.bi_buf = (short)(this.bi_buf >> 8); + this.bi_valid -= 8; + } + } + } + + internal void bi_windup() + { + bool flag = this.bi_valid > 8; + if (flag) + { + byte[] array = this.pending; + int num = this.pendingCount; + this.pendingCount = num + 1; + array[num] = (byte)this.bi_buf; + byte[] array2 = this.pending; + num = this.pendingCount; + this.pendingCount = num + 1; + array2[num] = (byte)(this.bi_buf >> 8); + } + else + { + bool flag2 = this.bi_valid > 0; + if (flag2) + { + byte[] array3 = this.pending; + int num = this.pendingCount; + this.pendingCount = num + 1; + array3[num] = (byte)this.bi_buf; + } + } + this.bi_buf = 0; + this.bi_valid = 0; + } + + internal void copy_block(int buf, int len, bool header) + { + this.bi_windup(); + this.last_eob_len = 8; + if (header) + { + byte[] array = this.pending; + int num = this.pendingCount; + this.pendingCount = num + 1; + array[num] = (byte)len; + byte[] array2 = this.pending; + num = this.pendingCount; + this.pendingCount = num + 1; + array2[num] = (byte)(len >> 8); + byte[] array3 = this.pending; + num = this.pendingCount; + this.pendingCount = num + 1; + array3[num] = (byte)(~(byte)len); + byte[] array4 = this.pending; + num = this.pendingCount; + this.pendingCount = num + 1; + array4[num] = (byte)(~len >> 8); + } + this.put_bytes(this.window, buf, len); + } + + internal void flush_block_only(bool eof) + { + this._tr_flush_block((this.block_start >= 0) ? this.block_start : -1, this.strstart - this.block_start, eof); + this.block_start = this.strstart; + this._codec.flush_pending(); + } + + internal BlockState DeflateNone(FlushType flush) + { + int num = 65535; + bool flag = num > this.pending.Length - 5; + if (flag) + { + num = this.pending.Length - 5; + } + for (;;) + { + bool flag2 = this.lookahead <= 1; + if (flag2) + { + this._fillWindow(); + bool flag3 = this.lookahead == 0 && flush == FlushType.None; + if (flag3) + { + break; + } + bool flag4 = this.lookahead == 0; + if (flag4) + { + goto Block_5; + } + } + this.strstart += this.lookahead; + this.lookahead = 0; + int num2 = this.block_start + num; + bool flag5 = this.strstart == 0 || this.strstart >= num2; + if (flag5) + { + this.lookahead = this.strstart - num2; + this.strstart = num2; + this.flush_block_only(false); + bool flag6 = this._codec.AvailableBytesOut == 0; + if (flag6) + { + goto Block_8; + } + } + bool flag7 = this.strstart - this.block_start >= this.w_size - DeflateManager.MIN_LOOKAHEAD; + if (flag7) + { + this.flush_block_only(false); + bool flag8 = this._codec.AvailableBytesOut == 0; + if (flag8) + { + goto Block_10; + } + } + } + return BlockState.NeedMore; + Block_5: + this.flush_block_only(flush == FlushType.Finish); + bool flag9 = this._codec.AvailableBytesOut == 0; + if (flag9) + { + return (flush == FlushType.Finish) ? BlockState.FinishStarted : BlockState.NeedMore; + } + return (flush == FlushType.Finish) ? BlockState.FinishDone : BlockState.BlockDone; + Block_8: + return BlockState.NeedMore; + Block_10: + return BlockState.NeedMore; + } + + internal void _tr_stored_block(int buf, int stored_len, bool eof) + { + this.send_bits((DeflateManager.STORED_BLOCK << 1) + (eof ? 1 : 0), 3); + this.copy_block(buf, stored_len, true); + } + + internal void _tr_flush_block(int buf, int stored_len, bool eof) + { + int num = 0; + bool flag = this.compressionLevel > CompressionLevel.None; + int num2; + int num3; + if (flag) + { + bool flag2 = (int)this.data_type == DeflateManager.Z_UNKNOWN; + if (flag2) + { + this.set_data_type(); + } + this.treeLiterals.build_tree(this); + this.treeDistances.build_tree(this); + num = this.build_bl_tree(); + num2 = this.opt_len + 3 + 7 >> 3; + num3 = this.static_len + 3 + 7 >> 3; + bool flag3 = num3 <= num2; + if (flag3) + { + num2 = num3; + } + } + else + { + num3 = (num2 = stored_len + 5); + } + bool flag4 = stored_len + 4 <= num2 && buf != -1; + if (flag4) + { + this._tr_stored_block(buf, stored_len, eof); + } + else + { + bool flag5 = num3 == num2; + if (flag5) + { + this.send_bits((DeflateManager.STATIC_TREES << 1) + (eof ? 1 : 0), 3); + this.send_compressed_block(StaticTree.lengthAndLiteralsTreeCodes, StaticTree.distTreeCodes); + } + else + { + this.send_bits((DeflateManager.DYN_TREES << 1) + (eof ? 1 : 0), 3); + this.send_all_trees(this.treeLiterals.max_code + 1, this.treeDistances.max_code + 1, num + 1); + this.send_compressed_block(this.dyn_ltree, this.dyn_dtree); + } + } + this._InitializeBlocks(); + if (eof) + { + this.bi_windup(); + } + } + + private void _fillWindow() + { + do + { + int num = this.window_size - this.lookahead - this.strstart; + bool flag = num == 0 && this.strstart == 0 && this.lookahead == 0; + int num2; + if (flag) + { + num = this.w_size; + } + else + { + bool flag2 = num == -1; + if (flag2) + { + num--; + } + else + { + bool flag3 = this.strstart >= this.w_size + this.w_size - DeflateManager.MIN_LOOKAHEAD; + if (flag3) + { + Array.Copy(this.window, this.w_size, this.window, 0, this.w_size); + this.match_start -= this.w_size; + this.strstart -= this.w_size; + this.block_start -= this.w_size; + num2 = this.hash_size; + int num3 = num2; + do + { + int num4 = (int)this.head[--num3] & 65535; + this.head[num3] = (short)((num4 >= this.w_size) ? (num4 - this.w_size) : 0); + } + while (--num2 != 0); + num2 = this.w_size; + num3 = num2; + do + { + int num4 = (int)this.prev[--num3] & 65535; + this.prev[num3] = (short)((num4 >= this.w_size) ? (num4 - this.w_size) : 0); + } + while (--num2 != 0); + num += this.w_size; + } + } + } + bool flag4 = this._codec.AvailableBytesIn == 0; + if (flag4) + { + break; + } + num2 = this._codec.read_buf(this.window, this.strstart + this.lookahead, num); + this.lookahead += num2; + bool flag5 = this.lookahead >= DeflateManager.MIN_MATCH; + if (flag5) + { + this.ins_h = (int)(this.window[this.strstart] & byte.MaxValue); + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[this.strstart + 1] & byte.MaxValue)) & this.hash_mask); + } + } + while (this.lookahead < DeflateManager.MIN_LOOKAHEAD && this._codec.AvailableBytesIn != 0); + } + + internal BlockState DeflateFast(FlushType flush) + { + int num = 0; + for (;;) + { + bool flag = this.lookahead < DeflateManager.MIN_LOOKAHEAD; + if (flag) + { + this._fillWindow(); + bool flag2 = this.lookahead < DeflateManager.MIN_LOOKAHEAD && flush == FlushType.None; + if (flag2) + { + break; + } + bool flag3 = this.lookahead == 0; + if (flag3) + { + goto Block_4; + } + } + bool flag4 = this.lookahead >= DeflateManager.MIN_MATCH; + if (flag4) + { + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[this.strstart + (DeflateManager.MIN_MATCH - 1)] & byte.MaxValue)) & this.hash_mask); + num = ((int)this.head[this.ins_h] & 65535); + this.prev[this.strstart & this.w_mask] = this.head[this.ins_h]; + this.head[this.ins_h] = (short)this.strstart; + } + bool flag5 = (long)num != 0L && (this.strstart - num & 65535) <= this.w_size - DeflateManager.MIN_LOOKAHEAD; + if (flag5) + { + bool flag6 = this.compressionStrategy != CompressionStrategy.HuffmanOnly; + if (flag6) + { + this.match_length = this.longest_match(num); + } + } + bool flag7 = this.match_length >= DeflateManager.MIN_MATCH; + bool flag8; + if (flag7) + { + flag8 = this._tr_tally(this.strstart - this.match_start, this.match_length - DeflateManager.MIN_MATCH); + this.lookahead -= this.match_length; + bool flag9 = this.match_length <= this.config.MaxLazy && this.lookahead >= DeflateManager.MIN_MATCH; + if (flag9) + { + this.match_length--; + int num2; + do + { + this.strstart++; + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[this.strstart + (DeflateManager.MIN_MATCH - 1)] & byte.MaxValue)) & this.hash_mask); + num = ((int)this.head[this.ins_h] & 65535); + this.prev[this.strstart & this.w_mask] = this.head[this.ins_h]; + this.head[this.ins_h] = (short)this.strstart; + num2 = this.match_length - 1; + this.match_length = num2; + } + while (num2 != 0); + this.strstart++; + } + else + { + this.strstart += this.match_length; + this.match_length = 0; + this.ins_h = (int)(this.window[this.strstart] & byte.MaxValue); + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[this.strstart + 1] & byte.MaxValue)) & this.hash_mask); + } + } + else + { + flag8 = this._tr_tally(0, (int)(this.window[this.strstart] & byte.MaxValue)); + this.lookahead--; + this.strstart++; + } + bool flag10 = flag8; + if (flag10) + { + this.flush_block_only(false); + bool flag11 = this._codec.AvailableBytesOut == 0; + if (flag11) + { + goto Block_14; + } + } + } + return BlockState.NeedMore; + Block_4: + this.flush_block_only(flush == FlushType.Finish); + bool flag12 = this._codec.AvailableBytesOut == 0; + if (!flag12) + { + return (flush == FlushType.Finish) ? BlockState.FinishDone : BlockState.BlockDone; + } + bool flag13 = flush == FlushType.Finish; + if (flag13) + { + return BlockState.FinishStarted; + } + return BlockState.NeedMore; + Block_14: + return BlockState.NeedMore; + } + + internal BlockState DeflateSlow(FlushType flush) + { + int num = 0; + for (;;) + { + bool flag = this.lookahead < DeflateManager.MIN_LOOKAHEAD; + if (flag) + { + this._fillWindow(); + bool flag2 = this.lookahead < DeflateManager.MIN_LOOKAHEAD && flush == FlushType.None; + if (flag2) + { + break; + } + bool flag3 = this.lookahead == 0; + if (flag3) + { + goto Block_4; + } + } + bool flag4 = this.lookahead >= DeflateManager.MIN_MATCH; + if (flag4) + { + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[this.strstart + (DeflateManager.MIN_MATCH - 1)] & byte.MaxValue)) & this.hash_mask); + num = ((int)this.head[this.ins_h] & 65535); + this.prev[this.strstart & this.w_mask] = this.head[this.ins_h]; + this.head[this.ins_h] = (short)this.strstart; + } + this.prev_length = this.match_length; + this.prev_match = this.match_start; + this.match_length = DeflateManager.MIN_MATCH - 1; + bool flag5 = num != 0 && this.prev_length < this.config.MaxLazy && (this.strstart - num & 65535) <= this.w_size - DeflateManager.MIN_LOOKAHEAD; + if (flag5) + { + bool flag6 = this.compressionStrategy != CompressionStrategy.HuffmanOnly; + if (flag6) + { + this.match_length = this.longest_match(num); + } + bool flag7 = this.match_length <= 5 && (this.compressionStrategy == CompressionStrategy.Filtered || (this.match_length == DeflateManager.MIN_MATCH && this.strstart - this.match_start > 4096)); + if (flag7) + { + this.match_length = DeflateManager.MIN_MATCH - 1; + } + } + bool flag8 = this.prev_length >= DeflateManager.MIN_MATCH && this.match_length <= this.prev_length; + if (flag8) + { + int num2 = this.strstart + this.lookahead - DeflateManager.MIN_MATCH; + bool flag9 = this._tr_tally(this.strstart - 1 - this.prev_match, this.prev_length - DeflateManager.MIN_MATCH); + this.lookahead -= this.prev_length - 1; + this.prev_length -= 2; + int num3; + do + { + num3 = this.strstart + 1; + this.strstart = num3; + bool flag10 = num3 <= num2; + if (flag10) + { + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[this.strstart + (DeflateManager.MIN_MATCH - 1)] & byte.MaxValue)) & this.hash_mask); + num = ((int)this.head[this.ins_h] & 65535); + this.prev[this.strstart & this.w_mask] = this.head[this.ins_h]; + this.head[this.ins_h] = (short)this.strstart; + } + num3 = this.prev_length - 1; + this.prev_length = num3; + } + while (num3 != 0); + this.match_available = 0; + this.match_length = DeflateManager.MIN_MATCH - 1; + this.strstart++; + bool flag11 = flag9; + if (flag11) + { + this.flush_block_only(false); + bool flag12 = this._codec.AvailableBytesOut == 0; + if (flag12) + { + goto Block_19; + } + } + } + else + { + bool flag13 = this.match_available != 0; + if (flag13) + { + bool flag9 = this._tr_tally(0, (int)(this.window[this.strstart - 1] & byte.MaxValue)); + bool flag14 = flag9; + if (flag14) + { + this.flush_block_only(false); + } + this.strstart++; + this.lookahead--; + bool flag15 = this._codec.AvailableBytesOut == 0; + if (flag15) + { + goto Block_22; + } + } + else + { + this.match_available = 1; + this.strstart++; + this.lookahead--; + } + } + } + return BlockState.NeedMore; + Block_4: + bool flag16 = this.match_available != 0; + if (flag16) + { + bool flag9 = this._tr_tally(0, (int)(this.window[this.strstart - 1] & byte.MaxValue)); + this.match_available = 0; + } + this.flush_block_only(flush == FlushType.Finish); + bool flag17 = this._codec.AvailableBytesOut == 0; + if (!flag17) + { + return (flush == FlushType.Finish) ? BlockState.FinishDone : BlockState.BlockDone; + } + bool flag18 = flush == FlushType.Finish; + if (flag18) + { + return BlockState.FinishStarted; + } + return BlockState.NeedMore; + Block_19: + return BlockState.NeedMore; + Block_22: + return BlockState.NeedMore; + } + + internal int longest_match(int cur_match) + { + int num = this.config.MaxChainLength; + int num2 = this.strstart; + int num3 = this.prev_length; + int num4 = (this.strstart > this.w_size - DeflateManager.MIN_LOOKAHEAD) ? (this.strstart - (this.w_size - DeflateManager.MIN_LOOKAHEAD)) : 0; + int niceLength = this.config.NiceLength; + int num5 = this.w_mask; + int num6 = this.strstart + DeflateManager.MAX_MATCH; + byte b = this.window[num2 + num3 - 1]; + byte b2 = this.window[num2 + num3]; + bool flag = this.prev_length >= this.config.GoodLength; + if (flag) + { + num >>= 2; + } + bool flag2 = niceLength > this.lookahead; + if (flag2) + { + niceLength = this.lookahead; + } + do + { + int num7 = cur_match; + bool flag3 = this.window[num7 + num3] != b2 || this.window[num7 + num3 - 1] != b || this.window[num7] != this.window[num2] || this.window[++num7] != this.window[num2 + 1]; + if (!flag3) + { + num2 += 2; + num7++; + while (this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && this.window[++num2] == this.window[++num7] && num2 < num6) + { + } + int num8 = DeflateManager.MAX_MATCH - (num6 - num2); + num2 = num6 - DeflateManager.MAX_MATCH; + bool flag4 = num8 > num3; + if (flag4) + { + this.match_start = cur_match; + num3 = num8; + bool flag5 = num8 >= niceLength; + if (flag5) + { + break; + } + b = this.window[num2 + num3 - 1]; + b2 = this.window[num2 + num3]; + } + } + } + while ((cur_match = ((int)this.prev[cur_match & num5] & 65535)) > num4 && --num != 0); + bool flag6 = num3 <= this.lookahead; + int result; + if (flag6) + { + result = num3; + } + else + { + result = this.lookahead; + } + return result; + } + + internal int Initialize(ZlibCodec codec, CompressionLevel level) + { + return this.Initialize(codec, level, 15); + } + + internal int Initialize(ZlibCodec codec, CompressionLevel level, int bits) + { + return this.Initialize(codec, level, bits, DeflateManager.MEM_LEVEL_DEFAULT, CompressionStrategy.Default); + } + + internal int Initialize(ZlibCodec codec, CompressionLevel level, int bits, CompressionStrategy compressionStrategy) + { + return this.Initialize(codec, level, bits, DeflateManager.MEM_LEVEL_DEFAULT, compressionStrategy); + } + + internal int Initialize(ZlibCodec codec, CompressionLevel level, int windowBits, int memLevel, CompressionStrategy strategy) + { + this._codec = codec; + this._codec.Message = null; + bool flag = windowBits < 9 || windowBits > 15; + if (flag) + { + throw new ZlibException("windowBits must be in the range 9..15."); + } + bool flag2 = memLevel < 1 || memLevel > DeflateManager.MEM_LEVEL_MAX; + if (flag2) + { + throw new ZlibException(string.Format("memLevel must be in the range 1.. {0}", DeflateManager.MEM_LEVEL_MAX)); + } + this._codec.dstate = this; + this.w_bits = windowBits; + this.w_size = 1 << this.w_bits; + this.w_mask = this.w_size - 1; + this.hash_bits = memLevel + 7; + this.hash_size = 1 << this.hash_bits; + this.hash_mask = this.hash_size - 1; + this.hash_shift = (this.hash_bits + DeflateManager.MIN_MATCH - 1) / DeflateManager.MIN_MATCH; + this.window = new byte[this.w_size * 2]; + this.prev = new short[this.w_size]; + this.head = new short[this.hash_size]; + this.lit_bufsize = 1 << memLevel + 6; + this.pending = new byte[this.lit_bufsize * 4]; + this._distanceOffset = this.lit_bufsize; + this._lengthOffset = 3 * this.lit_bufsize; + this.compressionLevel = level; + this.compressionStrategy = strategy; + this.Reset(true); + return 0; + } + + internal void Reset(bool setDeflater = true) + { + this._codec.TotalBytesIn = (this._codec.TotalBytesOut = 0L); + this._codec.Message = null; + this.pendingCount = 0; + this.nextPending = 0; + this.Rfc1950BytesEmitted = false; + this.status = (this.WantRfc1950HeaderBytes ? DeflateManager.INIT_STATE : DeflateManager.BUSY_STATE); + this._codec._Adler32 = Adler.Adler32(0u, null, 0, 0); + this.last_flush = 0; + this._InitializeTreeData(); + this._InitializeLazyMatch(setDeflater); + } + + internal int End() + { + bool flag = this.status != DeflateManager.INIT_STATE && this.status != DeflateManager.BUSY_STATE && this.status != DeflateManager.FINISH_STATE; + int result; + if (flag) + { + result = -2; + } + else + { + this.pending = null; + this.head = null; + this.prev = null; + this.window = null; + result = ((this.status == DeflateManager.BUSY_STATE) ? -3 : 0); + } + return result; + } + + private void SetDeflater() + { + switch (this.config.Flavor) + { + case DeflateFlavor.Store: + this.DeflateFunction = new DeflateManager.CompressFunc(this.DeflateNone); + break; + case DeflateFlavor.Fast: + this.DeflateFunction = new DeflateManager.CompressFunc(this.DeflateFast); + break; + case DeflateFlavor.Slow: + this.DeflateFunction = new DeflateManager.CompressFunc(this.DeflateSlow); + break; + } + } + + internal int SetParams(CompressionLevel level, CompressionStrategy strategy) + { + int result = 0; + bool flag = this.compressionLevel != level; + if (flag) + { + DeflateManager.Config config = DeflateManager.Config.Lookup(level); + bool flag2 = config.Flavor != this.config.Flavor && this._codec.TotalBytesIn != 0L; + if (flag2) + { + result = this._codec.Deflate(FlushType.Partial); + } + this.compressionLevel = level; + this.config = config; + this.SetDeflater(); + } + this.compressionStrategy = strategy; + return result; + } + + internal int SetDictionary(byte[] dictionary) + { + int num = dictionary.Length; + int sourceIndex = 0; + bool flag = dictionary == null || this.status != DeflateManager.INIT_STATE; + if (flag) + { + throw new ZlibException("Stream error."); + } + this._codec._Adler32 = Adler.Adler32(this._codec._Adler32, dictionary, 0, dictionary.Length); + bool flag2 = num < DeflateManager.MIN_MATCH; + int result; + if (flag2) + { + result = 0; + } + else + { + bool flag3 = num > this.w_size - DeflateManager.MIN_LOOKAHEAD; + if (flag3) + { + num = this.w_size - DeflateManager.MIN_LOOKAHEAD; + sourceIndex = dictionary.Length - num; + } + Array.Copy(dictionary, sourceIndex, this.window, 0, num); + this.strstart = num; + this.block_start = num; + this.ins_h = (int)(this.window[0] & byte.MaxValue); + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[1] & byte.MaxValue)) & this.hash_mask); + for (int i = 0; i <= num - DeflateManager.MIN_MATCH; i++) + { + this.ins_h = ((this.ins_h << this.hash_shift ^ (int)(this.window[i + (DeflateManager.MIN_MATCH - 1)] & byte.MaxValue)) & this.hash_mask); + this.prev[i & this.w_mask] = this.head[this.ins_h]; + this.head[this.ins_h] = (short)i; + } + result = 0; + } + return result; + } + + internal int Deflate(FlushType flush) + { + bool flag = this._codec.OutputBuffer == null || (this._codec.InputBuffer == null && this._codec.AvailableBytesIn != 0) || (this.status == DeflateManager.FINISH_STATE && flush != FlushType.Finish); + if (flag) + { + this._codec.Message = DeflateManager._ErrorMessage[4]; + throw new ZlibException(string.Format("Something is fishy. [{0}]", this._codec.Message)); + } + bool flag2 = this._codec.AvailableBytesOut == 0; + if (flag2) + { + this._codec.Message = DeflateManager._ErrorMessage[7]; + throw new ZlibException("OutputBuffer is full (AvailableBytesOut == 0)"); + } + int num = this.last_flush; + this.last_flush = (int)flush; + bool flag3 = this.status == DeflateManager.INIT_STATE; + if (flag3) + { + int num2 = DeflateManager.Z_DEFLATED + (this.w_bits - 8 << 4) << 8; + int num3 = (this.compressionLevel - CompressionLevel.BestSpeed & 255) >> 1; + bool flag4 = num3 > 3; + if (flag4) + { + num3 = 3; + } + num2 |= num3 << 6; + bool flag5 = this.strstart != 0; + if (flag5) + { + num2 |= DeflateManager.PRESET_DICT; + } + num2 += 31 - num2 % 31; + this.status = DeflateManager.BUSY_STATE; + byte[] array = this.pending; + int num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array[num4] = (byte)(num2 >> 8); + byte[] array2 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array2[num4] = (byte)num2; + bool flag6 = this.strstart != 0; + if (flag6) + { + byte[] array3 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array3[num4] = (byte)((this._codec._Adler32 & 4278190080u) >> 24); + byte[] array4 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array4[num4] = (byte)((this._codec._Adler32 & 16711680u) >> 16); + byte[] array5 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array5[num4] = (byte)((this._codec._Adler32 & 65280u) >> 8); + byte[] array6 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array6[num4] = (byte)(this._codec._Adler32 & 255u); + } + this._codec._Adler32 = Adler.Adler32(0u, null, 0, 0); + } + bool flag7 = this.pendingCount != 0; + if (flag7) + { + this._codec.flush_pending(); + bool flag8 = this._codec.AvailableBytesOut == 0; + if (flag8) + { + this.last_flush = -1; + return 0; + } + } + else + { + bool flag9 = this._codec.AvailableBytesIn == 0 && flush <= (FlushType)num && flush != FlushType.Finish; + if (flag9) + { + return 0; + } + } + bool flag10 = this.status == DeflateManager.FINISH_STATE && this._codec.AvailableBytesIn != 0; + if (flag10) + { + this._codec.Message = DeflateManager._ErrorMessage[7]; + throw new ZlibException("status == FINISH_STATE && _codec.AvailableBytesIn != 0"); + } + bool flag11 = this._codec.AvailableBytesIn != 0 || this.lookahead != 0 || (flush != FlushType.None && this.status != DeflateManager.FINISH_STATE); + if (flag11) + { + BlockState blockState = this.DeflateFunction(flush); + bool flag12 = blockState == BlockState.FinishStarted || blockState == BlockState.FinishDone; + if (flag12) + { + this.status = DeflateManager.FINISH_STATE; + } + bool flag13 = blockState == BlockState.NeedMore || blockState == BlockState.FinishStarted; + if (flag13) + { + bool flag14 = this._codec.AvailableBytesOut == 0; + if (flag14) + { + this.last_flush = -1; + } + return 0; + } + bool flag15 = blockState == BlockState.BlockDone; + if (flag15) + { + bool flag16 = flush == FlushType.Partial; + if (flag16) + { + this._tr_align(); + } + else + { + this._tr_stored_block(0, 0, false); + bool flag17 = flush == FlushType.Full; + if (flag17) + { + for (int i = 0; i < this.hash_size; i++) + { + this.head[i] = 0; + } + } + } + this._codec.flush_pending(); + bool flag18 = this._codec.AvailableBytesOut == 0; + if (flag18) + { + this.last_flush = -1; + return 0; + } + } + } + bool flag19 = flush != FlushType.Finish; + int result; + if (flag19) + { + result = 0; + } + else + { + bool flag20 = !this.WantRfc1950HeaderBytes || this.Rfc1950BytesEmitted; + if (flag20) + { + result = 1; + } + else + { + byte[] array7 = this.pending; + int num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array7[num4] = (byte)((this._codec._Adler32 & 4278190080u) >> 24); + byte[] array8 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array8[num4] = (byte)((this._codec._Adler32 & 16711680u) >> 16); + byte[] array9 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array9[num4] = (byte)((this._codec._Adler32 & 65280u) >> 8); + byte[] array10 = this.pending; + num4 = this.pendingCount; + this.pendingCount = num4 + 1; + array10[num4] = (byte)(this._codec._Adler32 & 255u); + this._codec.flush_pending(); + this.Rfc1950BytesEmitted = true; + result = ((this.pendingCount != 0) ? 0 : 1); + } + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs.meta new file mode 100644 index 00000000..2d32be0f --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: db13ffaad66712c4baa5f1c47795cf6f +timeCreated: 1611465795 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs new file mode 100644 index 00000000..dd0e376b --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs @@ -0,0 +1,288 @@ +using System; +using System.IO; + +namespace Ionic.Zlib +{ + public class DeflateStream : Stream + { + public virtual FlushType FlushMode + { + get + { + return this._baseStream._flushMode; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + this._baseStream._flushMode = value; + } + } + + public int BufferSize + { + get + { + return this._baseStream._bufferSize; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + bool flag = this._baseStream._workingBuffer != null; + if (flag) + { + throw new ZlibException("The working buffer is already set."); + } + bool flag2 = value < 1024; + if (flag2) + { + throw new ZlibException(string.Format("Don't be silly. {0} bytes?? Use a bigger buffer, at least {1}.", value, 1024)); + } + this._baseStream._bufferSize = value; + } + } + + public CompressionStrategy Strategy + { + get + { + return this._baseStream.Strategy; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + this._baseStream.Strategy = value; + } + } + + public virtual long TotalIn + { + get + { + return this._baseStream._z.TotalBytesIn; + } + } + + public virtual long TotalOut + { + get + { + return this._baseStream._z.TotalBytesOut; + } + } + + public override bool CanRead + { + get + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + return this._baseStream._stream.CanRead; + } + } + + public override bool CanSeek + { + get + { + return false; + } + } + + public override bool CanWrite + { + get + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + return this._baseStream._stream.CanWrite; + } + } + + public override long Length + { + get + { + throw new NotImplementedException(); + } + } + + public override long Position + { + get + { + bool flag = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Writer; + long result; + if (flag) + { + result = this._baseStream._z.TotalBytesOut; + } + else + { + bool flag2 = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Reader; + if (flag2) + { + result = this._baseStream._z.TotalBytesIn; + } + else + { + result = 0L; + } + } + return result; + } + set + { + throw new NotImplementedException(); + } + } + + internal ZlibBaseStream _baseStream; + + internal Stream _innerStream; + + private bool _disposed; + + public DeflateStream(Stream stream, CompressionMode mode) : this(stream, mode, CompressionLevel.Default, false) + { + } + + public DeflateStream(Stream stream, CompressionMode mode, CompressionLevel level) : this(stream, mode, level, false) + { + } + + public DeflateStream(Stream stream, CompressionMode mode, bool leaveOpen) : this(stream, mode, CompressionLevel.Default, leaveOpen) + { + } + + public DeflateStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen) + { + this._innerStream = stream; + this._baseStream = new ZlibBaseStream(stream, mode, level, ZlibStreamFlavor.DEFLATE, leaveOpen); + } + + protected override void Dispose(bool disposing) + { + try + { + bool flag = !this._disposed; + if (flag) + { + bool flag2 = disposing && this._baseStream != null; + if (flag2) + { + this._baseStream.Close(); + } + this._disposed = true; + } + } + finally + { + base.Dispose(disposing); + } + } + + public override void Flush() + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + this._baseStream.Flush(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + return this._baseStream.Read(buffer, offset, count); + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotImplementedException(); + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("DeflateStream"); + } + this._baseStream.Write(buffer, offset, count); + } + + public static byte[] CompressString(string s) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + Stream compressor = new DeflateStream(memoryStream, CompressionMode.Compress, CompressionLevel.BestCompression); + ZlibBaseStream.CompressString(s, compressor); + result = memoryStream.ToArray(); + } + return result; + } + + public static byte[] CompressBuffer(byte[] b) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + Stream compressor = new DeflateStream(memoryStream, CompressionMode.Compress, CompressionLevel.BestCompression); + ZlibBaseStream.CompressBuffer(b, compressor); + result = memoryStream.ToArray(); + } + return result; + } + + public static string UncompressString(byte[] compressed) + { + string result; + using (MemoryStream memoryStream = new MemoryStream(compressed)) + { + Stream decompressor = new DeflateStream(memoryStream, CompressionMode.Decompress); + result = ZlibBaseStream.UncompressString(compressed, decompressor); + } + return result; + } + + public static byte[] UncompressBuffer(byte[] compressed) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream(compressed)) + { + Stream decompressor = new DeflateStream(memoryStream, CompressionMode.Decompress); + result = ZlibBaseStream.UncompressBuffer(compressed, decompressor); + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs.meta new file mode 100644 index 00000000..678c7dff --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/DeflateStream.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1da92ebd4261b12439b90a7f7113648b +timeCreated: 1611465298 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs new file mode 100644 index 00000000..e2a15cde --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs @@ -0,0 +1,13 @@ +using System; + +namespace Ionic.Zlib +{ + public enum FlushType + { + None, + Partial, + Sync, + Full, + Finish + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs.meta new file mode 100644 index 00000000..886a5ccb --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/FlushType.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bd1bbeb867267094990fb2e772b7caa0 +timeCreated: 1611465750 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs new file mode 100644 index 00000000..152ed425 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs @@ -0,0 +1,417 @@ +using System; +using System.IO; +using System.Text; + +namespace Ionic.Zlib +{ + public class GZipStream : Stream + { + public string Comment + { + get + { + return this._Comment; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + this._Comment = value; + } + } + + public string FileName + { + get + { + return this._FileName; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + this._FileName = value; + bool flag = this._FileName == null; + if (!flag) + { + bool flag2 = this._FileName.IndexOf("/") != -1; + if (flag2) + { + this._FileName = this._FileName.Replace("/", "\\"); + } + bool flag3 = this._FileName.EndsWith("\\"); + if (flag3) + { + throw new Exception("Illegal filename"); + } + bool flag4 = this._FileName.IndexOf("\\") != -1; + if (flag4) + { + this._FileName = Path.GetFileName(this._FileName); + } + } + } + } + + public int Crc32 + { + get + { + return this._Crc32; + } + } + + public virtual FlushType FlushMode + { + get + { + return this._baseStream._flushMode; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + this._baseStream._flushMode = value; + } + } + + public int BufferSize + { + get + { + return this._baseStream._bufferSize; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + bool flag = this._baseStream._workingBuffer != null; + if (flag) + { + throw new ZlibException("The working buffer is already set."); + } + bool flag2 = value < 1024; + if (flag2) + { + throw new ZlibException(string.Format("Don't be silly. {0} bytes?? Use a bigger buffer, at least {1}.", value, 1024)); + } + this._baseStream._bufferSize = value; + } + } + + public virtual long TotalIn + { + get + { + return this._baseStream._z.TotalBytesIn; + } + } + + public virtual long TotalOut + { + get + { + return this._baseStream._z.TotalBytesOut; + } + } + + public override bool CanRead + { + get + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + return this._baseStream._stream.CanRead; + } + } + + public override bool CanSeek + { + get + { + return false; + } + } + + public override bool CanWrite + { + get + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + return this._baseStream._stream.CanWrite; + } + } + + public override long Length + { + get + { + throw new NotImplementedException(); + } + } + + public override long Position + { + get + { + bool flag = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Writer; + long result; + if (flag) + { + result = this._baseStream._z.TotalBytesOut + (long)this._headerByteCount; + } + else + { + bool flag2 = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Reader; + if (flag2) + { + result = this._baseStream._z.TotalBytesIn + (long)this._baseStream._gzipHeaderByteCount; + } + else + { + result = 0L; + } + } + return result; + } + set + { + throw new NotImplementedException(); + } + } + + public DateTime? LastModified; + + private int _headerByteCount; + + internal ZlibBaseStream _baseStream; + + private bool _disposed; + + private bool _firstReadDone; + + private string _FileName; + + private string _Comment; + + private int _Crc32; + + internal static readonly DateTime _unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + + internal static readonly Encoding iso8859dash1 = Encoding.GetEncoding("iso-8859-1"); + + public GZipStream(Stream stream, CompressionMode mode) : this(stream, mode, CompressionLevel.Default, false) + { + } + + public GZipStream(Stream stream, CompressionMode mode, CompressionLevel level) : this(stream, mode, level, false) + { + } + + public GZipStream(Stream stream, CompressionMode mode, bool leaveOpen) : this(stream, mode, CompressionLevel.Default, leaveOpen) + { + } + + public GZipStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen) + { + this._baseStream = new ZlibBaseStream(stream, mode, level, ZlibStreamFlavor.GZIP, leaveOpen); + } + + protected override void Dispose(bool disposing) + { + try + { + bool flag = !this._disposed; + if (flag) + { + bool flag2 = disposing && this._baseStream != null; + if (flag2) + { + this._baseStream.Close(); + this._Crc32 = this._baseStream.Crc32; + } + this._disposed = true; + } + } + finally + { + base.Dispose(disposing); + } + } + + public override void Flush() + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + this._baseStream.Flush(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + int result = this._baseStream.Read(buffer, offset, count); + bool flag = !this._firstReadDone; + if (flag) + { + this._firstReadDone = true; + this.FileName = this._baseStream._GzipFileName; + this.Comment = this._baseStream._GzipComment; + } + return result; + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotImplementedException(); + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("GZipStream"); + } + bool flag = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Undefined; + if (flag) + { + bool wantCompress = this._baseStream._wantCompress; + if (!wantCompress) + { + throw new InvalidOperationException(); + } + this._headerByteCount = this.EmitHeader(); + } + this._baseStream.Write(buffer, offset, count); + } + + private int EmitHeader() + { + byte[] array = (this.Comment == null) ? null : GZipStream.iso8859dash1.GetBytes(this.Comment); + byte[] array2 = (this.FileName == null) ? null : GZipStream.iso8859dash1.GetBytes(this.FileName); + int num = (this.Comment == null) ? 0 : (array.Length + 1); + int num2 = (this.FileName == null) ? 0 : (array2.Length + 1); + int num3 = 10 + num + num2; + byte[] array3 = new byte[num3]; + int num4 = 0; + array3[num4++] = 31; + array3[num4++] = 139; + array3[num4++] = 8; + byte b = 0; + bool flag = this.Comment != null; + if (flag) + { + b ^= 16; + } + bool flag2 = this.FileName != null; + if (flag2) + { + b ^= 8; + } + array3[num4++] = b; + bool flag3 = this.LastModified == null; + if (flag3) + { + this.LastModified = new DateTime?(DateTime.Now); + } + int value = (int)(this.LastModified.Value - GZipStream._unixEpoch).TotalSeconds; + Array.Copy(BitConverter.GetBytes(value), 0, array3, num4, 4); + num4 += 4; + array3[num4++] = 0; + array3[num4++] = byte.MaxValue; + bool flag4 = num2 != 0; + if (flag4) + { + Array.Copy(array2, 0, array3, num4, num2 - 1); + num4 += num2 - 1; + array3[num4++] = 0; + } + bool flag5 = num != 0; + if (flag5) + { + Array.Copy(array, 0, array3, num4, num - 1); + num4 += num - 1; + array3[num4++] = 0; + } + this._baseStream._stream.Write(array3, 0, array3.Length); + return array3.Length; + } + + public static byte[] CompressString(string s) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + Stream compressor = new GZipStream(memoryStream, CompressionMode.Compress, CompressionLevel.BestCompression); + ZlibBaseStream.CompressString(s, compressor); + result = memoryStream.ToArray(); + } + return result; + } + + public static byte[] CompressBuffer(byte[] b) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + Stream compressor = new GZipStream(memoryStream, CompressionMode.Compress, CompressionLevel.BestCompression); + ZlibBaseStream.CompressBuffer(b, compressor); + result = memoryStream.ToArray(); + } + return result; + } + + public static string UncompressString(byte[] compressed) + { + string result; + using (MemoryStream memoryStream = new MemoryStream(compressed)) + { + Stream decompressor = new GZipStream(memoryStream, CompressionMode.Decompress); + result = ZlibBaseStream.UncompressString(compressed, decompressor); + } + return result; + } + + public static byte[] UncompressBuffer(byte[] compressed) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream(compressed)) + { + Stream decompressor = new GZipStream(memoryStream, CompressionMode.Decompress); + result = ZlibBaseStream.UncompressBuffer(compressed, decompressor); + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs.meta new file mode 100644 index 00000000..1d1d796a --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/GZipStream.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4c51a6dee7c0f4f4791e8af61fa83c32 +timeCreated: 1611465641 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs new file mode 100644 index 00000000..e6368120 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs @@ -0,0 +1,2154 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class InfTree + { + private const int MANY = 1440; + + private const int Z_OK = 0; + + private const int Z_STREAM_END = 1; + + private const int Z_NEED_DICT = 2; + + private const int Z_ERRNO = -1; + + private const int Z_STREAM_ERROR = -2; + + private const int Z_DATA_ERROR = -3; + + private const int Z_MEM_ERROR = -4; + + private const int Z_BUF_ERROR = -5; + + private const int Z_VERSION_ERROR = -6; + + internal const int fixed_bl = 9; + + internal const int fixed_bd = 5; + + internal static readonly int[] fixed_tl = new int[] + { + 96, + 7, + 256, + 0, + 8, + 80, + 0, + 8, + 16, + 84, + 8, + 115, + 82, + 7, + 31, + 0, + 8, + 112, + 0, + 8, + 48, + 0, + 9, + 192, + 80, + 7, + 10, + 0, + 8, + 96, + 0, + 8, + 32, + 0, + 9, + 160, + 0, + 8, + 0, + 0, + 8, + 128, + 0, + 8, + 64, + 0, + 9, + 224, + 80, + 7, + 6, + 0, + 8, + 88, + 0, + 8, + 24, + 0, + 9, + 144, + 83, + 7, + 59, + 0, + 8, + 120, + 0, + 8, + 56, + 0, + 9, + 208, + 81, + 7, + 17, + 0, + 8, + 104, + 0, + 8, + 40, + 0, + 9, + 176, + 0, + 8, + 8, + 0, + 8, + 136, + 0, + 8, + 72, + 0, + 9, + 240, + 80, + 7, + 4, + 0, + 8, + 84, + 0, + 8, + 20, + 85, + 8, + 227, + 83, + 7, + 43, + 0, + 8, + 116, + 0, + 8, + 52, + 0, + 9, + 200, + 81, + 7, + 13, + 0, + 8, + 100, + 0, + 8, + 36, + 0, + 9, + 168, + 0, + 8, + 4, + 0, + 8, + 132, + 0, + 8, + 68, + 0, + 9, + 232, + 80, + 7, + 8, + 0, + 8, + 92, + 0, + 8, + 28, + 0, + 9, + 152, + 84, + 7, + 83, + 0, + 8, + 124, + 0, + 8, + 60, + 0, + 9, + 216, + 82, + 7, + 23, + 0, + 8, + 108, + 0, + 8, + 44, + 0, + 9, + 184, + 0, + 8, + 12, + 0, + 8, + 140, + 0, + 8, + 76, + 0, + 9, + 248, + 80, + 7, + 3, + 0, + 8, + 82, + 0, + 8, + 18, + 85, + 8, + 163, + 83, + 7, + 35, + 0, + 8, + 114, + 0, + 8, + 50, + 0, + 9, + 196, + 81, + 7, + 11, + 0, + 8, + 98, + 0, + 8, + 34, + 0, + 9, + 164, + 0, + 8, + 2, + 0, + 8, + 130, + 0, + 8, + 66, + 0, + 9, + 228, + 80, + 7, + 7, + 0, + 8, + 90, + 0, + 8, + 26, + 0, + 9, + 148, + 84, + 7, + 67, + 0, + 8, + 122, + 0, + 8, + 58, + 0, + 9, + 212, + 82, + 7, + 19, + 0, + 8, + 106, + 0, + 8, + 42, + 0, + 9, + 180, + 0, + 8, + 10, + 0, + 8, + 138, + 0, + 8, + 74, + 0, + 9, + 244, + 80, + 7, + 5, + 0, + 8, + 86, + 0, + 8, + 22, + 192, + 8, + 0, + 83, + 7, + 51, + 0, + 8, + 118, + 0, + 8, + 54, + 0, + 9, + 204, + 81, + 7, + 15, + 0, + 8, + 102, + 0, + 8, + 38, + 0, + 9, + 172, + 0, + 8, + 6, + 0, + 8, + 134, + 0, + 8, + 70, + 0, + 9, + 236, + 80, + 7, + 9, + 0, + 8, + 94, + 0, + 8, + 30, + 0, + 9, + 156, + 84, + 7, + 99, + 0, + 8, + 126, + 0, + 8, + 62, + 0, + 9, + 220, + 82, + 7, + 27, + 0, + 8, + 110, + 0, + 8, + 46, + 0, + 9, + 188, + 0, + 8, + 14, + 0, + 8, + 142, + 0, + 8, + 78, + 0, + 9, + 252, + 96, + 7, + 256, + 0, + 8, + 81, + 0, + 8, + 17, + 85, + 8, + 131, + 82, + 7, + 31, + 0, + 8, + 113, + 0, + 8, + 49, + 0, + 9, + 194, + 80, + 7, + 10, + 0, + 8, + 97, + 0, + 8, + 33, + 0, + 9, + 162, + 0, + 8, + 1, + 0, + 8, + 129, + 0, + 8, + 65, + 0, + 9, + 226, + 80, + 7, + 6, + 0, + 8, + 89, + 0, + 8, + 25, + 0, + 9, + 146, + 83, + 7, + 59, + 0, + 8, + 121, + 0, + 8, + 57, + 0, + 9, + 210, + 81, + 7, + 17, + 0, + 8, + 105, + 0, + 8, + 41, + 0, + 9, + 178, + 0, + 8, + 9, + 0, + 8, + 137, + 0, + 8, + 73, + 0, + 9, + 242, + 80, + 7, + 4, + 0, + 8, + 85, + 0, + 8, + 21, + 80, + 8, + 258, + 83, + 7, + 43, + 0, + 8, + 117, + 0, + 8, + 53, + 0, + 9, + 202, + 81, + 7, + 13, + 0, + 8, + 101, + 0, + 8, + 37, + 0, + 9, + 170, + 0, + 8, + 5, + 0, + 8, + 133, + 0, + 8, + 69, + 0, + 9, + 234, + 80, + 7, + 8, + 0, + 8, + 93, + 0, + 8, + 29, + 0, + 9, + 154, + 84, + 7, + 83, + 0, + 8, + 125, + 0, + 8, + 61, + 0, + 9, + 218, + 82, + 7, + 23, + 0, + 8, + 109, + 0, + 8, + 45, + 0, + 9, + 186, + 0, + 8, + 13, + 0, + 8, + 141, + 0, + 8, + 77, + 0, + 9, + 250, + 80, + 7, + 3, + 0, + 8, + 83, + 0, + 8, + 19, + 85, + 8, + 195, + 83, + 7, + 35, + 0, + 8, + 115, + 0, + 8, + 51, + 0, + 9, + 198, + 81, + 7, + 11, + 0, + 8, + 99, + 0, + 8, + 35, + 0, + 9, + 166, + 0, + 8, + 3, + 0, + 8, + 131, + 0, + 8, + 67, + 0, + 9, + 230, + 80, + 7, + 7, + 0, + 8, + 91, + 0, + 8, + 27, + 0, + 9, + 150, + 84, + 7, + 67, + 0, + 8, + 123, + 0, + 8, + 59, + 0, + 9, + 214, + 82, + 7, + 19, + 0, + 8, + 107, + 0, + 8, + 43, + 0, + 9, + 182, + 0, + 8, + 11, + 0, + 8, + 139, + 0, + 8, + 75, + 0, + 9, + 246, + 80, + 7, + 5, + 0, + 8, + 87, + 0, + 8, + 23, + 192, + 8, + 0, + 83, + 7, + 51, + 0, + 8, + 119, + 0, + 8, + 55, + 0, + 9, + 206, + 81, + 7, + 15, + 0, + 8, + 103, + 0, + 8, + 39, + 0, + 9, + 174, + 0, + 8, + 7, + 0, + 8, + 135, + 0, + 8, + 71, + 0, + 9, + 238, + 80, + 7, + 9, + 0, + 8, + 95, + 0, + 8, + 31, + 0, + 9, + 158, + 84, + 7, + 99, + 0, + 8, + 127, + 0, + 8, + 63, + 0, + 9, + 222, + 82, + 7, + 27, + 0, + 8, + 111, + 0, + 8, + 47, + 0, + 9, + 190, + 0, + 8, + 15, + 0, + 8, + 143, + 0, + 8, + 79, + 0, + 9, + 254, + 96, + 7, + 256, + 0, + 8, + 80, + 0, + 8, + 16, + 84, + 8, + 115, + 82, + 7, + 31, + 0, + 8, + 112, + 0, + 8, + 48, + 0, + 9, + 193, + 80, + 7, + 10, + 0, + 8, + 96, + 0, + 8, + 32, + 0, + 9, + 161, + 0, + 8, + 0, + 0, + 8, + 128, + 0, + 8, + 64, + 0, + 9, + 225, + 80, + 7, + 6, + 0, + 8, + 88, + 0, + 8, + 24, + 0, + 9, + 145, + 83, + 7, + 59, + 0, + 8, + 120, + 0, + 8, + 56, + 0, + 9, + 209, + 81, + 7, + 17, + 0, + 8, + 104, + 0, + 8, + 40, + 0, + 9, + 177, + 0, + 8, + 8, + 0, + 8, + 136, + 0, + 8, + 72, + 0, + 9, + 241, + 80, + 7, + 4, + 0, + 8, + 84, + 0, + 8, + 20, + 85, + 8, + 227, + 83, + 7, + 43, + 0, + 8, + 116, + 0, + 8, + 52, + 0, + 9, + 201, + 81, + 7, + 13, + 0, + 8, + 100, + 0, + 8, + 36, + 0, + 9, + 169, + 0, + 8, + 4, + 0, + 8, + 132, + 0, + 8, + 68, + 0, + 9, + 233, + 80, + 7, + 8, + 0, + 8, + 92, + 0, + 8, + 28, + 0, + 9, + 153, + 84, + 7, + 83, + 0, + 8, + 124, + 0, + 8, + 60, + 0, + 9, + 217, + 82, + 7, + 23, + 0, + 8, + 108, + 0, + 8, + 44, + 0, + 9, + 185, + 0, + 8, + 12, + 0, + 8, + 140, + 0, + 8, + 76, + 0, + 9, + 249, + 80, + 7, + 3, + 0, + 8, + 82, + 0, + 8, + 18, + 85, + 8, + 163, + 83, + 7, + 35, + 0, + 8, + 114, + 0, + 8, + 50, + 0, + 9, + 197, + 81, + 7, + 11, + 0, + 8, + 98, + 0, + 8, + 34, + 0, + 9, + 165, + 0, + 8, + 2, + 0, + 8, + 130, + 0, + 8, + 66, + 0, + 9, + 229, + 80, + 7, + 7, + 0, + 8, + 90, + 0, + 8, + 26, + 0, + 9, + 149, + 84, + 7, + 67, + 0, + 8, + 122, + 0, + 8, + 58, + 0, + 9, + 213, + 82, + 7, + 19, + 0, + 8, + 106, + 0, + 8, + 42, + 0, + 9, + 181, + 0, + 8, + 10, + 0, + 8, + 138, + 0, + 8, + 74, + 0, + 9, + 245, + 80, + 7, + 5, + 0, + 8, + 86, + 0, + 8, + 22, + 192, + 8, + 0, + 83, + 7, + 51, + 0, + 8, + 118, + 0, + 8, + 54, + 0, + 9, + 205, + 81, + 7, + 15, + 0, + 8, + 102, + 0, + 8, + 38, + 0, + 9, + 173, + 0, + 8, + 6, + 0, + 8, + 134, + 0, + 8, + 70, + 0, + 9, + 237, + 80, + 7, + 9, + 0, + 8, + 94, + 0, + 8, + 30, + 0, + 9, + 157, + 84, + 7, + 99, + 0, + 8, + 126, + 0, + 8, + 62, + 0, + 9, + 221, + 82, + 7, + 27, + 0, + 8, + 110, + 0, + 8, + 46, + 0, + 9, + 189, + 0, + 8, + 14, + 0, + 8, + 142, + 0, + 8, + 78, + 0, + 9, + 253, + 96, + 7, + 256, + 0, + 8, + 81, + 0, + 8, + 17, + 85, + 8, + 131, + 82, + 7, + 31, + 0, + 8, + 113, + 0, + 8, + 49, + 0, + 9, + 195, + 80, + 7, + 10, + 0, + 8, + 97, + 0, + 8, + 33, + 0, + 9, + 163, + 0, + 8, + 1, + 0, + 8, + 129, + 0, + 8, + 65, + 0, + 9, + 227, + 80, + 7, + 6, + 0, + 8, + 89, + 0, + 8, + 25, + 0, + 9, + 147, + 83, + 7, + 59, + 0, + 8, + 121, + 0, + 8, + 57, + 0, + 9, + 211, + 81, + 7, + 17, + 0, + 8, + 105, + 0, + 8, + 41, + 0, + 9, + 179, + 0, + 8, + 9, + 0, + 8, + 137, + 0, + 8, + 73, + 0, + 9, + 243, + 80, + 7, + 4, + 0, + 8, + 85, + 0, + 8, + 21, + 80, + 8, + 258, + 83, + 7, + 43, + 0, + 8, + 117, + 0, + 8, + 53, + 0, + 9, + 203, + 81, + 7, + 13, + 0, + 8, + 101, + 0, + 8, + 37, + 0, + 9, + 171, + 0, + 8, + 5, + 0, + 8, + 133, + 0, + 8, + 69, + 0, + 9, + 235, + 80, + 7, + 8, + 0, + 8, + 93, + 0, + 8, + 29, + 0, + 9, + 155, + 84, + 7, + 83, + 0, + 8, + 125, + 0, + 8, + 61, + 0, + 9, + 219, + 82, + 7, + 23, + 0, + 8, + 109, + 0, + 8, + 45, + 0, + 9, + 187, + 0, + 8, + 13, + 0, + 8, + 141, + 0, + 8, + 77, + 0, + 9, + 251, + 80, + 7, + 3, + 0, + 8, + 83, + 0, + 8, + 19, + 85, + 8, + 195, + 83, + 7, + 35, + 0, + 8, + 115, + 0, + 8, + 51, + 0, + 9, + 199, + 81, + 7, + 11, + 0, + 8, + 99, + 0, + 8, + 35, + 0, + 9, + 167, + 0, + 8, + 3, + 0, + 8, + 131, + 0, + 8, + 67, + 0, + 9, + 231, + 80, + 7, + 7, + 0, + 8, + 91, + 0, + 8, + 27, + 0, + 9, + 151, + 84, + 7, + 67, + 0, + 8, + 123, + 0, + 8, + 59, + 0, + 9, + 215, + 82, + 7, + 19, + 0, + 8, + 107, + 0, + 8, + 43, + 0, + 9, + 183, + 0, + 8, + 11, + 0, + 8, + 139, + 0, + 8, + 75, + 0, + 9, + 247, + 80, + 7, + 5, + 0, + 8, + 87, + 0, + 8, + 23, + 192, + 8, + 0, + 83, + 7, + 51, + 0, + 8, + 119, + 0, + 8, + 55, + 0, + 9, + 207, + 81, + 7, + 15, + 0, + 8, + 103, + 0, + 8, + 39, + 0, + 9, + 175, + 0, + 8, + 7, + 0, + 8, + 135, + 0, + 8, + 71, + 0, + 9, + 239, + 80, + 7, + 9, + 0, + 8, + 95, + 0, + 8, + 31, + 0, + 9, + 159, + 84, + 7, + 99, + 0, + 8, + 127, + 0, + 8, + 63, + 0, + 9, + 223, + 82, + 7, + 27, + 0, + 8, + 111, + 0, + 8, + 47, + 0, + 9, + 191, + 0, + 8, + 15, + 0, + 8, + 143, + 0, + 8, + 79, + 0, + 9, + 255 + }; + + internal static readonly int[] fixed_td = new int[] + { + 80, + 5, + 1, + 87, + 5, + 257, + 83, + 5, + 17, + 91, + 5, + 4097, + 81, + 5, + 5, + 89, + 5, + 1025, + 85, + 5, + 65, + 93, + 5, + 16385, + 80, + 5, + 3, + 88, + 5, + 513, + 84, + 5, + 33, + 92, + 5, + 8193, + 82, + 5, + 9, + 90, + 5, + 2049, + 86, + 5, + 129, + 192, + 5, + 24577, + 80, + 5, + 2, + 87, + 5, + 385, + 83, + 5, + 25, + 91, + 5, + 6145, + 81, + 5, + 7, + 89, + 5, + 1537, + 85, + 5, + 97, + 93, + 5, + 24577, + 80, + 5, + 4, + 88, + 5, + 769, + 84, + 5, + 49, + 92, + 5, + 12289, + 82, + 5, + 13, + 90, + 5, + 3073, + 86, + 5, + 193, + 192, + 5, + 24577 + }; + + internal static readonly int[] cplens = new int[] + { + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 13, + 15, + 17, + 19, + 23, + 27, + 31, + 35, + 43, + 51, + 59, + 67, + 83, + 99, + 115, + 131, + 163, + 195, + 227, + 258, + 0, + 0 + }; + + internal static readonly int[] cplext = new int[] + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 4, + 5, + 5, + 5, + 5, + 0, + 112, + 112 + }; + + internal static readonly int[] cpdist = new int[] + { + 1, + 2, + 3, + 4, + 5, + 7, + 9, + 13, + 17, + 25, + 33, + 49, + 65, + 97, + 129, + 193, + 257, + 385, + 513, + 769, + 1025, + 1537, + 2049, + 3073, + 4097, + 6145, + 8193, + 12289, + 16385, + 24577 + }; + + internal static readonly int[] cpdext = new int[] + { + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5, + 6, + 6, + 7, + 7, + 8, + 8, + 9, + 9, + 10, + 10, + 11, + 11, + 12, + 12, + 13, + 13 + }; + + internal const int BMAX = 15; + + internal int[] hn = null; + + internal int[] v = null; + + internal int[] c = null; + + internal int[] r = null; + + internal int[] u = null; + + internal int[] x = null; + + private int huft_build(int[] b, int bindex, int n, int s, int[] d, int[] e, int[] t, int[] m, int[] hp, int[] hn, int[] v) + { + int num = 0; + int i = n; + do + { + this.c[b[bindex + num]]++; + num++; + i--; + } + while (i != 0); + bool flag = this.c[0] == n; + int result; + if (flag) + { + t[0] = -1; + m[0] = 0; + result = 0; + } + else + { + int num2 = m[0]; + int j; + for (j = 1; j <= 15; j++) + { + bool flag2 = this.c[j] != 0; + if (flag2) + { + break; + } + } + int k = j; + bool flag3 = num2 < j; + if (flag3) + { + num2 = j; + } + for (i = 15; i != 0; i--) + { + bool flag4 = this.c[i] != 0; + if (flag4) + { + break; + } + } + int num3 = i; + bool flag5 = num2 > i; + if (flag5) + { + num2 = i; + } + m[0] = num2; + int num4 = 1 << j; + while (j < i) + { + bool flag6 = (num4 -= this.c[j]) < 0; + if (flag6) + { + return -3; + } + j++; + num4 <<= 1; + } + bool flag7 = (num4 -= this.c[i]) < 0; + if (flag7) + { + result = -3; + } + else + { + this.c[i] += num4; + j = (this.x[1] = 0); + num = 1; + int num5 = 2; + while (--i != 0) + { + j = (this.x[num5] = j + this.c[num]); + num5++; + num++; + } + i = 0; + num = 0; + do + { + bool flag8 = (j = b[bindex + num]) != 0; + if (flag8) + { + int[] array = this.x; + int num6 = j; + int num7 = array[num6]; + array[num6] = num7 + 1; + v[num7] = i; + } + num++; + } + while (++i < n); + n = this.x[num3]; + i = (this.x[0] = 0); + num = 0; + int num8 = -1; + int num9 = -num2; + this.u[0] = 0; + int num10 = 0; + int num11 = 0; + while (k <= num3) + { + int num12 = this.c[k]; + while (num12-- != 0) + { + int num13; + while (k > num9 + num2) + { + num8++; + num9 += num2; + num11 = num3 - num9; + num11 = ((num11 > num2) ? num2 : num11); + bool flag9 = (num13 = 1 << ((j = k - num9) & 31)) > num12 + 1; + if (flag9) + { + num13 -= num12 + 1; + num5 = k; + bool flag10 = j < num11; + if (flag10) + { + while (++j < num11) + { + bool flag11 = (num13 <<= 1) <= this.c[++num5]; + if (flag11) + { + break; + } + num13 -= this.c[num5]; + } + } + } + num11 = 1 << j; + bool flag12 = hn[0] + num11 > 1440; + if (flag12) + { + return -3; + } + num10 = (this.u[num8] = hn[0]); + hn[0] += num11; + bool flag13 = num8 != 0; + if (flag13) + { + this.x[num8] = i; + this.r[0] = (int)((sbyte)j); + this.r[1] = (int)((sbyte)num2); + j = SharedUtils.URShift(i, num9 - num2); + this.r[2] = num10 - this.u[num8 - 1] - j; + Array.Copy(this.r, 0, hp, (this.u[num8 - 1] + j) * 3, 3); + } + else + { + t[0] = num10; + } + } + this.r[1] = (int)((sbyte)(k - num9)); + bool flag14 = num >= n; + if (flag14) + { + this.r[0] = 192; + } + else + { + bool flag15 = v[num] < s; + if (flag15) + { + this.r[0] = (int)((v[num] < 256) ? 0 : 96); + this.r[2] = v[num++]; + } + else + { + this.r[0] = (int)((sbyte)(e[v[num] - s] + 16 + 64)); + this.r[2] = d[v[num++] - s]; + } + } + num13 = 1 << k - num9; + for (j = SharedUtils.URShift(i, num9); j < num11; j += num13) + { + Array.Copy(this.r, 0, hp, (num10 + j) * 3, 3); + } + j = 1 << k - 1; + while ((i & j) != 0) + { + i ^= j; + j = SharedUtils.URShift(j, 1); + } + i ^= j; + int num14 = (1 << num9) - 1; + while ((i & num14) != this.x[num8]) + { + num8--; + num9 -= num2; + num14 = (1 << num9) - 1; + } + } + k++; + } + result = ((num4 != 0 && num3 != 1) ? -5 : 0); + } + } + return result; + } + + internal int inflate_trees_bits(int[] c, int[] bb, int[] tb, int[] hp, ZlibCodec z) + { + this.initWorkArea(19); + this.hn[0] = 0; + int num = this.huft_build(c, 0, 19, 19, null, null, tb, bb, hp, this.hn, this.v); + bool flag = num == -3; + if (flag) + { + z.Message = "oversubscribed dynamic bit lengths tree"; + } + else + { + bool flag2 = num == -5 || bb[0] == 0; + if (flag2) + { + z.Message = "incomplete dynamic bit lengths tree"; + num = -3; + } + } + return num; + } + + internal int inflate_trees_dynamic(int nl, int nd, int[] c, int[] bl, int[] bd, int[] tl, int[] td, int[] hp, ZlibCodec z) + { + this.initWorkArea(288); + this.hn[0] = 0; + int num = this.huft_build(c, 0, nl, 257, InfTree.cplens, InfTree.cplext, tl, bl, hp, this.hn, this.v); + bool flag = num != 0 || bl[0] == 0; + int result; + if (flag) + { + bool flag2 = num == -3; + if (flag2) + { + z.Message = "oversubscribed literal/length tree"; + } + else + { + bool flag3 = num != -4; + if (flag3) + { + z.Message = "incomplete literal/length tree"; + num = -3; + } + } + result = num; + } + else + { + this.initWorkArea(288); + num = this.huft_build(c, nl, nd, 0, InfTree.cpdist, InfTree.cpdext, td, bd, hp, this.hn, this.v); + bool flag4 = num != 0 || (bd[0] == 0 && nl > 257); + if (flag4) + { + bool flag5 = num == -3; + if (flag5) + { + z.Message = "oversubscribed distance tree"; + } + else + { + bool flag6 = num == -5; + if (flag6) + { + z.Message = "incomplete distance tree"; + num = -3; + } + else + { + bool flag7 = num != -4; + if (flag7) + { + z.Message = "empty distance tree with lengths"; + num = -3; + } + } + } + result = num; + } + else + { + result = 0; + } + } + return result; + } + + internal static int inflate_trees_fixed(int[] bl, int[] bd, int[][] tl, int[][] td, ZlibCodec z) + { + bl[0] = 9; + bd[0] = 5; + tl[0] = InfTree.fixed_tl; + td[0] = InfTree.fixed_td; + return 0; + } + + private void initWorkArea(int vsize) + { + bool flag = this.hn == null; + if (flag) + { + this.hn = new int[1]; + this.v = new int[vsize]; + this.c = new int[16]; + this.r = new int[3]; + this.u = new int[15]; + this.x = new int[16]; + } + else + { + bool flag2 = this.v.Length < vsize; + if (flag2) + { + this.v = new int[vsize]; + } + Array.Clear(this.v, 0, vsize); + Array.Clear(this.c, 0, 16); + this.r[0] = 0; + this.r[1] = 0; + this.r[2] = 0; + Array.Clear(this.u, 0, 15); + Array.Clear(this.x, 0, 16); + } + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs.meta new file mode 100644 index 00000000..dbfe8274 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InfTree.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a743f4b4ce524c6498d107954ee73f5e +timeCreated: 1611465737 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs new file mode 100644 index 00000000..7945ea84 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs @@ -0,0 +1,740 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class InflateBlocks + { + private const int MANY = 1440; + + internal static readonly int[] border = new int[] + { + 16, + 17, + 18, + 0, + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15 + }; + + private InflateBlocks.InflateBlockMode mode; + + internal int left; + + internal int table; + + internal int index; + + internal int[] blens; + + internal int[] bb = new int[1]; + + internal int[] tb = new int[1]; + + internal InflateCodes codes = new InflateCodes(); + + internal int last; + + internal ZlibCodec _codec; + + internal int bitk; + + internal int bitb; + + internal int[] hufts; + + internal byte[] window; + + internal int end; + + internal int readAt; + + internal int writeAt; + + internal object checkfn; + + internal uint check; + + internal InfTree inftree = new InfTree(); + + private enum InflateBlockMode + { + TYPE, + LENS, + STORED, + TABLE, + BTREE, + DTREE, + CODES, + DRY, + DONE, + BAD + } + + internal InflateBlocks(ZlibCodec codec, object checkfn, int w) + { + this._codec = codec; + this.hufts = new int[4320]; + this.window = new byte[w]; + this.end = w; + this.checkfn = checkfn; + this.mode = InflateBlocks.InflateBlockMode.TYPE; + this.Reset(); + } + + internal uint Reset() + { + uint result = this.check; + this.mode = InflateBlocks.InflateBlockMode.TYPE; + this.bitk = 0; + this.bitb = 0; + this.readAt = (this.writeAt = 0); + bool flag = this.checkfn != null; + if (flag) + { + this._codec._Adler32 = (this.check = Adler.Adler32(0u, null, 0, 0)); + } + return result; + } + + internal int Process(int r) + { + int num = this._codec.NextIn; + int num2 = this._codec.AvailableBytesIn; + int num3 = this.bitb; + int i = this.bitk; + int num4 = this.writeAt; + int num5 = (num4 < this.readAt) ? (this.readAt - num4 - 1) : (this.end - num4); + int num6; + for (;;) + { + switch (this.mode) + { + case InflateBlocks.InflateBlockMode.TYPE: + while (i < 3) + { + bool flag = num2 != 0; + if (!flag) + { + goto IL_AC; + } + r = 0; + num2--; + num3 |= (int)(this._codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + num6 = (num3 & 7); + this.last = (num6 & 1); + switch ((uint)num6 >> 1) + { + case 0u: + num3 >>= 3; + i -= 3; + num6 = (i & 7); + num3 >>= num6; + i -= num6; + this.mode = InflateBlocks.InflateBlockMode.LENS; + break; + case 1u: + { + int[] array = new int[1]; + int[] array2 = new int[1]; + int[][] array3 = new int[1][]; + int[][] array4 = new int[1][]; + InfTree.inflate_trees_fixed(array, array2, array3, array4, this._codec); + this.codes.Init(array[0], array2[0], array3[0], 0, array4[0], 0); + num3 >>= 3; + i -= 3; + this.mode = InflateBlocks.InflateBlockMode.CODES; + break; + } + case 2u: + num3 >>= 3; + i -= 3; + this.mode = InflateBlocks.InflateBlockMode.TABLE; + break; + case 3u: + goto IL_20C; + } + continue; + case InflateBlocks.InflateBlockMode.LENS: + { + while (i < 32) + { + bool flag2 = num2 != 0; + if (!flag2) + { + goto IL_2AA; + } + r = 0; + num2--; + num3 |= (int)(this._codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + bool flag3 = (~num3 >> 16 & 65535) != (num3 & 65535); + if (flag3) + { + goto Block_8; + } + this.left = (num3 & 65535); + i = (num3 = 0); + this.mode = ((this.left != 0) ? InflateBlocks.InflateBlockMode.STORED : ((this.last != 0) ? InflateBlocks.InflateBlockMode.DRY : InflateBlocks.InflateBlockMode.TYPE)); + continue; + } + case InflateBlocks.InflateBlockMode.STORED: + { + bool flag4 = num2 == 0; + if (flag4) + { + goto Block_11; + } + bool flag5 = num5 == 0; + if (flag5) + { + bool flag6 = num4 == this.end && this.readAt != 0; + if (flag6) + { + num4 = 0; + num5 = ((num4 < this.readAt) ? (this.readAt - num4 - 1) : (this.end - num4)); + } + bool flag7 = num5 == 0; + if (flag7) + { + this.writeAt = num4; + r = this.Flush(r); + num4 = this.writeAt; + num5 = ((num4 < this.readAt) ? (this.readAt - num4 - 1) : (this.end - num4)); + bool flag8 = num4 == this.end && this.readAt != 0; + if (flag8) + { + num4 = 0; + num5 = ((num4 < this.readAt) ? (this.readAt - num4 - 1) : (this.end - num4)); + } + bool flag9 = num5 == 0; + if (flag9) + { + goto Block_21; + } + } + } + r = 0; + num6 = this.left; + bool flag10 = num6 > num2; + if (flag10) + { + num6 = num2; + } + bool flag11 = num6 > num5; + if (flag11) + { + num6 = num5; + } + Array.Copy(this._codec.InputBuffer, num, this.window, num4, num6); + num += num6; + num2 -= num6; + num4 += num6; + num5 -= num6; + bool flag12 = (this.left -= num6) != 0; + if (flag12) + { + continue; + } + this.mode = ((this.last != 0) ? InflateBlocks.InflateBlockMode.DRY : InflateBlocks.InflateBlockMode.TYPE); + continue; + } + case InflateBlocks.InflateBlockMode.TABLE: + { + while (i < 14) + { + bool flag13 = num2 != 0; + if (!flag13) + { + goto IL_665; + } + r = 0; + num2--; + num3 |= (int)(this._codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + num6 = (this.table = (num3 & 16383)); + bool flag14 = (num6 & 31) > 29 || (num6 >> 5 & 31) > 29; + if (flag14) + { + goto Block_29; + } + num6 = 258 + (num6 & 31) + (num6 >> 5 & 31); + bool flag15 = this.blens == null || this.blens.Length < num6; + if (flag15) + { + this.blens = new int[num6]; + } + else + { + Array.Clear(this.blens, 0, num6); + } + num3 >>= 14; + i -= 14; + this.index = 0; + this.mode = InflateBlocks.InflateBlockMode.BTREE; + goto IL_807; + } + case InflateBlocks.InflateBlockMode.BTREE: + goto IL_807; + case InflateBlocks.InflateBlockMode.DTREE: + goto IL_A03; + case InflateBlocks.InflateBlockMode.CODES: + goto IL_E92; + case InflateBlocks.InflateBlockMode.DRY: + goto IL_F85; + case InflateBlocks.InflateBlockMode.DONE: + goto IL_103E; + case InflateBlocks.InflateBlockMode.BAD: + goto IL_109E; + } + break; + continue; + IL_E92: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + r = this.codes.Process(this, r); + bool flag16 = r != 1; + if (flag16) + { + goto Block_53; + } + r = 0; + num = this._codec.NextIn; + num2 = this._codec.AvailableBytesIn; + num3 = this.bitb; + i = this.bitk; + num4 = this.writeAt; + num5 = ((num4 < this.readAt) ? (this.readAt - num4 - 1) : (this.end - num4)); + bool flag17 = this.last == 0; + if (flag17) + { + this.mode = InflateBlocks.InflateBlockMode.TYPE; + continue; + } + goto IL_F7C; + IL_A03: + for (;;) + { + num6 = this.table; + bool flag18 = this.index >= 258 + (num6 & 31) + (num6 >> 5 & 31); + if (flag18) + { + break; + } + num6 = this.bb[0]; + while (i < num6) + { + bool flag19 = num2 != 0; + if (!flag19) + { + goto IL_A59; + } + r = 0; + num2--; + num3 |= (int)(this._codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + num6 = this.hufts[(this.tb[0] + (num3 & InternalInflateConstants.InflateMask[num6])) * 3 + 1]; + int num7 = this.hufts[(this.tb[0] + (num3 & InternalInflateConstants.InflateMask[num6])) * 3 + 2]; + bool flag20 = num7 < 16; + if (flag20) + { + num3 >>= num6; + i -= num6; + int[] array5 = this.blens; + int num8 = this.index; + this.index = num8 + 1; + array5[num8] = num7; + } + else + { + int num9 = (num7 == 18) ? 7 : (num7 - 14); + int num10 = (num7 == 18) ? 11 : 3; + while (i < num6 + num9) + { + bool flag21 = num2 != 0; + if (!flag21) + { + goto IL_B9C; + } + r = 0; + num2--; + num3 |= (int)(this._codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + num3 >>= num6; + i -= num6; + num10 += (num3 & InternalInflateConstants.InflateMask[num9]); + num3 >>= num9; + i -= num9; + num9 = this.index; + num6 = this.table; + bool flag22 = num9 + num10 > 258 + (num6 & 31) + (num6 >> 5 & 31) || (num7 == 16 && num9 < 1); + if (flag22) + { + goto Block_48; + } + num7 = ((num7 == 16) ? this.blens[num9 - 1] : 0); + do + { + this.blens[num9++] = num7; + } + while (--num10 != 0); + this.index = num9; + } + } + this.tb[0] = -1; + int[] array6 = new int[] + { + 9 + }; + int[] array7 = new int[] + { + 6 + }; + int[] array8 = new int[1]; + int[] array9 = new int[1]; + num6 = this.table; + num6 = this.inftree.inflate_trees_dynamic(257 + (num6 & 31), 1 + (num6 >> 5 & 31), this.blens, array6, array7, array8, array9, this.hufts, this._codec); + bool flag23 = num6 != 0; + if (flag23) + { + goto Block_51; + } + this.codes.Init(array6[0], array7[0], this.hufts, array8[0], this.hufts, array9[0]); + this.mode = InflateBlocks.InflateBlockMode.CODES; + goto IL_E92; + IL_807: + while (this.index < 4 + (this.table >> 10)) + { + while (i < 3) + { + bool flag24 = num2 != 0; + if (!flag24) + { + goto IL_825; + } + r = 0; + num2--; + num3 |= (int)(this._codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + int[] array10 = this.blens; + int[] array11 = InflateBlocks.border; + int num8 = this.index; + this.index = num8 + 1; + array10[array11[num8]] = (num3 & 7); + num3 >>= 3; + i -= 3; + } + while (this.index < 19) + { + int[] array12 = this.blens; + int[] array13 = InflateBlocks.border; + int num8 = this.index; + this.index = num8 + 1; + array12[array13[num8]] = 0; + } + this.bb[0] = 7; + num6 = this.inftree.inflate_trees_bits(this.blens, this.bb, this.tb, this.hufts, this._codec); + bool flag25 = num6 != 0; + if (flag25) + { + goto Block_36; + } + this.index = 0; + this.mode = InflateBlocks.InflateBlockMode.DTREE; + goto IL_A03; + } + r = -2; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_AC: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_20C: + num3 >>= 3; + i -= 3; + this.mode = InflateBlocks.InflateBlockMode.BAD; + this._codec.Message = "invalid block type"; + r = -3; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_2AA: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_8: + this.mode = InflateBlocks.InflateBlockMode.BAD; + this._codec.Message = "invalid stored block lengths"; + r = -3; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_11: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_21: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_665: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_29: + this.mode = InflateBlocks.InflateBlockMode.BAD; + this._codec.Message = "too many length or distance symbols"; + r = -3; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_825: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_36: + r = num6; + bool flag26 = r == -3; + if (flag26) + { + this.blens = null; + this.mode = InflateBlocks.InflateBlockMode.BAD; + } + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_A59: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_B9C: + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_48: + this.blens = null; + this.mode = InflateBlocks.InflateBlockMode.BAD; + this._codec.Message = "invalid bit length repeat"; + r = -3; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_51: + bool flag27 = num6 == -3; + if (flag27) + { + this.blens = null; + this.mode = InflateBlocks.InflateBlockMode.BAD; + } + r = num6; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + Block_53: + return this.Flush(r); + IL_F7C: + this.mode = InflateBlocks.InflateBlockMode.DRY; + IL_F85: + this.writeAt = num4; + r = this.Flush(r); + num4 = this.writeAt; + int num11 = (num4 < this.readAt) ? (this.readAt - num4 - 1) : (this.end - num4); + bool flag28 = this.readAt != this.writeAt; + if (flag28) + { + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + } + this.mode = InflateBlocks.InflateBlockMode.DONE; + IL_103E: + r = 1; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + IL_109E: + r = -3; + this.bitb = num3; + this.bitk = i; + this._codec.AvailableBytesIn = num2; + this._codec.TotalBytesIn += (long)(num - this._codec.NextIn); + this._codec.NextIn = num; + this.writeAt = num4; + return this.Flush(r); + } + + internal void Free() + { + this.Reset(); + this.window = null; + this.hufts = null; + } + + internal void SetDictionary(byte[] d, int start, int n) + { + Array.Copy(d, start, this.window, 0, n); + this.writeAt = n; + this.readAt = n; + } + + internal int SyncPoint() + { + return (this.mode == InflateBlocks.InflateBlockMode.LENS) ? 1 : 0; + } + + internal int Flush(int r) + { + for (int i = 0; i < 2; i++) + { + bool flag = i == 0; + int num; + if (flag) + { + num = ((this.readAt <= this.writeAt) ? this.writeAt : this.end) - this.readAt; + } + else + { + num = this.writeAt - this.readAt; + } + bool flag2 = num == 0; + if (flag2) + { + bool flag3 = r == -5; + if (flag3) + { + r = 0; + } + return r; + } + bool flag4 = num > this._codec.AvailableBytesOut; + if (flag4) + { + num = this._codec.AvailableBytesOut; + } + bool flag5 = num != 0 && r == -5; + if (flag5) + { + r = 0; + } + this._codec.AvailableBytesOut -= num; + this._codec.TotalBytesOut += (long)num; + bool flag6 = this.checkfn != null; + if (flag6) + { + this._codec._Adler32 = (this.check = Adler.Adler32(this.check, this.window, this.readAt, num)); + } + Array.Copy(this.window, this.readAt, this._codec.OutputBuffer, this._codec.NextOut, num); + this._codec.NextOut += num; + this.readAt += num; + bool flag7 = this.readAt == this.end && i == 0; + if (flag7) + { + this.readAt = 0; + bool flag8 = this.writeAt == this.end; + if (flag8) + { + this.writeAt = 0; + } + } + else + { + i++; + } + } + return r; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs.meta new file mode 100644 index 00000000..ddd00b95 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateBlocks.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c47f2c3c076620d4e92b1d9eb79bcb84 +timeCreated: 1611465754 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs new file mode 100644 index 00000000..0ff5ced7 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs @@ -0,0 +1,696 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class InflateCodes + { + private const int START = 0; + + private const int LEN = 1; + + private const int LENEXT = 2; + + private const int DIST = 3; + + private const int DISTEXT = 4; + + private const int COPY = 5; + + private const int LIT = 6; + + private const int WASH = 7; + + private const int END = 8; + + private const int BADCODE = 9; + + internal int mode; + + internal int len; + + internal int[] tree; + + internal int tree_index = 0; + + internal int need; + + internal int lit; + + internal int bitsToGet; + + internal int dist; + + internal byte lbits; + + internal byte dbits; + + internal int[] ltree; + + internal int ltree_index; + + internal int[] dtree; + + internal int dtree_index; + + internal InflateCodes() + { + } + + internal void Init(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index) + { + this.mode = 0; + this.lbits = (byte)bl; + this.dbits = (byte)bd; + this.ltree = tl; + this.ltree_index = tl_index; + this.dtree = td; + this.dtree_index = td_index; + this.tree = null; + } + + internal int Process(InflateBlocks blocks, int r) + { + ZlibCodec codec = blocks._codec; + int num = codec.NextIn; + int num2 = codec.AvailableBytesIn; + int num3 = blocks.bitb; + int i = blocks.bitk; + int num4 = blocks.writeAt; + int num5 = (num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4); + for (;;) + { + int num6; + switch (this.mode) + { + case 0: + { + bool flag = num5 >= 258 && num2 >= 10; + if (flag) + { + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + r = this.InflateFast((int)this.lbits, (int)this.dbits, this.ltree, this.ltree_index, this.dtree, this.dtree_index, blocks, codec); + num = codec.NextIn; + num2 = codec.AvailableBytesIn; + num3 = blocks.bitb; + i = blocks.bitk; + num4 = blocks.writeAt; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + bool flag2 = r != 0; + if (flag2) + { + this.mode = ((r == 1) ? 7 : 9); + continue; + } + } + this.need = (int)this.lbits; + this.tree = this.ltree; + this.tree_index = this.ltree_index; + this.mode = 1; + goto IL_1C6; + } + case 1: + goto IL_1C6; + case 2: + num6 = this.bitsToGet; + while (i < num6) + { + bool flag3 = num2 != 0; + if (!flag3) + { + goto IL_3D0; + } + r = 0; + num2--; + num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + this.len += (num3 & InternalInflateConstants.InflateMask[num6]); + num3 >>= num6; + i -= num6; + this.need = (int)this.dbits; + this.tree = this.dtree; + this.tree_index = this.dtree_index; + this.mode = 3; + goto IL_4AA; + case 3: + goto IL_4AA; + case 4: + num6 = this.bitsToGet; + while (i < num6) + { + bool flag4 = num2 != 0; + if (!flag4) + { + goto IL_673; + } + r = 0; + num2--; + num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + this.dist += (num3 & InternalInflateConstants.InflateMask[num6]); + num3 >>= num6; + i -= num6; + this.mode = 5; + goto IL_729; + case 5: + goto IL_729; + case 6: + { + bool flag5 = num5 == 0; + if (flag5) + { + bool flag6 = num4 == blocks.end && blocks.readAt != 0; + if (flag6) + { + num4 = 0; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + } + bool flag7 = num5 == 0; + if (flag7) + { + blocks.writeAt = num4; + r = blocks.Flush(r); + num4 = blocks.writeAt; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + bool flag8 = num4 == blocks.end && blocks.readAt != 0; + if (flag8) + { + num4 = 0; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + } + bool flag9 = num5 == 0; + if (flag9) + { + goto Block_44; + } + } + } + r = 0; + blocks.window[num4++] = (byte)this.lit; + num5--; + this.mode = 0; + continue; + } + case 7: + goto IL_A5A; + case 8: + goto IL_B25; + case 9: + goto IL_B78; + } + break; + continue; + IL_1C6: + num6 = this.need; + while (i < num6) + { + bool flag10 = num2 != 0; + if (!flag10) + { + goto IL_1E3; + } + r = 0; + num2--; + num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + int num7 = (this.tree_index + (num3 & InternalInflateConstants.InflateMask[num6])) * 3; + num3 >>= this.tree[num7 + 1]; + i -= this.tree[num7 + 1]; + int num8 = this.tree[num7]; + bool flag11 = num8 == 0; + if (flag11) + { + this.lit = this.tree[num7 + 2]; + this.mode = 6; + continue; + } + bool flag12 = (num8 & 16) != 0; + if (flag12) + { + this.bitsToGet = (num8 & 15); + this.len = this.tree[num7 + 2]; + this.mode = 2; + continue; + } + bool flag13 = (num8 & 64) == 0; + if (flag13) + { + this.need = num8; + this.tree_index = num7 / 3 + this.tree[num7 + 2]; + continue; + } + bool flag14 = (num8 & 32) != 0; + if (flag14) + { + this.mode = 7; + continue; + } + goto IL_34B; + IL_4AA: + num6 = this.need; + while (i < num6) + { + bool flag15 = num2 != 0; + if (!flag15) + { + goto IL_4C7; + } + r = 0; + num2--; + num3 |= (int)(codec.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + num7 = (this.tree_index + (num3 & InternalInflateConstants.InflateMask[num6])) * 3; + num3 >>= this.tree[num7 + 1]; + i -= this.tree[num7 + 1]; + num8 = this.tree[num7]; + bool flag16 = (num8 & 16) != 0; + if (flag16) + { + this.bitsToGet = (num8 & 15); + this.dist = this.tree[num7 + 2]; + this.mode = 4; + continue; + } + bool flag17 = (num8 & 64) == 0; + if (flag17) + { + this.need = num8; + this.tree_index = num7 / 3 + this.tree[num7 + 2]; + continue; + } + goto IL_5EE; + IL_729: + int j; + for (j = num4 - this.dist; j < 0; j += blocks.end) + { + } + while (this.len != 0) + { + bool flag18 = num5 == 0; + if (flag18) + { + bool flag19 = num4 == blocks.end && blocks.readAt != 0; + if (flag19) + { + num4 = 0; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + } + bool flag20 = num5 == 0; + if (flag20) + { + blocks.writeAt = num4; + r = blocks.Flush(r); + num4 = blocks.writeAt; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + bool flag21 = num4 == blocks.end && blocks.readAt != 0; + if (flag21) + { + num4 = 0; + num5 = ((num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4)); + } + bool flag22 = num5 == 0; + if (flag22) + { + goto Block_32; + } + } + } + blocks.window[num4++] = blocks.window[j++]; + num5--; + bool flag23 = j == blocks.end; + if (flag23) + { + j = 0; + } + this.len--; + } + this.mode = 0; + } + r = -2; + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_1E3: + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_34B: + this.mode = 9; + codec.Message = "invalid literal/length code"; + r = -3; + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_3D0: + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_4C7: + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_5EE: + this.mode = 9; + codec.Message = "invalid distance code"; + r = -3; + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_673: + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + Block_32: + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + Block_44: + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_A5A: + bool flag24 = i > 7; + if (flag24) + { + i -= 8; + num2++; + num--; + } + blocks.writeAt = num4; + r = blocks.Flush(r); + num4 = blocks.writeAt; + int num9 = (num4 < blocks.readAt) ? (blocks.readAt - num4 - 1) : (blocks.end - num4); + bool flag25 = blocks.readAt != blocks.writeAt; + if (flag25) + { + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + } + this.mode = 8; + IL_B25: + r = 1; + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + IL_B78: + r = -3; + blocks.bitb = num3; + blocks.bitk = i; + codec.AvailableBytesIn = num2; + codec.TotalBytesIn += (long)(num - codec.NextIn); + codec.NextIn = num; + blocks.writeAt = num4; + return blocks.Flush(r); + } + + internal int InflateFast(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index, InflateBlocks s, ZlibCodec z) + { + int num = z.NextIn; + int num2 = z.AvailableBytesIn; + int num3 = s.bitb; + int i = s.bitk; + int num4 = s.writeAt; + int num5 = (num4 < s.readAt) ? (s.readAt - num4 - 1) : (s.end - num4); + int num6 = InternalInflateConstants.InflateMask[bl]; + int num7 = InternalInflateConstants.InflateMask[bd]; + int num10; + int num11; + for (;;) + { + while (i < 20) + { + num2--; + num3 |= (int)(z.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + int num8 = num3 & num6; + int num9 = (tl_index + num8) * 3; + bool flag = (num10 = tl[num9]) == 0; + if (flag) + { + num3 >>= tl[num9 + 1]; + i -= tl[num9 + 1]; + s.window[num4++] = (byte)tl[num9 + 2]; + num5--; + } + else + { + for (;;) + { + num3 >>= tl[num9 + 1]; + i -= tl[num9 + 1]; + bool flag2 = (num10 & 16) != 0; + if (flag2) + { + goto Block_4; + } + bool flag3 = (num10 & 64) == 0; + if (!flag3) + { + goto IL_56B; + } + num8 += tl[num9 + 2]; + num8 += (num3 & InternalInflateConstants.InflateMask[num10]); + num9 = (tl_index + num8) * 3; + bool flag4 = (num10 = tl[num9]) == 0; + if (flag4) + { + goto Block_20; + } + } + IL_699: + goto IL_69A; + Block_20: + num3 >>= tl[num9 + 1]; + i -= tl[num9 + 1]; + s.window[num4++] = (byte)tl[num9 + 2]; + num5--; + goto IL_699; + Block_4: + num10 &= 15; + num11 = tl[num9 + 2] + (num3 & InternalInflateConstants.InflateMask[num10]); + num3 >>= num10; + for (i -= num10; i < 15; i += 8) + { + num2--; + num3 |= (int)(z.InputBuffer[num++] & byte.MaxValue) << i; + } + num8 = (num3 & num7); + num9 = (td_index + num8) * 3; + num10 = td[num9]; + for (;;) + { + num3 >>= td[num9 + 1]; + i -= td[num9 + 1]; + bool flag5 = (num10 & 16) != 0; + if (flag5) + { + break; + } + bool flag6 = (num10 & 64) == 0; + if (!flag6) + { + goto IL_451; + } + num8 += td[num9 + 2]; + num8 += (num3 & InternalInflateConstants.InflateMask[num10]); + num9 = (td_index + num8) * 3; + num10 = td[num9]; + } + num10 &= 15; + while (i < num10) + { + num2--; + num3 |= (int)(z.InputBuffer[num++] & byte.MaxValue) << i; + i += 8; + } + int num12 = td[num9 + 2] + (num3 & InternalInflateConstants.InflateMask[num10]); + num3 >>= num10; + i -= num10; + num5 -= num11; + bool flag7 = num4 >= num12; + int num13; + if (flag7) + { + num13 = num4 - num12; + bool flag8 = num4 - num13 > 0 && 2 > num4 - num13; + if (flag8) + { + s.window[num4++] = s.window[num13++]; + s.window[num4++] = s.window[num13++]; + num11 -= 2; + } + else + { + Array.Copy(s.window, num13, s.window, num4, 2); + num4 += 2; + num13 += 2; + num11 -= 2; + } + } + else + { + num13 = num4 - num12; + do + { + num13 += s.end; + } + while (num13 < 0); + num10 = s.end - num13; + bool flag9 = num11 > num10; + if (flag9) + { + num11 -= num10; + bool flag10 = num4 - num13 > 0 && num10 > num4 - num13; + if (flag10) + { + do + { + s.window[num4++] = s.window[num13++]; + } + while (--num10 != 0); + } + else + { + Array.Copy(s.window, num13, s.window, num4, num10); + num4 += num10; + num13 += num10; + } + num13 = 0; + } + } + bool flag11 = num4 - num13 > 0 && num11 > num4 - num13; + if (flag11) + { + do + { + s.window[num4++] = s.window[num13++]; + } + while (--num11 != 0); + } + else + { + Array.Copy(s.window, num13, s.window, num4, num11); + num4 += num11; + num13 += num11; + } + } + IL_69A: + if (num5 < 258 || num2 < 10) + { + goto Block_25; + } + } + IL_451: + z.Message = "invalid distance code"; + num11 = z.AvailableBytesIn - num2; + num11 = ((i >> 3 < num11) ? (i >> 3) : num11); + num2 += num11; + num -= num11; + i -= num11 << 3; + s.bitb = num3; + s.bitk = i; + z.AvailableBytesIn = num2; + z.TotalBytesIn += (long)(num - z.NextIn); + z.NextIn = num; + s.writeAt = num4; + return -3; + IL_56B: + bool flag12 = (num10 & 32) != 0; + if (flag12) + { + num11 = z.AvailableBytesIn - num2; + num11 = ((i >> 3 < num11) ? (i >> 3) : num11); + num2 += num11; + num -= num11; + i -= num11 << 3; + s.bitb = num3; + s.bitk = i; + z.AvailableBytesIn = num2; + z.TotalBytesIn += (long)(num - z.NextIn); + z.NextIn = num; + s.writeAt = num4; + return 1; + } + z.Message = "invalid literal/length code"; + num11 = z.AvailableBytesIn - num2; + num11 = ((i >> 3 < num11) ? (i >> 3) : num11); + num2 += num11; + num -= num11; + i -= num11 << 3; + s.bitb = num3; + s.bitk = i; + z.AvailableBytesIn = num2; + z.TotalBytesIn += (long)(num - z.NextIn); + z.NextIn = num; + s.writeAt = num4; + return -3; + Block_25: + num11 = z.AvailableBytesIn - num2; + num11 = ((i >> 3 < num11) ? (i >> 3) : num11); + num2 += num11; + num -= num11; + i -= num11 << 3; + s.bitb = num3; + s.bitk = i; + z.AvailableBytesIn = num2; + z.TotalBytesIn += (long)(num - z.NextIn); + z.NextIn = num; + s.writeAt = num4; + return 0; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs.meta new file mode 100644 index 00000000..ae1072d6 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateCodes.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7146d212caa78a24bbd76178120abbec +timeCreated: 1611465687 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs new file mode 100644 index 00000000..e3dc05d5 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs @@ -0,0 +1,523 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class InflateManager + { + internal bool HandleRfc1950HeaderBytes + { + get + { + return this._handleRfc1950HeaderBytes; + } + set + { + this._handleRfc1950HeaderBytes = value; + } + } + + private const int PRESET_DICT = 32; + + private const int Z_DEFLATED = 8; + + private InflateManager.InflateManagerMode mode; + + internal ZlibCodec _codec; + + internal int method; + + internal uint computedCheck; + + internal uint expectedCheck; + + internal int marker; + + private bool _handleRfc1950HeaderBytes = true; + + internal int wbits; + + internal InflateBlocks blocks; + + private static readonly byte[] mark = new byte[] + { + 0, + 0, + byte.MaxValue, + byte.MaxValue + }; + + private enum InflateManagerMode + { + METHOD, + FLAG, + DICT4, + DICT3, + DICT2, + DICT1, + DICT0, + BLOCKS, + CHECK4, + CHECK3, + CHECK2, + CHECK1, + DONE, + BAD + } + + public InflateManager() + { + } + + public InflateManager(bool expectRfc1950HeaderBytes) + { + this._handleRfc1950HeaderBytes = expectRfc1950HeaderBytes; + } + + public int Reset() + { + this._codec.TotalBytesIn = (this._codec.TotalBytesOut = 0L); + this._codec.Message = null; + this.mode = (this.HandleRfc1950HeaderBytes ? InflateManager.InflateManagerMode.METHOD : InflateManager.InflateManagerMode.BLOCKS); + this.blocks.Reset(); + return 0; + } + + internal int End() + { + bool flag = this.blocks != null; + if (flag) + { + this.blocks.Free(); + } + this.blocks = null; + return 0; + } + + internal int Initialize(ZlibCodec codec, int w) + { + this._codec = codec; + this._codec.Message = null; + this.blocks = null; + bool flag = w < 8 || w > 15; + if (flag) + { + this.End(); + throw new ZlibException("Bad window size."); + } + this.wbits = w; + this.blocks = new InflateBlocks(codec, this.HandleRfc1950HeaderBytes ? this : null, 1 << w); + this.Reset(); + return 0; + } + + internal int Inflate(FlushType flush) + { + bool flag = this._codec.InputBuffer == null; + if (flag) + { + throw new ZlibException("InputBuffer is null. "); + } + int num = 0; + int num2 = -5; + int nextIn; + for (;;) + { + switch (this.mode) + { + case InflateManager.InflateManagerMode.METHOD: + { + bool flag2 = this._codec.AvailableBytesIn == 0; + if (flag2) + { + goto Block_3; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + byte[] inputBuffer = this._codec.InputBuffer; + ZlibCodec codec = this._codec; + nextIn = codec.NextIn; + codec.NextIn = nextIn + 1; + bool flag3 = ((this.method = inputBuffer[nextIn]) & 15) != 8; + if (flag3) + { + this.mode = InflateManager.InflateManagerMode.BAD; + this._codec.Message = string.Format("unknown compression method (0x{0:X2})", this.method); + this.marker = 5; + continue; + } + bool flag4 = (this.method >> 4) + 8 > this.wbits; + if (flag4) + { + this.mode = InflateManager.InflateManagerMode.BAD; + this._codec.Message = string.Format("invalid window size ({0})", (this.method >> 4) + 8); + this.marker = 5; + continue; + } + this.mode = InflateManager.InflateManagerMode.FLAG; + continue; + } + case InflateManager.InflateManagerMode.FLAG: + { + bool flag5 = this._codec.AvailableBytesIn == 0; + if (flag5) + { + goto Block_6; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + byte[] inputBuffer2 = this._codec.InputBuffer; + ZlibCodec codec2 = this._codec; + nextIn = codec2.NextIn; + codec2.NextIn = nextIn + 1; + int num3 = inputBuffer2[nextIn] & 255; + bool flag6 = ((this.method << 8) + num3) % 31 != 0; + if (flag6) + { + this.mode = InflateManager.InflateManagerMode.BAD; + this._codec.Message = "incorrect header check"; + this.marker = 5; + continue; + } + this.mode = (((num3 & 32) == 0) ? InflateManager.InflateManagerMode.BLOCKS : InflateManager.InflateManagerMode.DICT4); + continue; + } + case InflateManager.InflateManagerMode.DICT4: + { + bool flag7 = this._codec.AvailableBytesIn == 0; + if (flag7) + { + goto Block_9; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + byte[] inputBuffer3 = this._codec.InputBuffer; + ZlibCodec codec3 = this._codec; + nextIn = codec3.NextIn; + codec3.NextIn = nextIn + 1; + //! + this.expectedCheck = (uint)(inputBuffer3[nextIn] << 24 & (long)(/*(ulong)*/-16777216)); + this.mode = InflateManager.InflateManagerMode.DICT3; + continue; + } + case InflateManager.InflateManagerMode.DICT3: + { + bool flag8 = this._codec.AvailableBytesIn == 0; + if (flag8) + { + goto Block_10; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + uint num4 = this.expectedCheck; + byte[] inputBuffer4 = this._codec.InputBuffer; + ZlibCodec codec4 = this._codec; + nextIn = codec4.NextIn; + codec4.NextIn = nextIn + 1; + //! + this.expectedCheck = (uint) ( num4 + (inputBuffer4[nextIn] << 16 & 16711680u)); + this.mode = InflateManager.InflateManagerMode.DICT2; + continue; + } + case InflateManager.InflateManagerMode.DICT2: + { + bool flag9 = this._codec.AvailableBytesIn == 0; + if (flag9) + { + goto Block_11; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + uint num5 = this.expectedCheck; + byte[] inputBuffer5 = this._codec.InputBuffer; + ZlibCodec codec5 = this._codec; + nextIn = codec5.NextIn; + codec5.NextIn = nextIn + 1; + this.expectedCheck = (uint) (num5 + (inputBuffer5[nextIn] << 8 & 65280u)); //! + this.mode = InflateManager.InflateManagerMode.DICT1; + continue; + } + case InflateManager.InflateManagerMode.DICT1: + goto IL_3EB; + case InflateManager.InflateManagerMode.DICT0: + goto IL_488; + case InflateManager.InflateManagerMode.BLOCKS: + { + num2 = this.blocks.Process(num2); + bool flag10 = num2 == -3; + if (flag10) + { + this.mode = InflateManager.InflateManagerMode.BAD; + this.marker = 0; + continue; + } + bool flag11 = num2 == 0; + if (flag11) + { + num2 = num; + } + bool flag12 = num2 != 1; + if (flag12) + { + goto Block_15; + } + num2 = num; + this.computedCheck = this.blocks.Reset(); + bool flag13 = !this.HandleRfc1950HeaderBytes; + if (flag13) + { + goto Block_16; + } + this.mode = InflateManager.InflateManagerMode.CHECK4; + continue; + } + case InflateManager.InflateManagerMode.CHECK4: + { + bool flag14 = this._codec.AvailableBytesIn == 0; + if (flag14) + { + goto Block_17; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + byte[] inputBuffer6 = this._codec.InputBuffer; + ZlibCodec codec6 = this._codec; + nextIn = codec6.NextIn; + codec6.NextIn = nextIn + 1; + //! + this.expectedCheck = (uint)(inputBuffer6[nextIn] << 24 & (long)(-16777216)); + this.mode = InflateManager.InflateManagerMode.CHECK3; + continue; + } + case InflateManager.InflateManagerMode.CHECK3: + { + bool flag15 = this._codec.AvailableBytesIn == 0; + if (flag15) + { + goto Block_18; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + uint num6 = this.expectedCheck; + byte[] inputBuffer7 = this._codec.InputBuffer; + ZlibCodec codec7 = this._codec; + nextIn = codec7.NextIn; + codec7.NextIn = nextIn + 1; + this.expectedCheck = (uint) (num6 + (inputBuffer7[nextIn] << 16 & 16711680u)); //! + this.mode = InflateManager.InflateManagerMode.CHECK2; + continue; + } + case InflateManager.InflateManagerMode.CHECK2: + { + bool flag16 = this._codec.AvailableBytesIn == 0; + if (flag16) + { + goto Block_19; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + uint num7 = this.expectedCheck; + byte[] inputBuffer8 = this._codec.InputBuffer; + ZlibCodec codec8 = this._codec; + nextIn = codec8.NextIn; + codec8.NextIn = nextIn + 1; + this.expectedCheck = (uint) ( num7 + (inputBuffer8[nextIn] << 8 & 65280u) ); + this.mode = InflateManager.InflateManagerMode.CHECK1; + continue; + } + case InflateManager.InflateManagerMode.CHECK1: + { + bool flag17 = this._codec.AvailableBytesIn == 0; + if (flag17) + { + goto Block_20; + } + num2 = num; + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + uint num8 = this.expectedCheck; + byte[] inputBuffer9 = this._codec.InputBuffer; + ZlibCodec codec9 = this._codec; + nextIn = codec9.NextIn; + codec9.NextIn = nextIn + 1; + this.expectedCheck = num8 + (inputBuffer9[nextIn] & 255u); + bool flag18 = this.computedCheck != this.expectedCheck; + if (flag18) + { + this.mode = InflateManager.InflateManagerMode.BAD; + this._codec.Message = "incorrect data check"; + this.marker = 5; + continue; + } + goto IL_795; + } + case InflateManager.InflateManagerMode.DONE: + goto IL_7A2; + case InflateManager.InflateManagerMode.BAD: + goto IL_7A7; + } + break; + } + throw new ZlibException("Stream error."); + Block_3: + return num2; + Block_6: + return num2; + Block_9: + return num2; + Block_10: + return num2; + Block_11: + return num2; + IL_3EB: + bool flag19 = this._codec.AvailableBytesIn == 0; + if (flag19) + { + return num2; + } + this._codec.AvailableBytesIn--; + this._codec.TotalBytesIn += 1L; + uint num9 = this.expectedCheck; + byte[] inputBuffer10 = this._codec.InputBuffer; + ZlibCodec codec10 = this._codec; + nextIn = codec10.NextIn; + codec10.NextIn = nextIn + 1; + this.expectedCheck = num9 + (inputBuffer10[nextIn] & 255u); + this._codec._Adler32 = this.expectedCheck; + this.mode = InflateManager.InflateManagerMode.DICT0; + return 2; + IL_488: + this.mode = InflateManager.InflateManagerMode.BAD; + this._codec.Message = "need dictionary"; + this.marker = 0; + return -2; + Block_15: + return num2; + Block_16: + this.mode = InflateManager.InflateManagerMode.DONE; + return 1; + Block_17: + return num2; + Block_18: + return num2; + Block_19: + return num2; + Block_20: + return num2; + IL_795: + this.mode = InflateManager.InflateManagerMode.DONE; + return 1; + IL_7A2: + return 1; + IL_7A7: + throw new ZlibException(string.Format("Bad state ({0})", this._codec.Message)); + } + + internal int SetDictionary(byte[] dictionary) + { + int start = 0; + int num = dictionary.Length; + bool flag = this.mode != InflateManager.InflateManagerMode.DICT0; + if (flag) + { + throw new ZlibException("Stream error."); + } + bool flag2 = Adler.Adler32(1u, dictionary, 0, dictionary.Length) != this._codec._Adler32; + int result; + if (flag2) + { + result = -3; + } + else + { + this._codec._Adler32 = Adler.Adler32(0u, null, 0, 0); + bool flag3 = num >= 1 << this.wbits; + if (flag3) + { + num = (1 << this.wbits) - 1; + start = dictionary.Length - num; + } + this.blocks.SetDictionary(dictionary, start, num); + this.mode = InflateManager.InflateManagerMode.BLOCKS; + result = 0; + } + return result; + } + + internal int Sync() + { + bool flag = this.mode != InflateManager.InflateManagerMode.BAD; + if (flag) + { + this.mode = InflateManager.InflateManagerMode.BAD; + this.marker = 0; + } + int num; + bool flag2 = (num = this._codec.AvailableBytesIn) == 0; + int result; + if (flag2) + { + result = -5; + } + else + { + int num2 = this._codec.NextIn; + int num3 = this.marker; + while (num != 0 && num3 < 4) + { + bool flag3 = this._codec.InputBuffer[num2] == InflateManager.mark[num3]; + if (flag3) + { + num3++; + } + else + { + bool flag4 = this._codec.InputBuffer[num2] > 0; + if (flag4) + { + num3 = 0; + } + else + { + num3 = 4 - num3; + } + } + num2++; + num--; + } + this._codec.TotalBytesIn += (long)(num2 - this._codec.NextIn); + this._codec.NextIn = num2; + this._codec.AvailableBytesIn = num; + this.marker = num3; + bool flag5 = num3 != 4; + if (flag5) + { + result = -3; + } + else + { + long totalBytesIn = this._codec.TotalBytesIn; + long totalBytesOut = this._codec.TotalBytesOut; + this.Reset(); + this._codec.TotalBytesIn = totalBytesIn; + this._codec.TotalBytesOut = totalBytesOut; + this.mode = InflateManager.InflateManagerMode.BLOCKS; + result = 0; + } + } + return result; + } + + internal int SyncPoint(ZlibCodec z) + { + return this.blocks.SyncPoint(); + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs.meta new file mode 100644 index 00000000..d0c021f6 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InflateManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 067f6f4507768274b962d8b6ecf1a9b5 +timeCreated: 1611465286 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs new file mode 100644 index 00000000..7eb8f69e --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs @@ -0,0 +1,27 @@ +using System; + +namespace Ionic.Zlib +{ + internal static class InternalConstants + { + internal static readonly int MAX_BITS = 15; + + internal static readonly int BL_CODES = 19; + + internal static readonly int D_CODES = 30; + + internal static readonly int LITERALS = 256; + + internal static readonly int LENGTH_CODES = 29; + + internal static readonly int L_CODES = InternalConstants.LITERALS + 1 + InternalConstants.LENGTH_CODES; + + internal static readonly int MAX_BL_BITS = 7; + + internal static readonly int REP_3_6 = 16; + + internal static readonly int REPZ_3_10 = 17; + + internal static readonly int REPZ_11_138 = 18; + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs.meta new file mode 100644 index 00000000..e2814867 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalConstants.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a045e41eef9254546a865c9391b0e933 +timeCreated: 1611465711 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs new file mode 100644 index 00000000..82fb9442 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs @@ -0,0 +1,28 @@ +using System; + +namespace Ionic.Zlib +{ + internal static class InternalInflateConstants + { + internal static readonly int[] InflateMask = new int[] + { + 0, + 1, + 3, + 7, + 15, + 31, + 63, + 127, + 255, + 511, + 1023, + 2047, + 4095, + 8191, + 16383, + 32767, + 65535 + }; + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs.meta new file mode 100644 index 00000000..8fd090bf --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/InternalInflateConstants.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b7bb2a04b5a738b4587181846913dfbc +timeCreated: 1611465747 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs new file mode 100644 index 00000000..eed1a9f3 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs @@ -0,0 +1,630 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Threading; +using Ionic.Crc; + +namespace Ionic.Zlib +{ + public class ParallelDeflateOutputStream : Stream + { + public CompressionStrategy Strategy { get; private set; } + + public int MaxBufferPairs + { + get + { + return this._maxBufferPairs; + } + set + { + bool flag = value < 4; + if (flag) + { + throw new ArgumentException("MaxBufferPairs", "Value must be 4 or greater."); + } + this._maxBufferPairs = value; + } + } + + public int BufferSize + { + get + { + return this._bufferSize; + } + set + { + bool flag = value < 1024; + if (flag) + { + throw new ArgumentOutOfRangeException("BufferSize", "BufferSize must be greater than 1024 bytes"); + } + this._bufferSize = value; + } + } + + public int Crc32 + { + get + { + return this._Crc32; + } + } + + public long BytesProcessed + { + get + { + return this._totalBytesProcessed; + } + } + + public override bool CanSeek + { + get + { + return false; + } + } + + public override bool CanRead + { + get + { + return false; + } + } + + public override bool CanWrite + { + get + { + return this._outStream.CanWrite; + } + } + + public override long Length + { + get + { + throw new NotSupportedException(); + } + } + + public override long Position + { + get + { + return this._outStream.Position; + } + set + { + throw new NotSupportedException(); + } + } + + private static readonly int IO_BUFFER_SIZE_DEFAULT = 65536; + + private static readonly int BufferPairsPerCore = 4; + + private List _pool; + + private bool _leaveOpen; + + private bool emitting; + + private Stream _outStream; + + private int _maxBufferPairs; + + private int _bufferSize = ParallelDeflateOutputStream.IO_BUFFER_SIZE_DEFAULT; + + private AutoResetEvent _newlyCompressedBlob; + + private object _outputLock = new object(); + + private bool _isClosed; + + private bool _firstWriteDone; + + private int _currentlyFilling; + + private int _lastFilled; + + private int _lastWritten; + + private int _latestCompressed; + + private int _Crc32; + + private CRC32 _runningCrc; + + private object _latestLock = new object(); + + private Queue _toWrite; + + private Queue _toFill; + + private long _totalBytesProcessed; + + private CompressionLevel _compressLevel; + + private volatile Exception _pendingException; + + private bool _handlingException; + + private object _eLock = new object(); + + private ParallelDeflateOutputStream.TraceBits _DesiredTrace = ParallelDeflateOutputStream.TraceBits.EmitLock | ParallelDeflateOutputStream.TraceBits.EmitEnter | ParallelDeflateOutputStream.TraceBits.EmitBegin | ParallelDeflateOutputStream.TraceBits.EmitDone | ParallelDeflateOutputStream.TraceBits.EmitSkip | ParallelDeflateOutputStream.TraceBits.Session | ParallelDeflateOutputStream.TraceBits.Compress | ParallelDeflateOutputStream.TraceBits.WriteEnter | ParallelDeflateOutputStream.TraceBits.WriteTake; + + [Flags] + private enum TraceBits : uint + { + None = 0u, + NotUsed1 = 1u, + EmitLock = 2u, + EmitEnter = 4u, + EmitBegin = 8u, + EmitDone = 16u, + EmitSkip = 32u, + EmitAll = 58u, + Flush = 64u, + Lifecycle = 128u, + Session = 256u, + Synch = 512u, + Instance = 1024u, + Compress = 2048u, + Write = 4096u, + WriteEnter = 8192u, + WriteTake = 16384u, + All = 4294967295u + } + + public ParallelDeflateOutputStream(Stream stream) : this(stream, CompressionLevel.Default, CompressionStrategy.Default, false) + { + } + + public ParallelDeflateOutputStream(Stream stream, CompressionLevel level) : this(stream, level, CompressionStrategy.Default, false) + { + } + + public ParallelDeflateOutputStream(Stream stream, bool leaveOpen) : this(stream, CompressionLevel.Default, CompressionStrategy.Default, leaveOpen) + { + } + + public ParallelDeflateOutputStream(Stream stream, CompressionLevel level, bool leaveOpen) : this(stream, CompressionLevel.Default, CompressionStrategy.Default, leaveOpen) + { + } + + public ParallelDeflateOutputStream(Stream stream, CompressionLevel level, CompressionStrategy strategy, bool leaveOpen) + { + this._outStream = stream; + this._compressLevel = level; + this.Strategy = strategy; + this._leaveOpen = leaveOpen; + this.MaxBufferPairs = 16; + } + + private void _InitializePoolOfWorkItems() + { + this._toWrite = new Queue(); + this._toFill = new Queue(); + this._pool = new List(); + int num = ParallelDeflateOutputStream.BufferPairsPerCore * Environment.ProcessorCount; + num = Math.Min(num, this._maxBufferPairs); + for (int i = 0; i < num; i++) + { + this._pool.Add(new WorkItem(this._bufferSize, this._compressLevel, this.Strategy, i)); + this._toFill.Enqueue(i); + } + this._newlyCompressedBlob = new AutoResetEvent(false); + this._runningCrc = new CRC32(); + this._currentlyFilling = -1; + this._lastFilled = -1; + this._lastWritten = -1; + this._latestCompressed = -1; + } + + public override void Write(byte[] buffer, int offset, int count) + { + bool mustWait = false; + bool isClosed = this._isClosed; + if (isClosed) + { + throw new InvalidOperationException(); + } + bool flag = this._pendingException != null; + if (flag) + { + this._handlingException = true; + Exception pendingException = this._pendingException; + this._pendingException = null; + throw pendingException; + } + bool flag2 = count == 0; + if (!flag2) + { + bool flag3 = !this._firstWriteDone; + if (flag3) + { + this._InitializePoolOfWorkItems(); + this._firstWriteDone = true; + } + for (;;) + { + this.EmitPendingBuffers(false, mustWait); + mustWait = false; + bool flag4 = this._currentlyFilling >= 0; + int num; + if (flag4) + { + num = this._currentlyFilling; + goto IL_D2; + } + bool flag5 = this._toFill.Count == 0; + if (!flag5) + { + num = this._toFill.Dequeue(); + this._lastFilled++; + goto IL_D2; + } + mustWait = true; + IL_1A9: + if (count <= 0) + { + return; + } + continue; + IL_D2: + WorkItem workItem = this._pool[num]; + int num2 = (workItem.buffer.Length - workItem.inputBytesAvailable > count) ? count : (workItem.buffer.Length - workItem.inputBytesAvailable); + workItem.ordinal = this._lastFilled; + Buffer.BlockCopy(buffer, offset, workItem.buffer, workItem.inputBytesAvailable, num2); + count -= num2; + offset += num2; + workItem.inputBytesAvailable += num2; + bool flag6 = workItem.inputBytesAvailable == workItem.buffer.Length; + if (flag6) + { + bool flag7 = !ThreadPool.QueueUserWorkItem(new WaitCallback(this._DeflateOne), workItem); + if (flag7) + { + break; + } + this._currentlyFilling = -1; + } + else + { + this._currentlyFilling = num; + } + bool flag8 = count > 0; + if (flag8) + { + } + goto IL_1A9; + } + throw new Exception("Cannot enqueue workitem"); + } + } + + private void _FlushFinish() + { + byte[] array = new byte[128]; + ZlibCodec zlibCodec = new ZlibCodec(); + int num = zlibCodec.InitializeDeflate(this._compressLevel, false); + zlibCodec.InputBuffer = null; + zlibCodec.NextIn = 0; + zlibCodec.AvailableBytesIn = 0; + zlibCodec.OutputBuffer = array; + zlibCodec.NextOut = 0; + zlibCodec.AvailableBytesOut = array.Length; + num = zlibCodec.Deflate(FlushType.Finish); + bool flag = num != 1 && num != 0; + if (flag) + { + throw new Exception("deflating: " + zlibCodec.Message); + } + bool flag2 = array.Length - zlibCodec.AvailableBytesOut > 0; + if (flag2) + { + this._outStream.Write(array, 0, array.Length - zlibCodec.AvailableBytesOut); + } + zlibCodec.EndDeflate(); + this._Crc32 = this._runningCrc.Crc32Result; + } + + private void _Flush(bool lastInput) + { + bool isClosed = this._isClosed; + if (isClosed) + { + throw new InvalidOperationException(); + } + bool flag = this.emitting; + if (!flag) + { + bool flag2 = this._currentlyFilling >= 0; + if (flag2) + { + WorkItem wi = this._pool[this._currentlyFilling]; + this._DeflateOne(wi); + this._currentlyFilling = -1; + } + if (lastInput) + { + this.EmitPendingBuffers(true, false); + this._FlushFinish(); + } + else + { + this.EmitPendingBuffers(false, false); + } + } + } + + public override void Flush() + { + bool flag = this._pendingException != null; + if (flag) + { + this._handlingException = true; + Exception pendingException = this._pendingException; + this._pendingException = null; + throw pendingException; + } + bool handlingException = this._handlingException; + if (!handlingException) + { + this._Flush(false); + } + } + + public override void Close() + { + bool flag = this._pendingException != null; + if (flag) + { + this._handlingException = true; + Exception pendingException = this._pendingException; + this._pendingException = null; + throw pendingException; + } + bool handlingException = this._handlingException; + if (!handlingException) + { + bool isClosed = this._isClosed; + if (!isClosed) + { + this._Flush(true); + bool flag2 = !this._leaveOpen; + if (flag2) + { + this._outStream.Close(); + } + this._isClosed = true; + } + } + } + + public new void Dispose() + { + this.Close(); + this._pool = null; + this.Dispose(true); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + } + + public void Reset(Stream stream) + { + bool flag = !this._firstWriteDone; + if (!flag) + { + this._toWrite.Clear(); + this._toFill.Clear(); + foreach (WorkItem workItem in this._pool) + { + this._toFill.Enqueue(workItem.index); + workItem.ordinal = -1; + } + this._firstWriteDone = false; + this._totalBytesProcessed = 0L; + this._runningCrc = new CRC32(); + this._isClosed = false; + this._currentlyFilling = -1; + this._lastFilled = -1; + this._lastWritten = -1; + this._latestCompressed = -1; + this._outStream = stream; + } + } + + private void EmitPendingBuffers(bool doAll, bool mustWait) + { + bool flag = this.emitting; + if (!flag) + { + this.emitting = true; + bool flag2 = doAll || mustWait; + if (flag2) + { + this._newlyCompressedBlob.WaitOne(); + } + do + { + int num = -1; + int num2 = doAll ? 200 : (mustWait ? -1 : 0); + int num3 = -1; + for (;;) + { + bool flag3 = Monitor.TryEnter(this._toWrite, num2); + if (flag3) + { + num3 = -1; + try + { + bool flag4 = this._toWrite.Count > 0; + if (flag4) + { + num3 = this._toWrite.Dequeue(); + } + } + finally + { + Monitor.Exit(this._toWrite); + } + bool flag5 = num3 >= 0; + if (flag5) + { + WorkItem workItem = this._pool[num3]; + bool flag6 = workItem.ordinal != this._lastWritten + 1; + if (flag6) + { + Queue toWrite = this._toWrite; + lock (toWrite) + { + this._toWrite.Enqueue(num3); + } + bool flag7 = num == num3; + if (flag7) + { + this._newlyCompressedBlob.WaitOne(); + num = -1; + } + else + { + bool flag8 = num == -1; + if (flag8) + { + num = num3; + } + } + } + else + { + num = -1; + this._outStream.Write(workItem.compressed, 0, workItem.compressedBytesAvailable); + this._runningCrc.Combine(workItem.crc, workItem.inputBytesAvailable); + this._totalBytesProcessed += (long)workItem.inputBytesAvailable; + workItem.inputBytesAvailable = 0; + this._lastWritten = workItem.ordinal; + this._toFill.Enqueue(workItem.index); + bool flag9 = num2 == -1; + if (flag9) + { + num2 = 0; + } + } + } + } + else + { + num3 = -1; + } + IL_1AE: + if (num3 < 0) + { + break; + } + continue; + goto IL_1AE; + } + } + while (doAll && this._lastWritten != this._latestCompressed); + this.emitting = false; + } + } + + private void _DeflateOne(object wi) + { + WorkItem workItem = (WorkItem)wi; + try + { + int index = workItem.index; + CRC32 crc = new CRC32(); + crc.SlurpBlock(workItem.buffer, 0, workItem.inputBytesAvailable); + this.DeflateOneSegment(workItem); + workItem.crc = crc.Crc32Result; + object latestLock = this._latestLock; + lock (latestLock) + { + bool flag = workItem.ordinal > this._latestCompressed; + if (flag) + { + this._latestCompressed = workItem.ordinal; + } + } + Queue toWrite = this._toWrite; + lock (toWrite) + { + this._toWrite.Enqueue(workItem.index); + } + this._newlyCompressedBlob.Set(); + } + catch (Exception pendingException) + { + object eLock = this._eLock; + lock (eLock) + { + bool flag2 = this._pendingException != null; + if (flag2) + { + this._pendingException = pendingException; + } + } + } + } + + private bool DeflateOneSegment(WorkItem workitem) + { + ZlibCodec compressor = workitem.compressor; + compressor.ResetDeflate(true); + compressor.NextIn = 0; + compressor.AvailableBytesIn = workitem.inputBytesAvailable; + compressor.NextOut = 0; + compressor.AvailableBytesOut = workitem.compressed.Length; + do + { + compressor.Deflate(FlushType.None); + } + while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0); + int num = compressor.Deflate(FlushType.Sync); + workitem.compressedBytesAvailable = (int)compressor.TotalBytesOut; + return true; + } + + [Conditional("Trace")] + private void TraceOutput(ParallelDeflateOutputStream.TraceBits bits, string format, params object[] varParams) + { + bool flag = (bits & this._DesiredTrace) > ParallelDeflateOutputStream.TraceBits.None; + if (flag) + { + object outputLock = this._outputLock; + lock (outputLock) + { + int hashCode = Thread.CurrentThread.GetHashCode(); + } + } + } + + public override int Read(byte[] buffer, int offset, int count) + { + throw new NotSupportedException(); + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotSupportedException(); + } + + public override void SetLength(long value) + { + throw new NotSupportedException(); + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs.meta new file mode 100644 index 00000000..569f26aa --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ParallelDeflateOutputStream.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 624c5482b54eed04185749806883eb5f +timeCreated: 1611465653 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs new file mode 100644 index 00000000..6ad43d38 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Text; + +namespace Ionic.Zlib +{ + internal class SharedUtils + { + public static int URShift(int number, int bits) + { + return (int)((uint)number >> bits); + } + + public static int ReadInput(TextReader sourceTextReader, byte[] target, int start, int count) + { + bool flag = target.Length == 0; + int result; + if (flag) + { + result = 0; + } + else + { + char[] array = new char[target.Length]; + int num = sourceTextReader.Read(array, start, count); + bool flag2 = num == 0; + if (flag2) + { + result = -1; + } + else + { + for (int i = start; i < start + num; i++) + { + target[i] = (byte)array[i]; + } + result = num; + } + } + return result; + } + + internal static byte[] ToByteArray(string sourceString) + { + return Encoding.UTF8.GetBytes(sourceString); + } + + internal static char[] ToCharArray(byte[] byteArray) + { + return Encoding.UTF8.GetChars(byteArray); + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs.meta new file mode 100644 index 00000000..aa3a40e8 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/SharedUtils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 486d9679f2103ca48ae52263d256f3a6 +timeCreated: 1611465639 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs new file mode 100644 index 00000000..e1511cbc --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs @@ -0,0 +1,676 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class StaticTree + { + internal static readonly short[] lengthAndLiteralsTreeCodes = new short[] + { + 12, + 8, + 140, + 8, + 76, + 8, + 204, + 8, + 44, + 8, + 172, + 8, + 108, + 8, + 236, + 8, + 28, + 8, + 156, + 8, + 92, + 8, + 220, + 8, + 60, + 8, + 188, + 8, + 124, + 8, + 252, + 8, + 2, + 8, + 130, + 8, + 66, + 8, + 194, + 8, + 34, + 8, + 162, + 8, + 98, + 8, + 226, + 8, + 18, + 8, + 146, + 8, + 82, + 8, + 210, + 8, + 50, + 8, + 178, + 8, + 114, + 8, + 242, + 8, + 10, + 8, + 138, + 8, + 74, + 8, + 202, + 8, + 42, + 8, + 170, + 8, + 106, + 8, + 234, + 8, + 26, + 8, + 154, + 8, + 90, + 8, + 218, + 8, + 58, + 8, + 186, + 8, + 122, + 8, + 250, + 8, + 6, + 8, + 134, + 8, + 70, + 8, + 198, + 8, + 38, + 8, + 166, + 8, + 102, + 8, + 230, + 8, + 22, + 8, + 150, + 8, + 86, + 8, + 214, + 8, + 54, + 8, + 182, + 8, + 118, + 8, + 246, + 8, + 14, + 8, + 142, + 8, + 78, + 8, + 206, + 8, + 46, + 8, + 174, + 8, + 110, + 8, + 238, + 8, + 30, + 8, + 158, + 8, + 94, + 8, + 222, + 8, + 62, + 8, + 190, + 8, + 126, + 8, + 254, + 8, + 1, + 8, + 129, + 8, + 65, + 8, + 193, + 8, + 33, + 8, + 161, + 8, + 97, + 8, + 225, + 8, + 17, + 8, + 145, + 8, + 81, + 8, + 209, + 8, + 49, + 8, + 177, + 8, + 113, + 8, + 241, + 8, + 9, + 8, + 137, + 8, + 73, + 8, + 201, + 8, + 41, + 8, + 169, + 8, + 105, + 8, + 233, + 8, + 25, + 8, + 153, + 8, + 89, + 8, + 217, + 8, + 57, + 8, + 185, + 8, + 121, + 8, + 249, + 8, + 5, + 8, + 133, + 8, + 69, + 8, + 197, + 8, + 37, + 8, + 165, + 8, + 101, + 8, + 229, + 8, + 21, + 8, + 149, + 8, + 85, + 8, + 213, + 8, + 53, + 8, + 181, + 8, + 117, + 8, + 245, + 8, + 13, + 8, + 141, + 8, + 77, + 8, + 205, + 8, + 45, + 8, + 173, + 8, + 109, + 8, + 237, + 8, + 29, + 8, + 157, + 8, + 93, + 8, + 221, + 8, + 61, + 8, + 189, + 8, + 125, + 8, + 253, + 8, + 19, + 9, + 275, + 9, + 147, + 9, + 403, + 9, + 83, + 9, + 339, + 9, + 211, + 9, + 467, + 9, + 51, + 9, + 307, + 9, + 179, + 9, + 435, + 9, + 115, + 9, + 371, + 9, + 243, + 9, + 499, + 9, + 11, + 9, + 267, + 9, + 139, + 9, + 395, + 9, + 75, + 9, + 331, + 9, + 203, + 9, + 459, + 9, + 43, + 9, + 299, + 9, + 171, + 9, + 427, + 9, + 107, + 9, + 363, + 9, + 235, + 9, + 491, + 9, + 27, + 9, + 283, + 9, + 155, + 9, + 411, + 9, + 91, + 9, + 347, + 9, + 219, + 9, + 475, + 9, + 59, + 9, + 315, + 9, + 187, + 9, + 443, + 9, + 123, + 9, + 379, + 9, + 251, + 9, + 507, + 9, + 7, + 9, + 263, + 9, + 135, + 9, + 391, + 9, + 71, + 9, + 327, + 9, + 199, + 9, + 455, + 9, + 39, + 9, + 295, + 9, + 167, + 9, + 423, + 9, + 103, + 9, + 359, + 9, + 231, + 9, + 487, + 9, + 23, + 9, + 279, + 9, + 151, + 9, + 407, + 9, + 87, + 9, + 343, + 9, + 215, + 9, + 471, + 9, + 55, + 9, + 311, + 9, + 183, + 9, + 439, + 9, + 119, + 9, + 375, + 9, + 247, + 9, + 503, + 9, + 15, + 9, + 271, + 9, + 143, + 9, + 399, + 9, + 79, + 9, + 335, + 9, + 207, + 9, + 463, + 9, + 47, + 9, + 303, + 9, + 175, + 9, + 431, + 9, + 111, + 9, + 367, + 9, + 239, + 9, + 495, + 9, + 31, + 9, + 287, + 9, + 159, + 9, + 415, + 9, + 95, + 9, + 351, + 9, + 223, + 9, + 479, + 9, + 63, + 9, + 319, + 9, + 191, + 9, + 447, + 9, + 127, + 9, + 383, + 9, + 255, + 9, + 511, + 9, + 0, + 7, + 64, + 7, + 32, + 7, + 96, + 7, + 16, + 7, + 80, + 7, + 48, + 7, + 112, + 7, + 8, + 7, + 72, + 7, + 40, + 7, + 104, + 7, + 24, + 7, + 88, + 7, + 56, + 7, + 120, + 7, + 4, + 7, + 68, + 7, + 36, + 7, + 100, + 7, + 20, + 7, + 84, + 7, + 52, + 7, + 116, + 7, + 3, + 8, + 131, + 8, + 67, + 8, + 195, + 8, + 35, + 8, + 163, + 8, + 99, + 8, + 227, + 8 + }; + + internal static readonly short[] distTreeCodes = new short[] + { + 0, + 5, + 16, + 5, + 8, + 5, + 24, + 5, + 4, + 5, + 20, + 5, + 12, + 5, + 28, + 5, + 2, + 5, + 18, + 5, + 10, + 5, + 26, + 5, + 6, + 5, + 22, + 5, + 14, + 5, + 30, + 5, + 1, + 5, + 17, + 5, + 9, + 5, + 25, + 5, + 5, + 5, + 21, + 5, + 13, + 5, + 29, + 5, + 3, + 5, + 19, + 5, + 11, + 5, + 27, + 5, + 7, + 5, + 23, + 5 + }; + + internal static readonly StaticTree Literals = new StaticTree(StaticTree.lengthAndLiteralsTreeCodes, Tree.ExtraLengthBits, InternalConstants.LITERALS + 1, InternalConstants.L_CODES, InternalConstants.MAX_BITS); + + internal static readonly StaticTree Distances = new StaticTree(StaticTree.distTreeCodes, Tree.ExtraDistanceBits, 0, InternalConstants.D_CODES, InternalConstants.MAX_BITS); + + internal static readonly StaticTree BitLengths = new StaticTree(null, Tree.extra_blbits, 0, InternalConstants.BL_CODES, InternalConstants.MAX_BL_BITS); + + internal short[] treeCodes; + + internal int[] extraBits; + + internal int extraBase; + + internal int elems; + + internal int maxLength; + + private StaticTree(short[] treeCodes, int[] extraBits, int extraBase, int elems, int maxLength) + { + this.treeCodes = treeCodes; + this.extraBits = extraBits; + this.extraBase = extraBase; + this.elems = elems; + this.maxLength = maxLength; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs.meta new file mode 100644 index 00000000..b2d37050 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/StaticTree.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dcac8c430eedb60499be0d97dc3228f1 +timeCreated: 1611465796 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs new file mode 100644 index 00000000..5f250c1b --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs @@ -0,0 +1,1184 @@ +using System; + +namespace Ionic.Zlib +{ + internal sealed class Tree + { + private static readonly int HEAP_SIZE = 2 * InternalConstants.L_CODES + 1; + + internal static readonly int[] ExtraLengthBits = new int[] + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 4, + 5, + 5, + 5, + 5, + 0 + }; + + internal static readonly int[] ExtraDistanceBits = new int[] + { + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 2, + 3, + 3, + 4, + 4, + 5, + 5, + 6, + 6, + 7, + 7, + 8, + 8, + 9, + 9, + 10, + 10, + 11, + 11, + 12, + 12, + 13, + 13 + }; + + internal static readonly int[] extra_blbits = new int[] + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2, + 3, + 7 + }; + + internal static readonly sbyte[] bl_order = new sbyte[] + { + 16, + 17, + 18, + 0, + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15 + }; + + internal const int Buf_size = 16; + + private static readonly sbyte[] _dist_code = new sbyte[] + { + 0, + 1, + 2, + 3, + 4, + 4, + 5, + 5, + 6, + 6, + 6, + 6, + 7, + 7, + 7, + 7, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 8, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 11, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 12, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 13, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 14, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 0, + 0, + 16, + 17, + 18, + 18, + 19, + 19, + 20, + 20, + 20, + 20, + 21, + 21, + 21, + 21, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 28, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29, + 29 + }; + + internal static readonly sbyte[] LengthCode = new sbyte[] + { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 8, + 9, + 9, + 10, + 10, + 11, + 11, + 12, + 12, + 12, + 12, + 13, + 13, + 13, + 13, + 14, + 14, + 14, + 14, + 15, + 15, + 15, + 15, + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 18, + 18, + 18, + 18, + 18, + 18, + 18, + 18, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 19, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 20, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 21, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 22, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 23, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 24, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 25, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 26, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 27, + 28 + }; + + internal static readonly int[] LengthBase = new int[] + { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 10, + 12, + 14, + 16, + 20, + 24, + 28, + 32, + 40, + 48, + 56, + 64, + 80, + 96, + 112, + 128, + 160, + 192, + 224, + 0 + }; + + internal static readonly int[] DistanceBase = new int[] + { + 0, + 1, + 2, + 3, + 4, + 6, + 8, + 12, + 16, + 24, + 32, + 48, + 64, + 96, + 128, + 192, + 256, + 384, + 512, + 768, + 1024, + 1536, + 2048, + 3072, + 4096, + 6144, + 8192, + 12288, + 16384, + 24576 + }; + + internal short[] dyn_tree; + + internal int max_code; + + internal StaticTree staticTree; + + internal static int DistanceCode(int dist) + { + return (int)((dist < 256) ? Tree._dist_code[dist] : Tree._dist_code[256 + SharedUtils.URShift(dist, 7)]); + } + + internal void gen_bitlen(DeflateManager s) + { + short[] array = this.dyn_tree; + short[] treeCodes = this.staticTree.treeCodes; + int[] extraBits = this.staticTree.extraBits; + int extraBase = this.staticTree.extraBase; + int maxLength = this.staticTree.maxLength; + int num = 0; + for (int i = 0; i <= InternalConstants.MAX_BITS; i++) + { + s.bl_count[i] = 0; + } + array[s.heap[s.heap_max] * 2 + 1] = 0; + int j; + for (j = s.heap_max + 1; j < Tree.HEAP_SIZE; j++) + { + int k = s.heap[j]; + int i = (int)(array[(int)(array[k * 2 + 1] * 2 + 1)] + 1); + bool flag = i > maxLength; + if (flag) + { + i = maxLength; + num++; + } + array[k * 2 + 1] = (short)i; + bool flag2 = k > this.max_code; + if (!flag2) + { + short[] bl_count = s.bl_count; + int num2 = i; + bl_count[num2] += 1; + int num3 = 0; + bool flag3 = k >= extraBase; + if (flag3) + { + num3 = extraBits[k - extraBase]; + } + short num4 = array[k * 2]; + s.opt_len += (int)num4 * (i + num3); + bool flag4 = treeCodes != null; + if (flag4) + { + s.static_len += (int)num4 * ((int)treeCodes[k * 2 + 1] + num3); + } + } + } + bool flag5 = num == 0; + if (!flag5) + { + do + { + int i = maxLength - 1; + while (s.bl_count[i] == 0) + { + i--; + } + short[] bl_count2 = s.bl_count; + int num5 = i; + bl_count2[num5] -= 1; + s.bl_count[i + 1] = (short) ( s.bl_count[i + 1] + 2 ); + short[] bl_count3 = s.bl_count; + int num6 = maxLength; + bl_count3[num6] -= 1; + num -= 2; + } + while (num > 0); + for (int i = maxLength; i != 0; i--) + { + int k = (int)s.bl_count[i]; + while (k != 0) + { + int num7 = s.heap[--j]; + bool flag6 = num7 > this.max_code; + if (!flag6) + { + bool flag7 = (int)array[num7 * 2 + 1] != i; + if (flag7) + { + s.opt_len = (int)((long)s.opt_len + ((long)i - (long)array[num7 * 2 + 1]) * (long)array[num7 * 2]); + array[num7 * 2 + 1] = (short)i; + } + k--; + } + } + } + } + } + + internal void build_tree(DeflateManager s) + { + short[] array = this.dyn_tree; + short[] treeCodes = this.staticTree.treeCodes; + int elems = this.staticTree.elems; + int num = -1; + s.heap_len = 0; + s.heap_max = Tree.HEAP_SIZE; + int num2; + for (int i = 0; i < elems; i++) + { + bool flag = array[i * 2] != 0; + if (flag) + { + int[] heap = s.heap; + num2 = s.heap_len + 1; + s.heap_len = num2; + num = (heap[num2] = i); + s.depth[i] = 0; + } + else + { + array[i * 2 + 1] = 0; + } + } + int num3; + while (s.heap_len < 2) + { + int[] heap2 = s.heap; + num2 = s.heap_len + 1; + s.heap_len = num2; + num3 = (heap2[num2] = ((num < 2) ? (++num) : 0)); + array[num3 * 2] = 1; + s.depth[num3] = 0; + s.opt_len--; + bool flag2 = treeCodes != null; + if (flag2) + { + s.static_len -= (int)treeCodes[num3 * 2 + 1]; + } + } + this.max_code = num; + for (int i = s.heap_len / 2; i >= 1; i--) + { + s.pqdownheap(array, i); + } + num3 = elems; + do + { + int i = s.heap[1]; + int[] heap3 = s.heap; + int num4 = 1; + int[] heap4 = s.heap; + num2 = s.heap_len; + s.heap_len = num2 - 1; + heap3[num4] = heap4[num2]; + s.pqdownheap(array, 1); + int num5 = s.heap[1]; + int[] heap5 = s.heap; + num2 = s.heap_max - 1; + s.heap_max = num2; + heap5[num2] = i; + int[] heap6 = s.heap; + num2 = s.heap_max - 1; + s.heap_max = num2; + heap6[num2] = num5; + array[num3 * 2] = (short) ( array[i * 2] + array[num5 * 2] ); + s.depth[num3] = (sbyte)(Math.Max((byte)s.depth[i], (byte)s.depth[num5]) + 1); + array[i * 2 + 1] = (array[num5 * 2 + 1] = (short)num3); + s.heap[1] = num3++; + s.pqdownheap(array, 1); + } + while (s.heap_len >= 2); + int[] heap7 = s.heap; + num2 = s.heap_max - 1; + s.heap_max = num2; + heap7[num2] = s.heap[1]; + this.gen_bitlen(s); + Tree.gen_codes(array, num, s.bl_count); + } + + internal static void gen_codes(short[] tree, int max_code, short[] bl_count) + { + short[] array = new short[InternalConstants.MAX_BITS + 1]; + short num = 0; + for (int i = 1; i <= InternalConstants.MAX_BITS; i++) + { + num = (array[i] = (short)(num + bl_count[i - 1] << 1)); + } + for (int j = 0; j <= max_code; j++) + { + int num2 = (int)tree[j * 2 + 1]; + bool flag = num2 == 0; + if (!flag) + { + int num3 = j * 2; + short[] array2 = array; + int num4 = num2; + short num5 = array2[num4]; + array2[num4] = (short) ( num5 + 1 ); + tree[num3] = (short)Tree.bi_reverse((int)num5, num2); + } + } + } + + internal static int bi_reverse(int code, int len) + { + int num = 0; + do + { + num |= (code & 1); + code >>= 1; + num <<= 1; + } + while (--len > 0); + return num >> 1; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs.meta new file mode 100644 index 00000000..68f72769 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/Tree.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 82ccf969c9ce78c49974c4eecebda087 +timeCreated: 1611465694 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs new file mode 100644 index 00000000..ba802f8e --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs @@ -0,0 +1,35 @@ +using System; + +namespace Ionic.Zlib +{ + internal class WorkItem + { + public byte[] buffer; + + public byte[] compressed; + + public int crc; + + public int index; + + public int ordinal; + + public int inputBytesAvailable; + + public int compressedBytesAvailable; + + public ZlibCodec compressor; + + public WorkItem(int size, CompressionLevel compressLevel, CompressionStrategy strategy, int ix) + { + this.buffer = new byte[size]; + int num = size + (size / 32768 + 1) * 5 * 2; + this.compressed = new byte[num]; + this.compressor = new ZlibCodec(); + this.compressor.InitializeDeflate(compressLevel, false); + this.compressor.OutputBuffer = this.compressed; + this.compressor.InputBuffer = this.buffer; + this.index = ix; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs.meta new file mode 100644 index 00000000..d059e3ff --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/WorkItem.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 23c52360d96dd6049935c0bd40dbba80 +timeCreated: 1611465300 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs new file mode 100644 index 00000000..18a76dca --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs @@ -0,0 +1,718 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Ionic.Crc; + +namespace Ionic.Zlib +{ + internal class ZlibBaseStream : Stream + { + internal int Crc32 + { + get + { + bool flag = this.crc == null; + int result; + if (flag) + { + result = 0; + } + else + { + result = this.crc.Crc32Result; + } + return result; + } + } + + protected internal bool _wantCompress + { + get + { + return this._compressionMode == CompressionMode.Compress; + } + } + + private ZlibCodec z + { + get + { + bool flag = this._z == null; + if (flag) + { + bool flag2 = this._flavor == ZlibStreamFlavor.ZLIB; + this._z = new ZlibCodec(); + bool flag3 = this._compressionMode == CompressionMode.Decompress; + if (flag3) + { + this._z.InitializeInflate(flag2); + } + else + { + this._z.Strategy = this.Strategy; + this._z.InitializeDeflate(this._level, flag2); + } + } + return this._z; + } + } + + private byte[] workingBuffer + { + get + { + bool flag = this._workingBuffer == null; + if (flag) + { + this._workingBuffer = new byte[this._bufferSize]; + } + return this._workingBuffer; + } + } + + public override bool CanRead + { + get + { + return this._stream.CanRead; + } + } + + public override bool CanSeek + { + get + { + return this._stream.CanSeek; + } + } + + public override bool CanWrite + { + get + { + return this._stream.CanWrite; + } + } + + public override long Length + { + get + { + return this._stream.Length; + } + } + + public override long Position + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + protected internal ZlibCodec _z = null; + + protected internal ZlibBaseStream.StreamMode _streamMode = ZlibBaseStream.StreamMode.Undefined; + + protected internal FlushType _flushMode; + + protected internal ZlibStreamFlavor _flavor; + + protected internal CompressionMode _compressionMode; + + protected internal CompressionLevel _level; + + protected internal bool _leaveOpen; + + protected internal byte[] _workingBuffer; + + protected internal int _bufferSize = 16384; + + protected internal byte[] _buf1 = new byte[1]; + + protected internal Stream _stream; + + protected internal CompressionStrategy Strategy = CompressionStrategy.Default; + + private CRC32 crc; + + protected internal string _GzipFileName; + + protected internal string _GzipComment; + + protected internal DateTime _GzipMtime; + + protected internal int _gzipHeaderByteCount; + + private bool nomoreinput = false; + + internal enum StreamMode + { + Writer, + Reader, + Undefined + } + + public ZlibBaseStream(Stream stream, CompressionMode compressionMode, CompressionLevel level, ZlibStreamFlavor flavor, bool leaveOpen) + { + this._flushMode = FlushType.None; + this._stream = stream; + this._leaveOpen = leaveOpen; + this._compressionMode = compressionMode; + this._flavor = flavor; + this._level = level; + bool flag = flavor == ZlibStreamFlavor.GZIP; + if (flag) + { + this.crc = new CRC32(); + } + } + + public override void Write(byte[] buffer, int offset, int count) + { + bool flag = this.crc != null; + if (flag) + { + this.crc.SlurpBlock(buffer, offset, count); + } + bool flag2 = this._streamMode == ZlibBaseStream.StreamMode.Undefined; + if (flag2) + { + this._streamMode = ZlibBaseStream.StreamMode.Writer; + } + else + { + bool flag3 = this._streamMode > ZlibBaseStream.StreamMode.Writer; + if (flag3) + { + throw new ZlibException("Cannot Write after Reading."); + } + } + bool flag4 = count == 0; + if (!flag4) + { + this.z.InputBuffer = buffer; + this._z.Reset(); + this._z.NextIn = offset; + this._z.AvailableBytesIn = count; + for (;;) + { + this._z.OutputBuffer = this.workingBuffer; + this._z.NextOut = 0; + this._z.AvailableBytesOut = this._workingBuffer.Length; + int num = this._wantCompress ? this._z.Deflate(this._flushMode) : this._z.Inflate(this._flushMode); + bool flag5 = num != 0 && num != 1; + if (flag5) + { + break; + } + this._stream.Write(this._workingBuffer, 0, this._workingBuffer.Length - this._z.AvailableBytesOut); + bool flag6 = this._z.AvailableBytesIn == 0 && this._z.AvailableBytesOut != 0; + bool flag7 = this._flavor == ZlibStreamFlavor.GZIP && !this._wantCompress; + if (flag7) + { + flag6 = (this._z.AvailableBytesIn == 8 && this._z.AvailableBytesOut != 0); + } + if (flag6) + { + return; + } + } + throw new ZlibException((this._wantCompress ? "de" : "in") + "flating: " + this._z.Message); + } + } + + private void finish() + { + bool flag = this._z == null; + if (!flag) + { + bool flag2 = this._streamMode == ZlibBaseStream.StreamMode.Writer; + if (flag2) + { + int num; + for (;;) + { + this._z.OutputBuffer = this.workingBuffer; + this._z.NextOut = 0; + this._z.AvailableBytesOut = this._workingBuffer.Length; + num = (this._wantCompress ? this._z.Deflate(FlushType.Finish) : this._z.Inflate(FlushType.Finish)); + bool flag3 = num != 1 && num != 0; + if (flag3) + { + break; + } + bool flag4 = this._workingBuffer.Length - this._z.AvailableBytesOut > 0; + if (flag4) + { + this._stream.Write(this._workingBuffer, 0, this._workingBuffer.Length - this._z.AvailableBytesOut); + } + bool flag5 = this._z.AvailableBytesIn == 0 && this._z.AvailableBytesOut != 0; + bool flag6 = this._flavor == ZlibStreamFlavor.GZIP && !this._wantCompress; + if (flag6) + { + flag5 = (this._z.AvailableBytesIn == 8 && this._z.AvailableBytesOut != 0); + } + if (flag5) + { + goto Block_12; + } + } + string text = (this._wantCompress ? "de" : "in") + "flating"; + bool flag7 = this._z.Message == null; + if (flag7) + { + throw new ZlibException(string.Format("{0}: (rc = {1})", text, num)); + } + throw new ZlibException(text + ": " + this._z.Message); + Block_12: + this.Flush(); + bool flag8 = this._flavor == ZlibStreamFlavor.GZIP; + if (flag8) + { + bool wantCompress = this._wantCompress; + if (!wantCompress) + { + throw new ZlibException("Writing with decompression is not supported."); + } + int crc32Result = this.crc.Crc32Result; + this._stream.Write(BitConverter.GetBytes(crc32Result), 0, 4); + int value = (int)(this.crc.TotalBytesRead & (long)(-1)); //! + this._stream.Write(BitConverter.GetBytes(value), 0, 4); + } + } + else + { + bool flag9 = this._streamMode == ZlibBaseStream.StreamMode.Reader; + if (flag9) + { + bool flag10 = this._flavor == ZlibStreamFlavor.GZIP; + if (flag10) + { + bool flag11 = !this._wantCompress; + if (!flag11) + { + throw new ZlibException("Reading with compression is not supported."); + } + bool flag12 = this._z.TotalBytesOut == 0L; + if (!flag12) + { + byte[] array = new byte[8]; + bool flag13 = this._z.AvailableBytesIn < 8; + if (flag13) + { + Array.Copy(this._z.InputBuffer, this._z.NextIn, array, 0, this._z.AvailableBytesIn); + int num2 = 8 - this._z.AvailableBytesIn; + int num3 = this._stream.Read(array, this._z.AvailableBytesIn, num2); + bool flag14 = num2 != num3; + if (flag14) + { + throw new ZlibException(string.Format("Missing or incomplete GZIP trailer. Expected 8 bytes, got {0}.", this._z.AvailableBytesIn + num3)); + } + } + else + { + Array.Copy(this._z.InputBuffer, this._z.NextIn, array, 0, array.Length); + } + int num4 = BitConverter.ToInt32(array, 0); + int crc32Result2 = this.crc.Crc32Result; + int num5 = BitConverter.ToInt32(array, 4); + int num6 = (int)(this._z.TotalBytesOut & (long)(-1)); //! + bool flag15 = crc32Result2 != num4; + if (flag15) + { + throw new ZlibException(string.Format("Bad CRC32 in GZIP trailer. (actual({0:X8})!=expected({1:X8}))", crc32Result2, num4)); + } + bool flag16 = num6 != num5; + if (flag16) + { + throw new ZlibException(string.Format("Bad size in GZIP trailer. (actual({0})!=expected({1}))", num6, num5)); + } + } + } + } + } + } + } + + private void end() + { + bool flag = this.z == null; + if (!flag) + { + bool wantCompress = this._wantCompress; + if (wantCompress) + { + this._z.EndDeflate(); + } + else + { + this._z.EndInflate(); + } + this._z = null; + } + } + + public override void Close() + { + bool flag = this._stream == null; + if (!flag) + { + try + { + this.finish(); + } + finally + { + this.end(); + bool flag2 = !this._leaveOpen; + if (flag2) + { + this._stream.Close(); + } + this._stream = null; + } + } + } + + public override void Flush() + { + this._stream.Flush(); + } + + public override long Seek(long offset, SeekOrigin origin) + { + return this._stream.Seek(offset, origin); + } + + public override void SetLength(long value) + { + this._stream.SetLength(value); + } + + private string ReadZeroTerminatedString() + { + List list = new List(); + bool flag = false; + for (;;) + { + int num = this._stream.Read(this._buf1, 0, 1); + bool flag2 = num != 1; + if (flag2) + { + break; + } + bool flag3 = this._buf1[0] == 0; + if (flag3) + { + flag = true; + } + else + { + list.Add(this._buf1[0]); + } + if (flag) + { + goto Block_3; + } + } + throw new ZlibException("Unexpected EOF reading GZIP header."); + Block_3: + byte[] array = list.ToArray(); + return GZipStream.iso8859dash1.GetString(array, 0, array.Length); + } + + private int _ReadAndValidateGzipHeader() + { + int num = 0; + byte[] array = new byte[10]; + int num2 = this._stream.Read(array, 0, array.Length); + bool flag = num2 == 0; + int result; + if (flag) + { + result = 0; + } + else + { + bool flag2 = num2 != 10; + if (flag2) + { + throw new ZlibException("Not a valid GZIP stream."); + } + bool flag3 = array[0] != 31 || array[1] != 139 || array[2] != 8; + if (flag3) + { + throw new ZlibException("Bad GZIP header."); + } + int num3 = BitConverter.ToInt32(array, 4); + this._GzipMtime = GZipStream._unixEpoch.AddSeconds((double)num3); + num += num2; + bool flag4 = (array[3] & 4) == 4; + if (flag4) + { + num2 = this._stream.Read(array, 0, 2); + num += num2; + short num4 = (short)((int)array[0] + (int)array[1] * 256); + byte[] array2 = new byte[(int)num4]; + num2 = this._stream.Read(array2, 0, array2.Length); + bool flag5 = num2 != (int)num4; + if (flag5) + { + throw new ZlibException("Unexpected end-of-file reading GZIP header."); + } + num += num2; + } + bool flag6 = (array[3] & 8) == 8; + if (flag6) + { + this._GzipFileName = this.ReadZeroTerminatedString(); + } + bool flag7 = (array[3] & 16) == 16; + if (flag7) + { + this._GzipComment = this.ReadZeroTerminatedString(); + } + bool flag8 = (array[3] & 2) == 2; + if (flag8) + { + this.Read(this._buf1, 0, 1); + } + result = num; + } + return result; + } + + public override int Read(byte[] buffer, int offset, int count) + { + bool flag = this._streamMode == ZlibBaseStream.StreamMode.Undefined; + if (flag) + { + bool flag2 = !this._stream.CanRead; + if (flag2) + { + throw new ZlibException("The stream is not readable."); + } + this._streamMode = ZlibBaseStream.StreamMode.Reader; + this.z.AvailableBytesIn = 0; + bool flag3 = this._flavor == ZlibStreamFlavor.GZIP; + if (flag3) + { + this._gzipHeaderByteCount = this._ReadAndValidateGzipHeader(); + bool flag4 = this._gzipHeaderByteCount == 0; + if (flag4) + { + return 0; + } + } + } + bool flag5 = this._streamMode != ZlibBaseStream.StreamMode.Reader; + if (flag5) + { + throw new ZlibException("Cannot Read after Writing."); + } + bool flag6 = count == 0; + int result = 0; + if (flag6) + { + result = 0; + } + else + { + bool flag7 = this.nomoreinput && this._wantCompress; + if (flag7) + { + result = 0; + } + else + { + bool flag8 = buffer == null; + if (flag8) + { + throw new ArgumentNullException("buffer"); + } + bool flag9 = count < 0; + if (flag9) + { + throw new ArgumentOutOfRangeException("count"); + } + bool flag10 = offset < buffer.GetLowerBound(0); + if (flag10) + { + throw new ArgumentOutOfRangeException("offset"); + } + bool flag11 = offset + count > buffer.GetLength(0); + if (flag11) + { + throw new ArgumentOutOfRangeException("count"); + } + this._z.OutputBuffer = buffer; + this._z.NextOut = offset; + this._z.AvailableBytesOut = count; + this._z.InputBuffer = this.workingBuffer; + int num; + for (;;) + { + bool flag12 = this._z.AvailableBytesIn == 0 && !this.nomoreinput; + if (flag12) + { + this._z.NextIn = 0; + this._z.AvailableBytesIn = this._stream.Read(this._workingBuffer, 0, this._workingBuffer.Length); + bool flag13 = this._z.AvailableBytesIn == 0; + if (flag13) + { + this.nomoreinput = true; + } + } + num = (this._wantCompress ? this._z.Deflate(this._flushMode) : this._z.Inflate(this._flushMode)); + bool flag14 = this.nomoreinput && num == -5; + if (flag14) + { + break; + } + bool flag15 = num != 0 && num != 1; + if (flag15) + { + goto Block_20; + } + bool flag16 = (this.nomoreinput || num == 1) && this._z.AvailableBytesOut == count; + if (flag16) + { + goto Block_23; + } + if (this._z.AvailableBytesOut <= 0 || this.nomoreinput || num != 0) + { + goto IL_2AA; + } + } + return 0; + Block_20: + throw new ZlibException(string.Format("{0}flating: rc={1} msg={2}", this._wantCompress ? "de" : "in", num, this._z.Message)); + Block_23: + IL_2AA: + bool flag17 = this._z.AvailableBytesOut > 0; + if (flag17) + { + bool flag18 = num == 0 && this._z.AvailableBytesIn == 0; + if (flag18) + { + } + bool flag19 = this.nomoreinput; + if (flag19) + { + bool wantCompress = this._wantCompress; + if (wantCompress) + { + num = this._z.Deflate(FlushType.Finish); + bool flag20 = num != 0 && num != 1; + if (flag20) + { + throw new ZlibException(string.Format("Deflating: rc={0} msg={1}", num, this._z.Message)); + } + } + } + } + num = count - this._z.AvailableBytesOut; + bool flag21 = this.crc != null; + if (flag21) + { + this.crc.SlurpBlock(buffer, offset, num); + } + result = num; + } + } + return result; + } + + public static void CompressString(string s, Stream compressor) + { + byte[] bytes = Encoding.UTF8.GetBytes(s); + try + { + compressor.Write(bytes, 0, bytes.Length); + } + finally + { + if (compressor != null) + { + ((IDisposable)compressor).Dispose(); + } + } + } + + public static void CompressBuffer(byte[] b, Stream compressor) + { + try + { + compressor.Write(b, 0, b.Length); + } + finally + { + if (compressor != null) + { + ((IDisposable)compressor).Dispose(); + } + } + } + + public static string UncompressString(byte[] compressed, Stream decompressor) + { + byte[] array = new byte[1024]; + Encoding utf = Encoding.UTF8; + string result; + using (MemoryStream memoryStream = new MemoryStream()) + { + try + { + int count; + while ((count = decompressor.Read(array, 0, array.Length)) != 0) + { + memoryStream.Write(array, 0, count); + } + } + finally + { + if (decompressor != null) + { + ((IDisposable)decompressor).Dispose(); + } + } + memoryStream.Seek(0L, SeekOrigin.Begin); + StreamReader streamReader = new StreamReader(memoryStream, utf); + result = streamReader.ReadToEnd(); + } + return result; + } + + public static byte[] UncompressBuffer(byte[] compressed, Stream decompressor) + { + byte[] array = new byte[1024]; + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + try + { + int count; + while ((count = decompressor.Read(array, 0, array.Length)) != 0) + { + memoryStream.Write(array, 0, count); + } + } + finally + { + if (decompressor != null) + { + ((IDisposable)decompressor).Dispose(); + } + } + result = memoryStream.ToArray(); + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs.meta new file mode 100644 index 00000000..c6027272 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibBaseStream.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ea148a1efaffee94ba8043fda34961dc +timeCreated: 1611465804 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs new file mode 100644 index 00000000..397d505e --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs @@ -0,0 +1,315 @@ +using System; +using System.Runtime.InteropServices; + +namespace Ionic.Zlib +{ + [Guid("ebc25cf6-9120-4283-b972-0e5520d0000D")] + [ComVisible(true)] + [ClassInterface(ClassInterfaceType.AutoDispatch)] + public sealed class ZlibCodec + { + public int Adler32 + { + get + { + return (int)this._Adler32; + } + } + + public byte[] InputBuffer; + + public int NextIn; + + public int AvailableBytesIn; + + public long TotalBytesIn; + + public byte[] OutputBuffer; + + public int NextOut; + + public int AvailableBytesOut; + + public long TotalBytesOut; + + public string Message; + + internal DeflateManager dstate; + + internal InflateManager istate; + + internal uint _Adler32; + + public CompressionLevel CompressLevel = CompressionLevel.Default; + + public int WindowBits = 15; + + public CompressionStrategy Strategy = CompressionStrategy.Default; + + public ZlibCodec() + { + } + + public ZlibCodec(CompressionMode mode) + { + bool flag = mode == CompressionMode.Compress; + if (flag) + { + int num = this.InitializeDeflate(); + bool flag2 = num != 0; + if (flag2) + { + throw new ZlibException("Cannot initialize for deflate."); + } + } + else + { + bool flag3 = mode == CompressionMode.Decompress; + if (!flag3) + { + throw new ZlibException("Invalid ZlibStreamFlavor."); + } + int num2 = this.InitializeInflate(); + bool flag4 = num2 != 0; + if (flag4) + { + throw new ZlibException("Cannot initialize for inflate."); + } + } + } + + public int InitializeInflate() + { + return this.InitializeInflate(this.WindowBits); + } + + public int InitializeInflate(bool expectRfc1950Header) + { + return this.InitializeInflate(this.WindowBits, expectRfc1950Header); + } + + public int InitializeInflate(int windowBits) + { + this.WindowBits = windowBits; + return this.InitializeInflate(windowBits, true); + } + + public int InitializeInflate(int windowBits, bool expectRfc1950Header) + { + this.WindowBits = windowBits; + bool flag = this.dstate != null; + if (flag) + { + throw new ZlibException("You may not call InitializeInflate() after calling InitializeDeflate()."); + } + this.istate = new InflateManager(expectRfc1950Header); + return this.istate.Initialize(this, windowBits); + } + + public int Inflate(FlushType flush) + { + bool flag = this.istate == null; + if (flag) + { + throw new ZlibException("No Inflate State!"); + } + return this.istate.Inflate(flush); + } + + public void Reset() + { + bool flag = this.istate == null; + if (flag) + { + throw new ZlibException("No Inflate State!"); + } + this.istate.Reset(); + } + + public int EndInflate() + { + bool flag = this.istate == null; + if (flag) + { + throw new ZlibException("No Inflate State!"); + } + int result = this.istate.End(); + this.istate = null; + return result; + } + + public int SyncInflate() + { + bool flag = this.istate == null; + if (flag) + { + throw new ZlibException("No Inflate State!"); + } + return this.istate.Sync(); + } + + public int InitializeDeflate() + { + return this._InternalInitializeDeflate(true); + } + + public int InitializeDeflate(CompressionLevel level) + { + this.CompressLevel = level; + return this._InternalInitializeDeflate(true); + } + + public int InitializeDeflate(CompressionLevel level, bool wantRfc1950Header) + { + this.CompressLevel = level; + return this._InternalInitializeDeflate(wantRfc1950Header); + } + + public int InitializeDeflate(CompressionLevel level, int bits) + { + this.CompressLevel = level; + this.WindowBits = bits; + return this._InternalInitializeDeflate(true); + } + + public int InitializeDeflate(CompressionLevel level, int bits, bool wantRfc1950Header) + { + this.CompressLevel = level; + this.WindowBits = bits; + return this._InternalInitializeDeflate(wantRfc1950Header); + } + + private int _InternalInitializeDeflate(bool wantRfc1950Header) + { + bool flag = this.istate != null; + if (flag) + { + throw new ZlibException("You may not call InitializeDeflate() after calling InitializeInflate()."); + } + this.dstate = new DeflateManager(); + this.dstate.WantRfc1950HeaderBytes = wantRfc1950Header; + return this.dstate.Initialize(this, this.CompressLevel, this.WindowBits, this.Strategy); + } + + public int Deflate(FlushType flush) + { + bool flag = this.dstate == null; + if (flag) + { + throw new ZlibException("No Deflate State!"); + } + return this.dstate.Deflate(flush); + } + + public int EndDeflate() + { + bool flag = this.dstate == null; + if (flag) + { + throw new ZlibException("No Deflate State!"); + } + this.dstate = null; + return 0; + } + + public void ResetDeflate(bool setDeflater) + { + bool flag = this.dstate == null; + if (flag) + { + throw new ZlibException("No Deflate State!"); + } + this.dstate.Reset(setDeflater); + } + + public int SetDeflateParams(CompressionLevel level, CompressionStrategy strategy) + { + bool flag = this.dstate == null; + if (flag) + { + throw new ZlibException("No Deflate State!"); + } + return this.dstate.SetParams(level, strategy); + } + + public int SetDictionary(byte[] dictionary) + { + bool flag = this.istate != null; + int result; + if (flag) + { + result = this.istate.SetDictionary(dictionary); + } + else + { + bool flag2 = this.dstate != null; + if (!flag2) + { + throw new ZlibException("No Inflate or Deflate state!"); + } + result = this.dstate.SetDictionary(dictionary); + } + return result; + } + + internal void flush_pending() + { + int num = this.dstate.pendingCount; + bool flag = num > this.AvailableBytesOut; + if (flag) + { + num = this.AvailableBytesOut; + } + bool flag2 = num == 0; + if (!flag2) + { + bool flag3 = this.dstate.pending.Length <= this.dstate.nextPending || this.OutputBuffer.Length <= this.NextOut || this.dstate.pending.Length < this.dstate.nextPending + num || this.OutputBuffer.Length < this.NextOut + num; + if (flag3) + { + throw new ZlibException(string.Format("Invalid State. (pending.Length={0}, pendingCount={1})", this.dstate.pending.Length, this.dstate.pendingCount)); + } + Array.Copy(this.dstate.pending, this.dstate.nextPending, this.OutputBuffer, this.NextOut, num); + this.NextOut += num; + this.dstate.nextPending += num; + this.TotalBytesOut += (long)num; + this.AvailableBytesOut -= num; + this.dstate.pendingCount -= num; + bool flag4 = this.dstate.pendingCount == 0; + if (flag4) + { + this.dstate.nextPending = 0; + } + } + } + + internal int read_buf(byte[] buf, int start, int size) + { + int num = this.AvailableBytesIn; + bool flag = num > size; + if (flag) + { + num = size; + } + bool flag2 = num == 0; + int result; + if (flag2) + { + result = 0; + } + else + { + this.AvailableBytesIn -= num; + bool wantRfc1950HeaderBytes = this.dstate.WantRfc1950HeaderBytes; + if (wantRfc1950HeaderBytes) + { + this._Adler32 = Adler.Adler32(this._Adler32, this.InputBuffer, this.NextIn, num); + } + Array.Copy(this.InputBuffer, this.NextIn, buf, start, num); + this.NextIn += num; + this.TotalBytesIn += (long)num; + result = num; + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs.meta new file mode 100644 index 00000000..639608e1 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibCodec.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 84107389f7258db47818e7391949c909 +timeCreated: 1611465695 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs new file mode 100644 index 00000000..e3c12391 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs @@ -0,0 +1,27 @@ +using System; + +namespace Ionic.Zlib +{ + public static class ZlibConstants + { + public const int WindowBitsMax = 15; + + public const int WindowBitsDefault = 15; + + public const int Z_OK = 0; + + public const int Z_STREAM_END = 1; + + public const int Z_NEED_DICT = 2; + + public const int Z_STREAM_ERROR = -2; + + public const int Z_DATA_ERROR = -3; + + public const int Z_BUF_ERROR = -5; + + public const int WorkingBufferSizeDefault = 16384; + + public const int WorkingBufferSizeMin = 1024; + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs.meta new file mode 100644 index 00000000..99fdf51b --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibConstants.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3e9a7110134a02a4995d4a82c892bb90 +timeCreated: 1611465633 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs new file mode 100644 index 00000000..4ee93238 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs @@ -0,0 +1,17 @@ +using System; +using System.Runtime.InteropServices; + +namespace Ionic.Zlib +{ + [Guid("ebc25cf6-9120-4283-b972-0e5520d0000E")] + public class ZlibException : Exception + { + public ZlibException() + { + } + + public ZlibException(string s) : base(s) + { + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs.meta new file mode 100644 index 00000000..34b64195 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibException.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d0ec851ab9fb6b74aa0f4fc8ab253579 +timeCreated: 1611465760 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs new file mode 100644 index 00000000..83ca3ae8 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs @@ -0,0 +1,278 @@ +using System; +using System.IO; + +namespace Ionic.Zlib +{ + public class ZlibStream : Stream + { + public virtual FlushType FlushMode + { + get + { + return this._baseStream._flushMode; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + this._baseStream._flushMode = value; + } + } + + public int BufferSize + { + get + { + return this._baseStream._bufferSize; + } + set + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + bool flag = this._baseStream._workingBuffer != null; + if (flag) + { + throw new ZlibException("The working buffer is already set."); + } + bool flag2 = value < 1024; + if (flag2) + { + throw new ZlibException(string.Format("Don't be silly. {0} bytes?? Use a bigger buffer, at least {1}.", value, 1024)); + } + this._baseStream._bufferSize = value; + } + } + + public virtual long TotalIn + { + get + { + return this._baseStream._z.TotalBytesIn; + } + } + + public virtual long TotalOut + { + get + { + return this._baseStream._z.TotalBytesOut; + } + } + + public override bool CanRead + { + get + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + return this._baseStream._stream.CanRead; + } + } + + public override bool CanSeek + { + get + { + return false; + } + } + + public override bool CanWrite + { + get + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + return this._baseStream._stream.CanWrite; + } + } + + public override long Length + { + get + { + throw new NotSupportedException(); + } + } + + public override long Position + { + get + { + bool flag = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Writer; + long result; + if (flag) + { + result = this._baseStream._z.TotalBytesOut; + } + else + { + bool flag2 = this._baseStream._streamMode == ZlibBaseStream.StreamMode.Reader; + if (flag2) + { + result = this._baseStream._z.TotalBytesIn; + } + else + { + result = 0L; + } + } + return result; + } + set + { + throw new NotSupportedException(); + } + } + + internal ZlibBaseStream _baseStream; + + private bool _disposed; + + public ZlibStream(Stream stream, CompressionMode mode) : this(stream, mode, CompressionLevel.Default, false) + { + } + + public ZlibStream(Stream stream, CompressionMode mode, CompressionLevel level) : this(stream, mode, level, false) + { + } + + public ZlibStream(Stream stream, CompressionMode mode, bool leaveOpen) : this(stream, mode, CompressionLevel.Default, leaveOpen) + { + } + + public ZlibStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen) + { + this._baseStream = new ZlibBaseStream(stream, mode, level, ZlibStreamFlavor.ZLIB, leaveOpen); + } + + protected override void Dispose(bool disposing) + { + try + { + bool flag = !this._disposed; + if (flag) + { + bool flag2 = disposing && this._baseStream != null; + if (flag2) + { + this._baseStream.Close(); + } + this._disposed = true; + } + } + finally + { + base.Dispose(disposing); + } + } + + public override void Flush() + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + this._baseStream.Flush(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + return this._baseStream.Read(buffer, offset, count); + } + + public override long Seek(long offset, SeekOrigin origin) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + return this._baseStream.Seek(offset, origin); + } + + public override void SetLength(long value) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + this._baseStream.SetLength(value); + } + + public override void Write(byte[] buffer, int offset, int count) + { + bool disposed = this._disposed; + if (disposed) + { + throw new ObjectDisposedException("ZlibStream"); + } + this._baseStream.Write(buffer, offset, count); + } + + public static byte[] CompressString(string s) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + Stream compressor = new ZlibStream(memoryStream, CompressionMode.Compress, CompressionLevel.BestCompression); + ZlibBaseStream.CompressString(s, compressor); + result = memoryStream.ToArray(); + } + return result; + } + + public static byte[] CompressBuffer(byte[] b) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream()) + { + Stream compressor = new ZlibStream(memoryStream, CompressionMode.Compress, CompressionLevel.BestCompression); + ZlibBaseStream.CompressBuffer(b, compressor); + result = memoryStream.ToArray(); + } + return result; + } + + public static string UncompressString(byte[] compressed) + { + string result; + using (MemoryStream memoryStream = new MemoryStream(compressed)) + { + Stream decompressor = new ZlibStream(memoryStream, CompressionMode.Decompress); + result = ZlibBaseStream.UncompressString(compressed, decompressor); + } + return result; + } + + public static byte[] UncompressBuffer(byte[] compressed) + { + byte[] result; + using (MemoryStream memoryStream = new MemoryStream(compressed)) + { + Stream decompressor = new ZlibStream(memoryStream, CompressionMode.Decompress); + result = ZlibBaseStream.UncompressBuffer(compressed, decompressor); + } + return result; + } + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs.meta new file mode 100644 index 00000000..b0df5733 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStream.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 436494bec9d2c4d4b818c8381eb96b76 +timeCreated: 1611465636 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs new file mode 100644 index 00000000..15e26ff1 --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs @@ -0,0 +1,11 @@ +using System; + +namespace Ionic.Zlib +{ + internal enum ZlibStreamFlavor + { + ZLIB = 1950, + DEFLATE, + GZIP + } +} diff --git a/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs.meta b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs.meta new file mode 100644 index 00000000..3a7b453b --- /dev/null +++ b/Client/Assets/Scripts/XUtliPoolLib/Ionic/Zlib/ZlibStreamFlavor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7702df6401ca07347999769e435fe3da +timeCreated: 1611465690 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0