Ejemplo n.º 1
0
 internal CoconetCompressor(long dictionarySize, int sampleRate, CoconetCompressor.LzOption lzOpt)
 {
     this.hCompressor = CoconetCompressor.GetCompressor((ulong)dictionarySize, (uint)sampleRate, (uint)lzOpt);
     if (this.hCompressor == IntPtr.Zero)
     {
         throw new CompressionOutOfMemoryException();
     }
 }
Ejemplo n.º 2
0
 protected override void InternalDispose(bool disposing)
 {
     if (disposing)
     {
         IntPtr value = this.hCompressor;
         this.hCompressor = IntPtr.Zero;
         if (value != IntPtr.Zero)
         {
             CoconetCompressor.FreeCompressor(value);
         }
     }
 }
Ejemplo n.º 3
0
        internal unsafe void Compress(byte[] inBuf, int inOffset, int inLength, byte[] outBuf, int outOffset, int maxOutLength, out int compressedLength)
        {
            compressedLength = 0;
            uint num = 0U;

            fixed(byte *ptr = inBuf)
            {
                fixed(byte *ptr2 = outBuf)
                {
                    int num2 = CoconetCompressor.CompressBufferCoconet(new IntPtr((void *)((byte *)ptr + inOffset)), (uint)inLength, new IntPtr((void *)((byte *)ptr2 + outOffset)), (uint)maxOutLength, ref num, this.hCompressor);

                    if (num2 != 0)
                    {
                        throw new CompressionException(num2);
                    }
                }
            }

            compressedLength = (int)num;
        }