Пример #1
0
        public static unsafe int GetDecompressedLength(byte[] sourceBytes, int sourceIndex)
        {
            if (sourceBytes == null)
            {
                AcedMCException.ThrowArgumentNullException("sourceBytes");
                fixed(byte *pSrcBytes = &sourceBytes[sourceIndex])
                {
                    int result = *((int *)pSrcBytes);

                    if (result >= 0)
                    {
                        return(result);
                    }
                    return(-result);
                }
        }
Пример #2
0
        public unsafe byte[] Decompress(byte[] sourceBytes, int sourceIndex, int beforeGap, int afterGap)
        {
            if (sourceBytes == null)
            {
                AcedMCException.ThrowArgumentNullException("sourceBytes");
            }
            int byteCount;

            fixed(byte *pSrcBytes = &sourceBytes[sourceIndex])
            byteCount = *((int *)pSrcBytes);

            if (byteCount < 0)
            {
                byteCount = -byteCount;
            }
            byte[] result = new byte[byteCount + beforeGap + afterGap];
            if (byteCount != 0)
            {
                Decompress(sourceBytes, sourceIndex, result, beforeGap);
            }
            return(result);
        }
Пример #3
0
 public unsafe int Decompress(byte[] sourceBytes, int sourceIndex, byte[] destinationBytes, int destinationIndex)
 {
     if (sourceBytes == null)
         AcedMCException.ThrowArgumentNullException("sourceBytes"); }