Example #1
0
 public override void Close()
 {
     this.delegate5_0 = new ZIPCompressor.Delegate5(this.method_9);
     this.class192_0 = null;
     this.class193_0 = null;
     base.Close();
 }
Example #2
0
 public void method_28(Enum31 enum31_1)
 {
     if (!Class193.smethod_0(enum31_1))
     {
         throw new NotSupportedException("Compression method not supported");
     }
     this.enum31_0 = enum31_1;
 }
Example #3
0
        public object Clone()
        {
            Class193 @class = (Class193)base.MemberwiseClone();

            if (this.byte_0 != null)
            {
                @class.byte_0 = new byte[this.byte_0.Length];
                Array.Copy(this.byte_0, 0, @class.byte_0, 0, this.byte_0.Length);
            }
            return(@class);
        }
Example #4
0
 public static void processFile(IEnumerable<string> fileNameList, Stream zipFile, int compressionAmount, string password, Stream[] fileStreamList)
 {
     if (compressionAmount >= 0 && compressionAmount <= 9)
     {
         Class192 @class = new Class192();
         Stream23 stream = new Stream23(zipFile);
         stream.method_6(compressionAmount);
         if (password != null)
         {
             stream.method_2(password);
         }
         int num = 0;
         using (IEnumerator<string> enumerator = fileNameList.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 string current = enumerator.Current;
                 Class193 class2 = new Class193(current);
                 class2.method_19(DateTime.Now);
                 Stream stream2 = fileStreamList[num++];
                 byte[] array;
                 if (stream2 is MemoryStream)
                 {
                     array = (stream2 as MemoryStream).ToArray();
                 }
                 else
                 {
                     array = new byte[stream2.Length];
                     int num2 = stream2.Read(array, 0, array.Length);
                     if (num2 < array.Length)
                     {
                         Array.Resize<byte>(ref array, num2);
                     }
                 }
                 class2.method_22((long)array.Length);
                 @class.vmethod_1();
                 @class.vmethod_2(array);
                 class2.method_26(@class.vmethod_0());
                 stream.method_10(class2);
                 stream.Write(array, 0, array.Length);
             }
             goto IL_10D;
         }
         goto IL_102;
         IL_10D:
         stream.vmethod_0();
         stream.Close();
         return;
     }
     IL_102:
     throw new ArgumentException("Invalid compression rate.");
 }
Example #5
0
        public static void processFile(IEnumerable <string> fileNameList, Stream zipFile, int compressionAmount, string password, Stream[] fileStreamList)
        {
            if (compressionAmount >= 0 && compressionAmount <= 9)
            {
                Class192 @class = new Class192();
                Stream23 stream = new Stream23(zipFile);
                stream.method_6(compressionAmount);
                if (password != null)
                {
                    stream.method_2(password);
                }
                int num = 0;
                using (IEnumerator <string> enumerator = fileNameList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string   current = enumerator.Current;
                        Class193 class2  = new Class193(current);
                        class2.method_19(DateTime.Now);
                        Stream stream2 = fileStreamList[num++];
                        byte[] array;
                        if (stream2 is MemoryStream)
                        {
                            array = (stream2 as MemoryStream).ToArray();
                        }
                        else
                        {
                            array = new byte[stream2.Length];
                            int num2 = stream2.Read(array, 0, array.Length);
                            if (num2 < array.Length)
                            {
                                Array.Resize <byte>(ref array, num2);
                            }
                        }
                        class2.method_22((long)array.Length);
                        @class.vmethod_1();
                        @class.vmethod_2(array);
                        class2.method_26(@class.vmethod_0());
                        stream.method_10(class2);
                        stream.Write(array, 0, array.Length);
                    }
                    goto IL_10D;
                }
                goto IL_102;
IL_10D:
                stream.vmethod_0();
                stream.Close();
                return;
            }
IL_102:
            throw new ArgumentException("Invalid compression rate.");
        }
Example #6
0
 public Class193 method_5()
 {
     if (this.class192_0 == null)
     {
         throw new InvalidOperationException("Closed.");
     }
     if (this.class193_0 != null)
     {
         this.method_8();
     }
     int num = this.class201_0.method_10();
     if (num != 33639248 && num != 101010256 && num != 84233040 && num != 117853008)
     {
         if (num != 101075792)
         {
             if (num == 808471376 || num == 134695760)
             {
                 num = this.class201_0.method_10();
             }
             if (num != 67324752)
             {
                 throw new ZipException("Wrong Local header signature: 0x" + string.Format("{0:X}", num));
             }
             short int_ = (short)this.class201_0.method_9();
             this.int_1 = this.class201_0.method_9();
             this.int_0 = this.class201_0.method_9();
             uint num2 = (uint)this.class201_0.method_10();
             int num3 = this.class201_0.method_10();
             this.long_0 = (long)this.class201_0.method_10();
             this.long_1 = (long)this.class201_0.method_10();
             int num4 = this.class201_0.method_9();
             int num5 = this.class201_0.method_9();
             bool flag = (this.int_1 & 1) == 1;
             byte[] array = new byte[num4];
             this.class201_0.method_5(array);
             string string_ = Class186.smethod_2(this.int_1, array);
             this.class193_0 = new Class193(string_, (int)int_);
             this.class193_0.method_5(this.int_1);
             this.class193_0.method_28((Enum31)this.int_0);
             if ((this.int_1 & 8) == 0)
             {
                 this.class193_0.method_26((long)num3 & 4294967295L);
                 this.class193_0.method_22(this.long_1 & 4294967295L);
                 this.class193_0.method_24(this.long_0 & 4294967295L);
                 this.class193_0.method_3((byte)(num3 >> 24 & 255));
             }
             else
             {
                 if (num3 != 0)
                 {
                     this.class193_0.method_26((long)num3 & 4294967295L);
                 }
                 if (this.long_1 != 0L)
                 {
                     this.class193_0.method_22(this.long_1 & 4294967295L);
                 }
                 if (this.long_0 != 0L)
                 {
                     this.class193_0.method_24(this.long_0 & 4294967295L);
                 }
                 this.class193_0.method_3((byte)(num2 >> 8 & 255u));
             }
             this.class193_0.method_18((long)((ulong)num2));
             if (num5 > 0)
             {
                 byte[] array2 = new byte[num5];
                 this.class201_0.method_5(array2);
                 this.class193_0.method_30(array2);
             }
             this.class193_0.method_31(true);
             if (this.class193_0.method_23() >= 0L)
             {
                 this.long_0 = this.class193_0.method_23();
             }
             if (this.class193_0.method_21() >= 0L)
             {
                 this.long_1 = this.class193_0.method_21();
             }
             if (this.int_0 == 0 && ((!flag && this.long_0 != this.long_1) || (flag && this.long_0 - 12L != this.long_1)))
             {
                 throw new ZipException("Stored, but compressed != uncompressed");
             }
             if (this.class193_0.method_34())
             {
                 this.delegate5_0 = new ZIPCompressor.Delegate5(this.method_11);
             }
             else
             {
                 this.delegate5_0 = new ZIPCompressor.Delegate5(this.method_10);
             }
             return this.class193_0;
         }
     }
     this.Close();
     return null;
 }
Example #7
0
 private void method_7(bool bool_2)
 {
     base.method_1();
     if ((this.int_1 & 8) != 0)
     {
         this.method_6();
     }
     this.long_1 = 0L;
     if (bool_2 && (this.class192_0.vmethod_0() & 4294967295L) != this.class193_0.method_25() && this.class193_0.method_25() != -1L)
     {
         throw new ZipException("CRC mismatch");
     }
     this.class192_0.vmethod_1();
     if (this.int_0 == 8)
     {
         this.class196_0.method_0();
     }
     this.class193_0 = null;
 }
Example #8
0
 public bool method_34()
 {
     return(Class193.smethod_0(this.method_27()));
 }
Example #9
0
 public Class182(Class193[] class193_1)
 {
     this.class193_0 = class193_1;
 }
Example #10
0
 public void method_10(Class193 class193_1)
 {
     if (class193_1 == null)
     {
         throw new ArgumentNullException("entry");
     }
     if (this.arrayList_0 == null)
     {
         throw new InvalidOperationException("ZipOutputStream was finished");
     }
     if (this.class193_0 != null)
     {
         this.method_11();
     }
     if (this.arrayList_0.Count == 2147483647)
     {
         throw new ZipException("Too many entries for Zip file");
     }
     Enum31 @enum = class193_1.method_27();
     int int_ = this.int_0;
     class193_1.method_5(class193_1.method_4() & 2048);
     this.bool_2 = false;
     bool flag = true;
     if (@enum == Enum31.const_0)
     {
         class193_1.method_5(class193_1.method_4() & -9);
         if (class193_1.method_23() >= 0L)
         {
             if (class193_1.method_21() < 0L)
             {
                 class193_1.method_22(class193_1.method_23());
             }
             else if (class193_1.method_21() != class193_1.method_23())
             {
                 throw new ZipException("Method STORED, but compressed size != size");
             }
         }
         else if (class193_1.method_21() >= 0L)
         {
             class193_1.method_24(class193_1.method_21());
         }
         if (class193_1.method_21() < 0L || class193_1.method_25() < 0L)
         {
             if (base.method_0())
             {
                 flag = false;
             }
             else
             {
                 @enum = Enum31.const_1;
                 int_ = 0;
             }
         }
     }
     if (@enum == Enum31.const_1)
     {
         if (class193_1.method_21() == 0L)
         {
             class193_1.method_24(class193_1.method_21());
             class193_1.method_26(0L);
             @enum = Enum31.const_0;
         }
         else if (class193_1.method_23() < 0L || class193_1.method_21() < 0L || class193_1.method_25() < 0L)
         {
             flag = false;
         }
     }
     if (!flag)
     {
         if (!base.method_0())
         {
             class193_1.method_5(class193_1.method_4() | 8);
         }
         else
         {
             this.bool_2 = true;
         }
     }
     if (base.method_1() != null)
     {
         class193_1.method_1(true);
         if (class193_1.method_25() < 0L)
         {
             class193_1.method_5(class193_1.method_4() | 8);
         }
     }
     class193_1.method_7(this.long_1);
     class193_1.method_28(@enum);
     this.enum31_0 = @enum;
     this.long_3 = -1L;
     if (this.enum30_0 == Enum30.const_1 || (class193_1.method_21() < 0L && this.enum30_0 == Enum30.const_2))
     {
         class193_1.method_13();
     }
     this.method_8(67324752);
     this.method_7(class193_1.method_11());
     this.method_7(class193_1.method_4());
     this.method_7((int)((byte)@enum));
     this.method_8((int)class193_1.method_17());
     if (flag)
     {
         this.method_8((int)class193_1.method_25());
         if (class193_1.method_15())
         {
             this.method_8(-1);
             this.method_8(-1);
         }
         else
         {
             this.method_8(class193_1.method_0() ? ((int)class193_1.method_23() + 12) : ((int)class193_1.method_23()));
             this.method_8((int)class193_1.method_21());
         }
     }
     else
     {
         if (this.bool_2)
         {
             this.long_2 = this.stream_0.Position;
         }
         this.method_8(0);
         if (this.bool_2)
         {
             this.long_3 = this.stream_0.Position;
         }
         if (class193_1.method_15() && this.bool_2)
         {
             this.method_8(-1);
             this.method_8(-1);
         }
         else
         {
             this.method_8(0);
             this.method_8(0);
         }
     }
     byte[] array = Class186.smethod_4(class193_1.method_4(), class193_1.method_20());
     if (array.Length > 65535)
     {
         throw new ZipException("Entry name too long.");
     }
     Class202 @class = new Class202(class193_1.method_29());
     if (class193_1.method_15() && (flag || this.bool_2))
     {
         @class.method_8();
         if (flag)
         {
             @class.method_12(class193_1.method_21());
             @class.method_12(class193_1.method_23());
         }
         else
         {
             @class.method_12(-1L);
             @class.method_12(-1L);
         }
         @class.method_9(1);
         if ([email protected]_6(1))
         {
             throw new ZipException("Internal error cant find extra data");
         }
         if (this.bool_2)
         {
             this.long_3 = (long)@class.method_4();
         }
     }
     else
     {
         @class.method_13(1);
     }
     byte[] array2 = @class.method_0();
     this.method_7(array.Length);
     this.method_7(array2.Length);
     if (array.Length > 0)
     {
         this.stream_0.Write(array, 0, array.Length);
     }
     if (class193_1.method_15() && this.bool_2)
     {
         this.long_3 += this.stream_0.Position;
     }
     if (array2.Length > 0)
     {
         this.stream_0.Write(array2, 0, array2.Length);
     }
     this.long_1 += (long)(30 + array.Length + array2.Length);
     this.class193_0 = class193_1;
     this.class192_0.vmethod_1();
     if (@enum == Enum31.const_1)
     {
         this.class194_0.method_0();
         this.class194_0.method_7(int_);
     }
     this.long_0 = 0L;
     if (class193_1.method_0())
     {
         if (class193_1.method_25() < 0L)
         {
             this.method_12(class193_1.method_17() << 16);
             return;
         }
         this.method_12(class193_1.method_25());
     }
 }
Example #11
0
 public void method_11()
 {
     if (this.class193_0 == null)
     {
         throw new InvalidOperationException("No open entry");
     }
     if (this.enum31_0 == Enum31.const_1)
     {
         base.vmethod_0();
     }
     long num = (this.enum31_0 == Enum31.const_1) ? this.class194_0.method_1() : this.long_0;
     if (this.class193_0.method_21() < 0L)
     {
         this.class193_0.method_22(this.long_0);
     }
     else if (this.class193_0.method_21() != this.long_0)
     {
         throw new ZipException(string.Concat(new object[]
         {
             "size was ",
             this.long_0,
             ", but I expected ",
             this.class193_0.method_21()
         }));
     }
     if (this.class193_0.method_23() < 0L)
     {
         this.class193_0.method_24(num);
     }
     else if (this.class193_0.method_23() != num)
     {
         throw new ZipException(string.Concat(new object[]
         {
             "compressed size was ",
             num,
             ", but I expected ",
             this.class193_0.method_23()
         }));
     }
     if (this.class193_0.method_25() < 0L)
     {
         this.class193_0.method_26(this.class192_0.vmethod_0());
     }
     else if (this.class193_0.method_25() != this.class192_0.vmethod_0())
     {
         throw new ZipException(string.Concat(new object[]
         {
             "crc was ",
             this.class192_0.vmethod_0(),
             ", but I expected ",
             this.class193_0.method_25()
         }));
     }
     this.long_1 += num;
     if (this.class193_0.method_0())
     {
         Class193 expr_1E6 = this.class193_0;
         expr_1E6.method_24(expr_1E6.method_23() + 12L);
     }
     if (this.bool_2)
     {
         this.bool_2 = false;
         long position = this.stream_0.Position;
         this.stream_0.Seek(this.long_2, SeekOrigin.Begin);
         this.method_8((int)this.class193_0.method_25());
         if (this.class193_0.method_15())
         {
             if (this.long_3 == -1L)
             {
                 throw new ZipException("Entry requires zip64 but this has been turned off");
             }
             this.stream_0.Seek(this.long_3, SeekOrigin.Begin);
             this.method_9(this.class193_0.method_21());
             this.method_9(this.class193_0.method_23());
         }
         else
         {
             this.method_8((int)this.class193_0.method_23());
             this.method_8((int)this.class193_0.method_21());
         }
         this.stream_0.Seek(position, SeekOrigin.Begin);
     }
     if ((this.class193_0.method_4() & 8) != 0)
     {
         this.method_8(134695760);
         this.method_8((int)this.class193_0.method_25());
         if (this.class193_0.method_15())
         {
             this.method_9(this.class193_0.method_23());
             this.method_9(this.class193_0.method_21());
             this.long_1 += 24L;
         }
         else
         {
             this.method_8((int)this.class193_0.method_23());
             this.method_8((int)this.class193_0.method_21());
             this.long_1 += 16L;
         }
     }
     this.arrayList_0.Add(this.class193_0);
     this.class193_0 = null;
 }
Example #12
0
        public void method_10(Class193 class193_1)
        {
            if (class193_1 == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (this.arrayList_0 == null)
            {
                throw new InvalidOperationException("ZipOutputStream was finished");
            }
            if (this.class193_0 != null)
            {
                this.method_11();
            }
            if (this.arrayList_0.Count == 2147483647)
            {
                throw new ZipException("Too many entries for Zip file");
            }
            Enum31 @enum = class193_1.method_27();
            int    int_  = this.int_0;

            class193_1.method_5(class193_1.method_4() & 2048);
            this.bool_2 = false;
            bool flag = true;

            if (@enum == Enum31.const_0)
            {
                class193_1.method_5(class193_1.method_4() & -9);
                if (class193_1.method_23() >= 0L)
                {
                    if (class193_1.method_21() < 0L)
                    {
                        class193_1.method_22(class193_1.method_23());
                    }
                    else if (class193_1.method_21() != class193_1.method_23())
                    {
                        throw new ZipException("Method STORED, but compressed size != size");
                    }
                }
                else if (class193_1.method_21() >= 0L)
                {
                    class193_1.method_24(class193_1.method_21());
                }
                if (class193_1.method_21() < 0L || class193_1.method_25() < 0L)
                {
                    if (base.method_0())
                    {
                        flag = false;
                    }
                    else
                    {
                        @enum = Enum31.const_1;
                        int_  = 0;
                    }
                }
            }
            if (@enum == Enum31.const_1)
            {
                if (class193_1.method_21() == 0L)
                {
                    class193_1.method_24(class193_1.method_21());
                    class193_1.method_26(0L);
                    @enum = Enum31.const_0;
                }
                else if (class193_1.method_23() < 0L || class193_1.method_21() < 0L || class193_1.method_25() < 0L)
                {
                    flag = false;
                }
            }
            if (!flag)
            {
                if (!base.method_0())
                {
                    class193_1.method_5(class193_1.method_4() | 8);
                }
                else
                {
                    this.bool_2 = true;
                }
            }
            if (base.method_1() != null)
            {
                class193_1.method_1(true);
                if (class193_1.method_25() < 0L)
                {
                    class193_1.method_5(class193_1.method_4() | 8);
                }
            }
            class193_1.method_7(this.long_1);
            class193_1.method_28(@enum);
            this.enum31_0 = @enum;
            this.long_3   = -1L;
            if (this.enum30_0 == Enum30.const_1 || (class193_1.method_21() < 0L && this.enum30_0 == Enum30.const_2))
            {
                class193_1.method_13();
            }
            this.method_8(67324752);
            this.method_7(class193_1.method_11());
            this.method_7(class193_1.method_4());
            this.method_7((int)((byte)@enum));
            this.method_8((int)class193_1.method_17());
            if (flag)
            {
                this.method_8((int)class193_1.method_25());
                if (class193_1.method_15())
                {
                    this.method_8(-1);
                    this.method_8(-1);
                }
                else
                {
                    this.method_8(class193_1.method_0() ? ((int)class193_1.method_23() + 12) : ((int)class193_1.method_23()));
                    this.method_8((int)class193_1.method_21());
                }
            }
            else
            {
                if (this.bool_2)
                {
                    this.long_2 = this.stream_0.Position;
                }
                this.method_8(0);
                if (this.bool_2)
                {
                    this.long_3 = this.stream_0.Position;
                }
                if (class193_1.method_15() && this.bool_2)
                {
                    this.method_8(-1);
                    this.method_8(-1);
                }
                else
                {
                    this.method_8(0);
                    this.method_8(0);
                }
            }
            byte[] array = Class186.smethod_4(class193_1.method_4(), class193_1.method_20());
            if (array.Length > 65535)
            {
                throw new ZipException("Entry name too long.");
            }
            Class202 @class = new Class202(class193_1.method_29());

            if (class193_1.method_15() && (flag || this.bool_2))
            {
                @class.method_8();
                if (flag)
                {
                    @class.method_12(class193_1.method_21());
                    @class.method_12(class193_1.method_23());
                }
                else
                {
                    @class.method_12(-1L);
                    @class.method_12(-1L);
                }
                @class.method_9(1);
                if ([email protected]_6(1))
                {
                    throw new ZipException("Internal error cant find extra data");
                }
                if (this.bool_2)
                {
                    this.long_3 = (long)@class.method_4();
                }
            }
            else
            {
                @class.method_13(1);
            }
            byte[] array2 = @class.method_0();
            this.method_7(array.Length);
            this.method_7(array2.Length);
            if (array.Length > 0)
            {
                this.stream_0.Write(array, 0, array.Length);
            }
            if (class193_1.method_15() && this.bool_2)
            {
                this.long_3 += this.stream_0.Position;
            }
            if (array2.Length > 0)
            {
                this.stream_0.Write(array2, 0, array2.Length);
            }
            this.long_1    += (long)(30 + array.Length + array2.Length);
            this.class193_0 = class193_1;
            this.class192_0.vmethod_1();
            if (@enum == Enum31.const_1)
            {
                this.class194_0.method_0();
                this.class194_0.method_7(int_);
            }
            this.long_0 = 0L;
            if (class193_1.method_0())
            {
                if (class193_1.method_25() < 0L)
                {
                    this.method_12(class193_1.method_17() << 16);
                    return;
                }
                this.method_12(class193_1.method_25());
            }
        }
Example #13
0
        public void method_11()
        {
            if (this.class193_0 == null)
            {
                throw new InvalidOperationException("No open entry");
            }
            if (this.enum31_0 == Enum31.const_1)
            {
                base.vmethod_0();
            }
            long num = (this.enum31_0 == Enum31.const_1) ? this.class194_0.method_1() : this.long_0;

            if (this.class193_0.method_21() < 0L)
            {
                this.class193_0.method_22(this.long_0);
            }
            else if (this.class193_0.method_21() != this.long_0)
            {
                throw new ZipException(string.Concat(new object[]
                {
                    "size was ",
                    this.long_0,
                    ", but I expected ",
                    this.class193_0.method_21()
                }));
            }
            if (this.class193_0.method_23() < 0L)
            {
                this.class193_0.method_24(num);
            }
            else if (this.class193_0.method_23() != num)
            {
                throw new ZipException(string.Concat(new object[]
                {
                    "compressed size was ",
                    num,
                    ", but I expected ",
                    this.class193_0.method_23()
                }));
            }
            if (this.class193_0.method_25() < 0L)
            {
                this.class193_0.method_26(this.class192_0.vmethod_0());
            }
            else if (this.class193_0.method_25() != this.class192_0.vmethod_0())
            {
                throw new ZipException(string.Concat(new object[]
                {
                    "crc was ",
                    this.class192_0.vmethod_0(),
                    ", but I expected ",
                    this.class193_0.method_25()
                }));
            }
            this.long_1 += num;
            if (this.class193_0.method_0())
            {
                Class193 expr_1E6 = this.class193_0;
                expr_1E6.method_24(expr_1E6.method_23() + 12L);
            }
            if (this.bool_2)
            {
                this.bool_2 = false;
                long position = this.stream_0.Position;
                this.stream_0.Seek(this.long_2, SeekOrigin.Begin);
                this.method_8((int)this.class193_0.method_25());
                if (this.class193_0.method_15())
                {
                    if (this.long_3 == -1L)
                    {
                        throw new ZipException("Entry requires zip64 but this has been turned off");
                    }
                    this.stream_0.Seek(this.long_3, SeekOrigin.Begin);
                    this.method_9(this.class193_0.method_21());
                    this.method_9(this.class193_0.method_23());
                }
                else
                {
                    this.method_8((int)this.class193_0.method_23());
                    this.method_8((int)this.class193_0.method_21());
                }
                this.stream_0.Seek(position, SeekOrigin.Begin);
            }
            if ((this.class193_0.method_4() & 8) != 0)
            {
                this.method_8(134695760);
                this.method_8((int)this.class193_0.method_25());
                if (this.class193_0.method_15())
                {
                    this.method_9(this.class193_0.method_23());
                    this.method_9(this.class193_0.method_21());
                    this.long_1 += 24L;
                }
                else
                {
                    this.method_8((int)this.class193_0.method_23());
                    this.method_8((int)this.class193_0.method_21());
                    this.long_1 += 16L;
                }
            }
            this.arrayList_0.Add(this.class193_0);
            this.class193_0 = null;
        }