示例#1
0
 // Token: 0x060001BF RID: 447 RVA: 0x00007338 File Offset: 0x00005538
 public unsafe static uint readLZO(Stream input, out byte[] dst, uint expectedSize)
 {
     dst = new byte[expectedSize];
     fixed(byte *ptr = &dst[0])
     {
         return(LZO.decompress(input, ptr, expectedSize));
     }
 }
示例#2
0
        // Token: 0x060001C0 RID: 448 RVA: 0x00007360 File Offset: 0x00005560
        public unsafe static byte[] readLZO(Stream input, uint expectedSize)
        {
            byte[] array = new byte[expectedSize];
            fixed(byte *ptr = &array[0])
            {
                LZO.decompress(input, ptr, expectedSize);
            }

            return(array);
        }
示例#3
0
        // Token: 0x060001BE RID: 446 RVA: 0x00006EA8 File Offset: 0x000050A8
        public unsafe static uint decompress(Stream i, byte *output, uint expectedSize)
        {
            long  position = i.Position;
            byte *ptr      = output + expectedSize;
            byte *ptr2     = output;
            uint  num;

            if (LZO.ip(i) > 17)
            {
                num = (uint)(LZO.next(i) - 17);
                if (num < 4u)
                {
                    goto IL_435;
                }
                if ((long)(ptr - ptr2) < (long)((ulong)num))
                {
                    throw new OverflowException("Outpur Overrun");
                }
                do
                {
                    *(ptr2++) = LZO.next(i);
                }while ((num -= 1u) > 0u);
                goto IL_156;
            }
IL_59:
            num = (uint)LZO.next(i);
            if (num >= 16u)
            {
                goto IL_1CD;
            }
            if (num == 0u)
            {
                while (LZO.ip(i) == 0)
                {
                    num += 255u;
                    long position2 = i.Position;
                    i.Position = position2 + 1L;
                }
                num += (uint)(15 + LZO.next(i));
            }
            if ((long)(ptr - ptr2) < (long)((ulong)(num + 3u)))
            {
                throw new OverflowException("Output Overrun");
            }
            *(ptr2++) = LZO.next(i);
            *(ptr2++) = LZO.next(i);
            *(ptr2++) = LZO.next(i);
            *(ptr2++) = LZO.next(i);
            if ((num -= 1u) > 0u)
            {
                if (num >= 4u)
                {
                    do
                    {
                        *(ptr2++) = LZO.next(i);
                        *(ptr2++) = LZO.next(i);
                        *(ptr2++) = LZO.next(i);
                        *(ptr2++) = LZO.next(i);
                        num      -= 4u;
                    }while (num >= 4u);
                    if (num > 0u)
                    {
                        do
                        {
                            *(ptr2++) = LZO.next(i);
                        }while ((num -= 1u) > 0u);
                    }
                }
                else
                {
                    do
                    {
                        *(ptr2++) = LZO.next(i);
                    }while ((num -= 1u) > 0u);
                }
            }
IL_156:
            num = (uint)LZO.next(i);
            byte *ptr3;

            if (num < 16u)
            {
                ptr3  = ptr2 - (1u + LZO.M2_MAX_OFFSET);
                ptr3 -= num >> 2;
                ptr3 -= LZO.next(i) << 2;
                if (ptr3 < output || ptr3 >= ptr2)
                {
                    throw new OverflowException("Lookbehind Overrun");
                }
                if ((long)(ptr - ptr2) < 3L)
                {
                    throw new OverflowException("Output Overrun");
                }
                *(ptr2++) = *(ptr3++);
                *(ptr2++) = *(ptr3++);
                *(ptr2++) = *ptr3;
                goto IL_424;
            }
IL_1CD:
            if (num >= 64u)
            {
                ptr3  = ptr2 - 1;
                ptr3 -= (num >> 2 & 7u);
                ptr3 -= LZO.next(i) << 3;
                num   = (num >> 5) - 1u;
                if (ptr3 < output || ptr3 >= ptr2)
                {
                    throw new OverflowException("Lookbehind Overrun");
                }
                if ((long)(ptr - ptr2) < (long)((ulong)(num + 2u)))
                {
                    throw new OverflowException("Output Overrun");
                }
            }
            else
            {
                if (num >= 32u)
                {
                    num &= 31u;
                    if (num == 0u)
                    {
                        while (LZO.ip(i) == 0)
                        {
                            num += 255u;
                            long position2 = i.Position;
                            i.Position = position2 + 1L;
                        }
                        num += (uint)(31 + LZO.next(i));
                    }
                    ptr3        = ptr2 - 1;
                    ptr3       -= (LZO.ip(i, 0) >> 2) + ((int)LZO.ip(i, 1) << 6);
                    i.Position += 2L;
                }
                else if (num >= 16u)
                {
                    ptr3  = ptr2;
                    ptr3 -= (num & 8u) << 11;
                    num  &= 7u;
                    if (num == 0u)
                    {
                        while (LZO.ip(i) == 0)
                        {
                            num += 255u;
                            long position2 = i.Position;
                            i.Position = position2 + 1L;
                        }
                        num += (uint)(7 + LZO.next(i));
                    }
                    ptr3       -= (LZO.ip(i, 0) >> 2) + ((int)LZO.ip(i, 1) << 6);
                    i.Position += 2L;
                    if (ptr3 == ptr2)
                    {
                        long num2 = (long)(ptr2 - output);
                        if (ptr3 != ptr)
                        {
                            throw new OverflowException("Output Underrun");
                        }
                        return((uint)(i.Position - position));
                    }
                    else
                    {
                        ptr3 -= 16384;
                    }
                }
                else
                {
                    ptr3  = ptr2 - 1;
                    ptr3 -= num >> 2;
                    ptr3 -= LZO.next(i) << 2;
                    if (ptr3 < output || ptr3 >= ptr2)
                    {
                        throw new OverflowException("Lookbehind Overrun");
                    }
                    if ((long)(ptr - ptr2) < 2L)
                    {
                        throw new OverflowException("Output Overrun");
                    }
                    *(ptr2++) = *(ptr3++);
                    *(ptr2++) = *ptr3;
                    goto IL_424;
                }
                if (ptr3 < output || ptr3 >= ptr2)
                {
                    throw new OverflowException("Lookbehind Overrun");
                }
                if ((long)(ptr - ptr2) < (long)((ulong)(num + 2u)))
                {
                    throw new OverflowException("Output Overrun");
                }
                if (num >= 6u && (long)(ptr2 - ptr3) >= 4L)
                {
                    *(int *)ptr2 = (int)(*(uint *)ptr3);
                    ptr2        += 4;
                    ptr3        += 4;
                    num         -= 2u;
                    do
                    {
                        *(int *)ptr2 = (int)(*(uint *)ptr3);
                        ptr2        += 4;
                        ptr3        += 4;
                        num         -= 4u;
                    }while (num >= 4u);
                    if (num > 0u)
                    {
                        do
                        {
                            *(ptr2++) = *(ptr3++);
                        }while ((num -= 1u) > 0u);
                        goto IL_424;
                    }
                    goto IL_424;
                }
            }
            *(ptr2++) = *(ptr3++);
            *(ptr2++) = *(ptr3++);
            do
            {
                *(ptr2++) = *(ptr3++);
            }while ((num -= 1u) > 0u);
IL_424:
            num = (uint)(LZO.ip(i, -2) & 3);
            if (num == 0u)
            {
                goto IL_59;
            }
IL_435:
            if ((long)(ptr - ptr2) < (long)((ulong)num))
            {
                throw new OverflowException("Output Overrun");
            }
            *(ptr2++) = LZO.next(i);
            if (num > 1u)
            {
                *(ptr2++) = LZO.next(i);
                if (num > 2u)
                {
                    *(ptr2++) = LZO.next(i);
                }
            }
            num = (uint)LZO.next(i);
            goto IL_1CD;
        }