コード例 #1
0
        // Token: 0x060002CA RID: 714 RVA: 0x0002807C File Offset: 0x0002627C
        public static byte[] Unzip(byte[] byte_0)
        {
            Assembly callingAssembly   = Assembly.GetCallingAssembly();
            Assembly executingAssembly = Assembly.GetExecutingAssembly();

            if (callingAssembly != executingAssembly && !SimpleZip.PublicKeysMatch(executingAssembly, callingAssembly))
            {
                return(null);
            }
            SimpleZip.ZipStream zipStream = new SimpleZip.ZipStream(byte_0);
            byte[] array = new byte[0];
            int    num   = zipStream.ReadInt();

            if (num == 67324752)
            {
                short num2 = (short)zipStream.ReadShort();
                int   num3 = zipStream.ReadShort();
                int   num4 = zipStream.ReadShort();
                if (num == 67324752 && num2 == 20 && num3 == 0)
                {
                    if (num4 == 8)
                    {
                        zipStream.ReadInt();
                        zipStream.ReadInt();
                        zipStream.ReadInt();
                        int num5 = zipStream.ReadInt();
                        int num6 = zipStream.ReadShort();
                        int num7 = zipStream.ReadShort();
                        if (num6 > 0)
                        {
                            byte[] buffer = new byte[num6];
                            zipStream.Read(buffer, 0, num6);
                        }
                        if (num7 > 0)
                        {
                            byte[] buffer2 = new byte[num7];
                            zipStream.Read(buffer2, 0, num7);
                        }
                        byte[] array2 = new byte[zipStream.Length - zipStream.Position];
                        zipStream.Read(array2, 0, array2.Length);
                        SimpleZip.Inflater inflater = new SimpleZip.Inflater(array2);
                        array = new byte[num5];
                        inflater.Inflate(array, 0, array.Length);
                        goto IL_265;
                    }
                }
                throw new FormatException("Wrong Header Signature");
            }
            int num8 = num >> 24;

            num -= num8 << 24;
            if (num == 8223355)
            {
                if (num8 == 1)
                {
                    int num9 = zipStream.ReadInt();
                    array = new byte[num9];
                    int num11;
                    for (int i = 0; i < num9; i += num11)
                    {
                        int num10 = zipStream.ReadInt();
                        num11 = zipStream.ReadInt();
                        byte[] array3 = new byte[num10];
                        zipStream.Read(array3, 0, array3.Length);
                        new SimpleZip.Inflater(array3).Inflate(array, i, num11);
                    }
                }
                if (num8 == 2)
                {
                    byte[] byte_ = new byte[]
                    {
                        72,
                        196,
                        226,
                        220,
                        77,
                        90,
                        77,
                        41
                    };
                    byte[] byte_2 = new byte[]
                    {
                        17,
                        242,
                        176,
                        1,
                        248,
                        117,
                        118,
                        164
                    };
                    using (ICryptoTransform desTransform = SimpleZip.GetDesTransform(byte_, byte_2, true))
                    {
                        array = SimpleZip.Unzip(desTransform.TransformFinalBlock(byte_0, 4, byte_0.Length - 4));
                    }
                }
                if (num8 != 3)
                {
                    goto IL_265;
                }
                byte[] byte_3 = new byte[]
                {
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1,
                    1
                };
                byte[] byte_4 = new byte[]
                {
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2,
                    2
                };
                using (ICryptoTransform aesTransform = SimpleZip.GetAesTransform(byte_3, byte_4, true))
                {
                    array = SimpleZip.Unzip(aesTransform.TransformFinalBlock(byte_0, 4, byte_0.Length - 4));
                    goto IL_265;
                }
            }
            throw new FormatException("Unknown Header");
IL_265:
            zipStream.Close();
            zipStream = null;
            return(array);
        }
コード例 #2
0
        // Token: 0x06000252 RID: 594 RVA: 0x00012F88 File Offset: 0x00011188
        public static byte[] Unzip(byte[] A_0)
        {
            Assembly callingAssembly   = Assembly.GetCallingAssembly();
            Assembly executingAssembly = Assembly.GetExecutingAssembly();

            if (callingAssembly != executingAssembly && !SimpleZip.PublicKeysMatch(executingAssembly, callingAssembly))
            {
                return(null);
            }
            SimpleZip.ZipStream zipStream = new SimpleZip.ZipStream(A_0);
            byte[] array = new byte[0];
            int    num   = zipStream.ReadInt();

            if (num != 67324752)
            {
                int num2 = num >> 24;
                num -= num2 << 24;
                if (num == 8223355)
                {
                    if (num2 == 1)
                    {
                        int num3 = zipStream.ReadInt();
                        array = new byte[num3];
                        int num5;
                        for (int i = 0; i < num3; i += num5)
                        {
                            int num4 = zipStream.ReadInt();
                            num5 = zipStream.ReadInt();
                            byte[] array2 = new byte[num4];
                            zipStream.Read(array2, 0, array2.Length);
                            new SimpleZip.Inflater(array2).Inflate(array, i, num5);
                        }
                    }
                    if (num2 == 2)
                    {
                        byte[] array3 = new byte[]
                        {
                            72,
                            196,
                            226,
                            220,
                            77,
                            90,
                            77,
                            41
                        };
                        byte[] array4 = new byte[]
                        {
                            17,
                            242,
                            176,
                            1,
                            248,
                            117,
                            118,
                            164
                        };
                        using (ICryptoTransform desTransform = SimpleZip.GetDesTransform(array3, array4, true))
                        {
                            array = SimpleZip.Unzip(desTransform.TransformFinalBlock(A_0, 4, A_0.Length - 4));
                        }
                    }
                    if (num2 != 3)
                    {
                        goto IL_287;
                    }
                    byte[] array5 = new byte[]
                    {
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1
                    };
                    byte[] array6 = new byte[]
                    {
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2,
                        2
                    };
                    using (ICryptoTransform aesTransform = SimpleZip.GetAesTransform(array5, array6, true))
                    {
                        array = SimpleZip.Unzip(aesTransform.TransformFinalBlock(A_0, 4, A_0.Length - 4));
                        goto IL_287;
                    }
                }
                throw new FormatException("Unknown Header");
            }
            short num6 = (short)zipStream.ReadShort();
            int   num7 = zipStream.ReadShort();
            int   num8 = zipStream.ReadShort();

            if (num != 67324752 || num6 != 20 || num7 != 0 || num8 != 8)
            {
                throw new FormatException("Wrong Header Signature");
            }
            zipStream.ReadInt();
            zipStream.ReadInt();
            zipStream.ReadInt();
            int num9  = zipStream.ReadInt();
            int num10 = zipStream.ReadShort();
            int num11 = zipStream.ReadShort();

            if (num10 > 0)
            {
                byte[] buffer = new byte[num10];
                zipStream.Read(buffer, 0, num10);
            }
            if (num11 > 0)
            {
                byte[] buffer2 = new byte[num11];
                zipStream.Read(buffer2, 0, num11);
            }
            byte[] array7 = new byte[zipStream.Length - zipStream.Position];
            zipStream.Read(array7, 0, array7.Length);
            SimpleZip.Inflater inflater = new SimpleZip.Inflater(array7);
            array = new byte[num9];
            inflater.Inflate(array, 0, array.Length);
IL_287:
            zipStream.Close();
            zipStream = null;
            return(array);
        }