public CoconetDecompressor(long dictionarySize, CoconetCompressor.LzOption lzOpt) { this.hDecompressor = CoconetDecompressor.GetDecompressor((ulong)dictionarySize, (uint)lzOpt); if (this.hDecompressor == IntPtr.Zero) { throw new CompressionOutOfMemoryException(); } }
protected override void InternalDispose(bool disposing) { if (disposing) { IntPtr value = this.hDecompressor; this.hDecompressor = IntPtr.Zero; if (value != IntPtr.Zero) { CoconetDecompressor.FreeDecompressor(value); } } }
public unsafe void Decompress(byte[] inBuf, int inOffset, int inLength, byte[] outBuf, int outOffset, int expectedDecompressedLength) { uint maxOutputSize = (uint)expectedDecompressedLength; fixed(byte *ptr = inBuf) { fixed(byte *ptr2 = outBuf) { int num = CoconetDecompressor.DecompressBufferCoconet(new IntPtr((void *)((byte *)ptr + inOffset)), (uint)inLength, new IntPtr((void *)((byte *)ptr2 + outOffset)), maxOutputSize, ref maxOutputSize, this.hDecompressor); if (num != 0) { throw new DecompressionException(num); } } } }