public static byte[] Compress(int level, byte[] input, int begin, int len) { byte[] output = new byte[input.Length]; fixed(void *pSrc1 = &input[begin]) fixed(void *pSrc2 = output) { int outlen = Is64bitApp() ? FastLZx64.FastLZ_Compress_level(level, pSrc1, len, pSrc2) : FastLZx86.FastLZ_Compress_level(level, pSrc1, len, pSrc2); byte[] result = new byte[outlen]; Array.Copy(output, 0, result, 0, outlen); return(result); } }
public static byte[] Decompress(byte[] input, int begin, int length, int maxout) { byte[] output = new byte[maxout]; fixed(byte *pSrc1 = &input[begin]) fixed(byte *pSrc2 = output) { int outlen = Is64bitApp() ? FastLZx64.FastLZ_Decompress(pSrc1, length, pSrc2, maxout) : FastLZx86.FastLZ_Decompress(pSrc1, length, pSrc2, maxout); byte[] result = new byte[outlen]; Array.Copy(output, 0, result, 0, outlen); return(result); } }