Ejemplo n.º 1
0
        public static void ProcessFile(IEnumerable <string> fileNameList, Stream zipFile, int compressionAmount,
                                       string password, Stream[] fileStreamList)
        {
            if (compressionAmount >= 0 && compressionAmount <= 9)
            {
                var @class = new Class192();
                var stream = new Stream23(zipFile);
                stream.method_6(compressionAmount);
                if (password != null)
                {
                    stream.method_2(password);
                }
                var num = 0;
                using (var enumerator = fileNameList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        var current = enumerator.Current;
                        var class2  = new Class193(current);
                        class2.method_19(DateTime.Now);
                        var    stream2 = fileStreamList[num++];
                        byte[] array;
                        if (stream2 is MemoryStream)
                        {
                            array = (stream2 as MemoryStream).ToArray();
                        }
                        else
                        {
                            array = new byte[stream2.Length];
                            var num2 = stream2.Read(array, 0, array.Length);
                            if (num2 < array.Length)
                            {
                                Array.Resize(ref array, num2);
                            }
                        }
                        class2.method_22(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.");
        }
Ejemplo n.º 2
0
 public static byte[] smethod_0(byte[] byte0)
 {
     if (byte0 == null)
     {
         throw new ArgumentNullException("seed");
     }
     if (byte0.Length == 0)
     {
         throw new ArgumentException("Length is zero", "seed");
     }
     uint[] array =
     {
         305419896u,
         591751049u,
         878082192u
     };
     for (var i = 0; i < byte0.Length; i++)
     {
         array[0] = Class192.smethod_0(array[0], byte0[i]);
         array[1] = array[1] + (byte)array[0];
         array[1] = array[1] * 134775813u + 1u;
         array[2] = Class192.smethod_0(array[2], (byte)(array[1] >> 24));
     }
     return(new[]
     {
         (byte)(array[0] & 255u),
         (byte)(array[0] >> 8 & 255u),
         (byte)(array[0] >> 16 & 255u),
         (byte)(array[0] >> 24 & 255u),
         (byte)(array[1] & 255u),
         (byte)(array[1] >> 8 & 255u),
         (byte)(array[1] >> 16 & 255u),
         (byte)(array[1] >> 24 & 255u),
         (byte)(array[2] & 255u),
         (byte)(array[2] >> 8 & 255u),
         (byte)(array[2] >> 16 & 255u),
         (byte)(array[2] >> 24 & 255u)
     });
 }