I am using unsafe [login to view URL] in c# I need the same routine written to use the [login to view URL] c# sources. I cannot ship the dll in this application so I need to embed the source.
Thanks and good luck...
## Deliverables
private static unsafe byte[] MyCompress(byte[] source)
{
int tlen = (([login to view URL] * 0x65) / 100) + 0x10;
byte[] sourceArray = new byte[tlen];
fixed (byte* numRef = source)
{
fixed (byte* numRef2 = sourceArray)
{
int num2 = compress(numRef2 + 4, &tlen, numRef, [login to view URL], 9);
if (num2 != 0)
{
throw new InvalidOperationException("Compression failed, reason code=" + num2);
}
*((int*) numRef2) = [login to view URL]([login to view URL]);
}
}
byte[] destinationArray = new byte[tlen + 4];
[login to view URL](sourceArray, destinationArray, (int) (tlen + 4));
return destinationArray;
}
[DllImport("[login to view URL]", EntryPoint="compress2")]
private static extern unsafe int compress(byte* target, int* tlen, byte* source, int slen, int level);
private static unsafe byte[] MyDecompress(byte[] source)
{
fixed (byte* numRef = source)
{
int tlen = [login to view URL](*((int*) numRef));
byte[] buffer = new byte[tlen];
fixed (byte* numRef2 = buffer)
{
int num2 = uncompress(numRef2, &tlen, numRef + 4, [login to view URL] - 4);
if (num2 != 0)
{
throw new InvalidOperationException("Decompression failed, reason code=" + num2);
}
return buffer;
}
}
}
[DllImport("[login to view URL]")]
private static extern unsafe int uncompress(byte* target, int* tlen, byte* source, int slen);
static Variable()
{
myMark = new [login to view URL]();
myTrue = new [login to view URL](true);
myFalse = new [login to view URL](false);
}