SmartAssembly.Zip.SimpleZip.Inflater.Inflate C# (CSharp) Method

Inflate() public method

public Inflate ( byte buf, int offset, int len ) : int
buf byte
offset int
len int
return int
            public int Inflate(byte[] buf, int offset, int len)
            {
                int num = 0;
                do
                {
                    if (this.mode != 11)
                    {
                        int num2 = this.outputWindow.CopyOutput(buf, offset, len);
                        offset += num2;
                        num += num2;
                        len -= num2;
                        if (len == 0)
                        {
                            return num;
                        }
                    }
                }
                while (this.Decode() || ((this.outputWindow.GetAvailable() > 0) && (this.mode != 11)));
                return num;
            }
        }

Usage Example

示例#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);
        }
All Usage Examples Of SmartAssembly.Zip.SimpleZip.Inflater::Inflate