// Token: 0x06002638 RID: 9784 RVA: 0x00086BC4 File Offset: 0x00084DC4
 public Class102(Class132 cp, Struct43 contentPackHash, string fileName)
 {
     this.dictionary_0       = new Dictionary <string, Class102.Class403>(StringComparer.OrdinalIgnoreCase);
     this.ID                 = cp.ID;
     this.FileName           = fileName;
     this.Name               = cp.Name;
     this.DateInstalled      = DateTime.Now;
     this.InstallState       = Enum76.const_0;
     this.UpdateUri          = cp.UpdateUri;
     this.DataHash           = contentPackHash;
     this.AutoUpdate         = (cp.UpdateUri != null);
     this.VersionType        = cp.Type;
     this.LoaderPack         = cp.LoaderPack;
     this.ContentPackVersion = cp.Version;
     foreach (KeyValuePair <string, Struct43> keyValuePair in cp.ItemIndex)
     {
         if (!this.dictionary_0.ContainsKey(keyValuePair.Key) && Class136.smethod_8(keyValuePair.Key))
         {
             if (this.method_4(keyValuePair.Key))
             {
                 this.dictionary_0.Add(keyValuePair.Key, new Class102.Class403(keyValuePair.Value, Enum76.const_0));
             }
             else
             {
                 this.dictionary_0.Add(keyValuePair.Key, new Class102.Class403(keyValuePair.Value, Enum76.const_3));
             }
         }
     }
 }
        // Token: 0x06001EEF RID: 7919 RVA: 0x00066BF4 File Offset: 0x00064DF4
        private static bool smethod_2(string data, out long expectedSize, out Struct43 expectedHash)
        {
            expectedSize = 0L;
            expectedHash = default(Struct43);
            int    num = 0;
            string text;

            if (!data.smethod_8(' ', ref num, out text))
            {
                return(false);
            }
            long num2;

            if (!long.TryParse(text, out num2))
            {
                return(false);
            }
            if (!data.smethod_7(ref num, out text))
            {
                return(false);
            }
            if (!text.smethod_13())
            {
                return(false);
            }
            expectedHash = new Struct43(text);
            expectedSize = num2;
            return(true);
        }
        // Token: 0x060020A8 RID: 8360 RVA: 0x0006DF14 File Offset: 0x0006C114
        private void method_6(Stream file_stream, BinaryReader reader, bool loadIcon, bool populateData)
        {
            this.ID             = reader.smethod_29();
            this.DataHash       = reader.smethod_24();
            this.LoaderPack     = Struct43.smethod_5(this.DataHash, Struct43.struct43_0);
            this.UpdateUri      = reader.smethod_32();
            this.Name           = reader.ReadString();
            this.Author         = reader.ReadString();
            this.Description    = reader.ReadString();
            this.Version        = reader.smethod_27();
            this.MinimumVersion = reader.smethod_27();
            this.PasswordHash   = reader.smethod_24();
            int num = reader.ReadInt32();

            if (num > 0)
            {
                if (loadIcon)
                {
                    using (Stream3 stream = new Stream3(file_stream, file_stream.Position, (long)num + file_stream.Position))
                    {
                        this.memoryStream_0 = new MemoryStream();
                        stream.CopyTo(this.memoryStream_0);
                        this.Icon = (Bitmap)Image.FromStream(this.memoryStream_0);
                        goto IL_EE;
                    }
                }
                file_stream.Position += (long)num;
            }
IL_EE:
            if (this.LoaderPack)
            {
                if (populateData)
                {
                    this.Data = new Class136();
                    return;
                }
            }
            else
            {
                int num2 = reader.ReadInt32();
                for (int i = 0; i < num2; i++)
                {
                    this.ItemIndex.Add(reader.ReadString(), reader.smethod_24());
                }
                int num3 = reader.ReadInt32();
                if (populateData)
                {
                    using (Stream3 stream2 = new Stream3(file_stream, file_stream.Position, (long)num3 + file_stream.Position))
                    {
                        this.Data = new Class136(stream2);
                        this.Data.method_12();
                        return;
                    }
                }
                file_stream.Position += (long)num3;
            }
        }
示例#4
0
 // Token: 0x06002616 RID: 9750 RVA: 0x00010E26 File Offset: 0x0000F026
 private Class402(Struct43 hash, Uri downloadUri, Version mininumVersion, List <KeyValuePair <Struct43, Class319> > patches)
 {
     if (downloadUri == null)
     {
         throw new ArgumentNullException("downloadUri");
     }
     this.Hash           = hash;
     this.DownloadUri    = downloadUri;
     this.MinimumVersion = mininumVersion;
     this.list_0         = patches;
 }
 // Token: 0x060019BB RID: 6587 RVA: 0x00008F60 File Offset: 0x00007160
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (!(destinationType == typeof(string)))
     {
         return(base.ConvertTo(context, culture, value, destinationType));
     }
     if (Struct43.smethod_5((Struct43)value, Struct43.struct43_0))
     {
         return(Class195.string_0);
     }
     return(value.ToString());
 }
        // Token: 0x060029BA RID: 10682 RVA: 0x0009FF00 File Offset: 0x0009E100
        public static Struct43 smethod_2(this Stream stream)
        {
            long position = stream.Position;

            stream.Position = 0L;
            Struct43 result;

            using (MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider())
            {
                result = new Struct43(BitConverter.ToString(md5CryptoServiceProvider.ComputeHash(stream)));
            }
            stream.Position = position;
            return(result);
        }
示例#7
0
 // Token: 0x060018C5 RID: 6341 RVA: 0x00043388 File Offset: 0x00041588
 public bool method_2(Struct43 hash)
 {
     lock (((ICollection)this.Patches).SyncRoot)
     {
         foreach (Class282 @class in this.Patches)
         {
             if (Struct43.smethod_5(@class.ExpectedHash, hash))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
        // Token: 0x060029B8 RID: 10680 RVA: 0x0009FE40 File Offset: 0x0009E040
        public static Struct43 smethod_0(this byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            Struct43 result;

            using (MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider())
            {
                result = new Struct43(BitConverter.ToString(md5CryptoServiceProvider.ComputeHash(data, 0, data.Length)));
            }
            return(result);
        }
示例#9
0
 // Token: 0x0600261C RID: 9756 RVA: 0x00086AFC File Offset: 0x00084CFC
 public bool method_0(Struct43 currentHash, Version currentVersion, out int startIndex)
 {
     for (int i = 0; i < this.list_0.Count; i++)
     {
         KeyValuePair <Struct43, Class319> keyValuePair = this.list_0[i];
         if (Struct43.smethod_5(keyValuePair.Key, currentHash) && keyValuePair.Value.ExpectedContentPackVersion == currentVersion)
         {
             startIndex = i;
             return(true);
         }
     }
     startIndex = -1;
     return(false);
 }
        // Token: 0x060029B9 RID: 10681 RVA: 0x0009FE94 File Offset: 0x0009E094
        public static Struct43 smethod_1(this Stream stream, int startPosition, int length)
        {
            long position = stream.Position;

            stream.Position = (long)startPosition;
            byte[] buffer = new byte[length];
            stream.Read(buffer, 0, length);
            Struct43 result;

            using (MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider())
            {
                result = new Struct43(BitConverter.ToString(md5CryptoServiceProvider.ComputeHash(buffer, 0, length)));
            }
            stream.Position = position;
            return(result);
        }
        // Token: 0x06001EEE RID: 7918 RVA: 0x00066B4C File Offset: 0x00064D4C
        private static bool smethod_1(string data, out uint expectedFileSize, out Struct43 expectedHash, out uint resultingFileSize, out Struct43 resultingHash)
        {
            expectedFileSize  = 0U;
            expectedHash      = default(Struct43);
            resultingFileSize = 0U;
            resultingHash     = default(Struct43);
            int    num = 0;
            string text;

            if (!data.smethod_8(' ', ref num, out text))
            {
                return(false);
            }
            if (!uint.TryParse(text, out expectedFileSize))
            {
                return(false);
            }
            if (!data.smethod_8(' ', ref num, out text))
            {
                return(false);
            }
            if (!text.smethod_13())
            {
                return(false);
            }
            expectedHash = new Struct43(text);
            if (!data.smethod_8(' ', ref num, out text))
            {
                return(false);
            }
            if (!uint.TryParse(text, out resultingFileSize))
            {
                return(false);
            }
            if (!data.smethod_7(ref num, out text))
            {
                return(false);
            }
            if (!text.smethod_13())
            {
                return(false);
            }
            resultingHash = new Struct43(text);
            return(true);
        }
示例#12
0
        // Token: 0x0600243F RID: 9279 RVA: 0x0007AE64 File Offset: 0x00079064
        private static void smethod_1(Class321 pd, BinaryWriter write_stream, uint offset_orig, uint offset_new, string filename, Stream stream_orig, uint orig_start, uint orig_end, Stream stream_new, uint new_start, uint new_end)
        {
            uint num  = new_end - new_start;
            uint num2 = orig_end - orig_start;

            using (Stream3 stream = new Stream3(stream_orig, (long)((ulong)orig_start), (long)((ulong)orig_end)))
            {
                using (Stream3 stream2 = new Stream3(stream_new, (long)((ulong)new_start), (long)((ulong)new_end)))
                {
                    if (num == num2 && Struct43.smethod_5(stream.smethod_2(), stream2.smethod_2()))
                    {
                        Class292.smethod_4(pd, write_stream, 0U, null, 0U, num2, offset_orig + orig_start);
                    }
                    else
                    {
                        Class292.smethod_12(pd, Class292.smethod_15(filename), write_stream, offset_orig + orig_start, offset_new + new_start, stream, stream2);
                    }
                }
            }
        }
示例#13
0
        // Token: 0x060018C4 RID: 6340 RVA: 0x000432E0 File Offset: 0x000414E0
        public Class186 method_1(Struct43 expectedHash)
        {
            Class186 @class = this.method_0();

            lock (((ICollection)this.Patches).SyncRoot)
            {
                for (int i = this.Patches.Count - 1; i >= 0; i--)
                {
                    if (Struct43.smethod_5(expectedHash, this.Patches[i].ExpectedHash))
                    {
                        while (i < this.Patches.Count)
                        {
                            @class.Patches.Add(this.Patches[i].imethod_0());
                            i++;
                        }
                        break;
                    }
                }
            }
            return(@class);
        }
示例#14
0
        // Token: 0x060018C7 RID: 6343 RVA: 0x00043434 File Offset: 0x00041634
        public Enum23 method_4(string filename, out Struct43 actualFileHash, out long actualFileSize)
        {
            actualFileSize = 0L;
            actualFileHash = default(Struct43);
            Enum23 result;

            try
            {
                if (File.Exists(filename))
                {
                    actualFileHash = Class513.smethod_0(filename);
                    if (this.ExpectedSize == (actualFileSize = Class234.smethod_11(filename)))
                    {
                        if (Struct43.smethod_5(this.ExpectedHash, actualFileHash))
                        {
                            result = Enum23.const_2;
                        }
                        else
                        {
                            result = Enum23.const_1;
                        }
                    }
                    else
                    {
                        result = Enum23.const_1;
                    }
                }
                else
                {
                    result = Enum23.const_0;
                }
            }
            finally
            {
                this.ForceRecheck = false;
            }
            return(result);
        }
 // Token: 0x060020A7 RID: 8359 RVA: 0x0006DE08 File Offset: 0x0006C008
 private static void smethod_3(Stream stream, out uint index, out uint data_length)
 {
     using (Stream3 stream2 = new Stream3(stream))
     {
         using (BinaryReader binaryReader = new BinaryReader(stream2))
         {
             binaryReader.ReadBytes(Class132.byte_0.Length);
             binaryReader.ReadInt32();
             binaryReader.smethod_29();
             Struct43 val = binaryReader.smethod_24();
             if (Struct43.smethod_5(val, Struct43.struct43_0))
             {
                 throw new LoaderPackNotSupported();
             }
             if (binaryReader.ReadBoolean())
             {
                 binaryReader.ReadString();
             }
             binaryReader.ReadString();
             binaryReader.ReadString();
             binaryReader.ReadString();
             binaryReader.smethod_27();
             binaryReader.smethod_27();
             binaryReader.smethod_24();
             int num = binaryReader.ReadInt32();
             stream.Position += (long)num;
             int num2 = binaryReader.ReadInt32();
             for (int i = 0; i < num2; i++)
             {
                 binaryReader.ReadString();
                 binaryReader.smethod_24();
             }
             data_length = (uint)binaryReader.ReadInt32();
             index       = (uint)stream.Position;
         }
     }
 }
        // Token: 0x06002265 RID: 8805 RVA: 0x00074E74 File Offset: 0x00073074
        private static bool smethod_0(string line, out string fileName, out long expectedSize, out Struct43 expectedHash)
        {
            fileName     = null;
            expectedSize = 0L;
            expectedHash = default(Struct43);
            int    num = 0;
            string text;

            if (!line.smethod_8(' ', ref num, out text))
            {
                return(false);
            }
            string text2;

            if (!line.smethod_8(' ', ref num, out text2))
            {
                return(false);
            }
            long num2;

            if (!long.TryParse(text2, out num2))
            {
                return(false);
            }
            if (!line.smethod_7(ref num, out text2))
            {
                return(false);
            }
            if (!text2.smethod_13())
            {
                return(false);
            }
            fileName     = text;
            expectedSize = num2;
            expectedHash = new Struct43(text2);
            return(true);
        }
示例#17
0
        // Token: 0x060018C8 RID: 6344 RVA: 0x000434B8 File Offset: 0x000416B8
        public Enum23 method_5(Class186 lastFile, string filename, out Struct43 actualFileHash)
        {
            actualFileHash = default(Struct43);
            Enum23 result;

            try
            {
                if (File.Exists(filename))
                {
                    if (!this.ForceRecheck && !lastFile.ForceRecheck && !(this.Version != lastFile.Version))
                    {
                        if (this.ExpectedSize == Class234.smethod_11(filename))
                        {
                            return(Enum23.const_2);
                        }
                    }
                    actualFileHash = Class513.smethod_0(filename);
                    if (Struct43.smethod_5(this.ExpectedHash, actualFileHash))
                    {
                        result = Enum23.const_2;
                    }
                    else
                    {
                        result = Enum23.const_1;
                    }
                }
                else
                {
                    result = Enum23.const_0;
                }
            }
            finally
            {
                this.ForceRecheck = false;
            }
            return(result);
        }
 // Token: 0x06002161 RID: 8545 RVA: 0x0000DB79 File Offset: 0x0000BD79
 public static void smethod_25(this BinaryWriter writer, Struct43 hash)
 {
     writer.Write(hash.method_0());
 }
 // Token: 0x0600215F RID: 8543 RVA: 0x0000DB58 File Offset: 0x0000BD58
 public static void smethod_23(this Stream stream, Struct43 hashCode)
 {
     stream.Write(hashCode.method_0(), 0, 16);
 }
示例#20
0
        // Token: 0x06002617 RID: 9751 RVA: 0x00086590 File Offset: 0x00084790
        public static bool smethod_0(string data, bool loaderPack, out Class402 parser)
        {
            parser = null;
            string[] array = data.Split(new char[]
            {
                '\n',
                '\r'
            }, StringSplitOptions.RemoveEmptyEntries);
            Version  mininumVersion = null;
            Uri      uri            = null;
            Struct43 hash           = Struct43.struct43_0;

            foreach (string text in array)
            {
                if (!text.StartsWith("#"))
                {
                    string[] array2 = text.Split(new char[]
                    {
                        '='
                    });
                    if (array2.Length == 2)
                    {
                        if (string.IsNullOrEmpty(array2[1]))
                        {
                            return(false);
                        }
                        string a;
                        if ((a = array2[0]) != null)
                        {
                            if (!(a == "minimumversion"))
                            {
                                if (!(a == "hash"))
                                {
                                    if (a == "downloadurl")
                                    {
                                        Uri uri2;
                                        if (!Uri.TryCreate(array2[1], UriKind.Absolute, out uri2))
                                        {
                                            return(false);
                                        }
                                        if (!uri2.smethod_0())
                                        {
                                            return(false);
                                        }
                                        uri = uri2;
                                    }
                                }
                                else
                                {
                                    if (!array2[1].smethod_13())
                                    {
                                        return(false);
                                    }
                                    hash = new Struct43(array2[1]);
                                }
                            }
                            else
                            {
                                Regex regex = new Regex("^(?<major>(\\d+))\\.(?<minor>(\\d+))\\.(?<build>(\\d+))$");
                                if (regex.IsMatch(array2[1]))
                                {
                                    Match match = regex.Match(array2[1]);
                                    int   major = int.Parse(match.Groups["major"].Value);
                                    int   minor = int.Parse(match.Groups["minor"].Value);
                                    int   build = int.Parse(match.Groups["build"].Value);
                                    mininumVersion = new Version(major, minor, build, 0);
                                }
                            }
                        }
                    }
                }
            }
            if (uri == null)
            {
                return(false);
            }
            parser = new Class402(hash, uri, mininumVersion, null);
            return(true);
        }
        // Token: 0x0600263D RID: 9789 RVA: 0x00087018 File Offset: 0x00085218
        public void method_5()
        {
            this.DateInstalled = DateTime.Now;
            HashSet <string> hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            lock (((ICollection)this.dictionary_0).SyncRoot)
            {
                using (Class132 @class = new Class132(this.FileName, false, false))
                {
                    foreach (KeyValuePair <string, Struct43> keyValuePair in @class.ItemIndex)
                    {
                        if (this.dictionary_0.ContainsKey(keyValuePair.Key))
                        {
                            if (Struct43.smethod_6(keyValuePair.Value, this.dictionary_0[keyValuePair.Key].struct43_0))
                            {
                                if (this.dictionary_0[keyValuePair.Key].enum76_0 == Enum76.const_1)
                                {
                                    this.dictionary_0[keyValuePair.Key].enum76_0 = Enum76.const_3;
                                }
                                this.dictionary_0[keyValuePair.Key].struct43_0 = keyValuePair.Value;
                            }
                        }
                        else if (Class136.smethod_8(keyValuePair.Key))
                        {
                            if (this.method_4(keyValuePair.Key))
                            {
                                this.dictionary_0.Add(keyValuePair.Key, new Class102.Class403(keyValuePair.Value, Enum76.const_0));
                            }
                            else
                            {
                                this.dictionary_0.Add(keyValuePair.Key, new Class102.Class403(keyValuePair.Value, Enum76.const_3));
                                this.InstallState = Enum76.const_3;
                            }
                        }
                    }
                    foreach (KeyValuePair <string, Class102.Class403> keyValuePair2 in this.dictionary_0)
                    {
                        if ([email protected](keyValuePair2.Key))
                        {
                            Enum76 @enum = keyValuePair2.Value.enum76_0;
                            if (@enum == Enum76.const_1)
                            {
                                keyValuePair2.Value.enum76_0 = Enum76.const_4;
                            }
                            else
                            {
                                hashSet.Add(keyValuePair2.Key);
                            }
                        }
                    }
                    this.Name               = @class.Name;
                    this.UpdateUri          = @class.UpdateUri;
                    this.VersionType        = @class.Type;
                    this.ContentPackVersion = @class.Version;
                    this.LoaderPack         = @class.LoaderPack;
                    if (this.VersionType == Enum82.const_0)
                    {
                        this.DataHash = @class.DataHash;
                    }
                }
                if (this.VersionType != Enum82.const_0)
                {
                    using (Stream stream = File.Open(this.FileName, FileMode.Open, FileAccess.Read, FileShare.None))
                    {
                        this.DataHash = stream.smethod_2();
                    }
                }
                this.dictionary_0.smethod_8(hashSet);
            }
        }
示例#22
0
 // Token: 0x06002B3A RID: 11066 RVA: 0x000A7A20 File Offset: 0x000A5C20
 private static void smethod_1(EventHandler <EventArgs9> progressChanged, string installPath, Class136 mf, Class337 index, int total, ref int count)
 {
     foreach (KeyValuePair <string, Class337.Struct34> keyValuePair in index)
     {
         string text = Path.Combine(installPath, keyValuePair.Key);
         if (!File.Exists(text) || Class234.smethod_11(text) != keyValuePair.Value.ExpectedSize || Struct43.smethod_6(Class513.smethod_0(text), keyValuePair.Value.ExpectedHash))
         {
             if (mf.method_6(keyValuePair.Key))
             {
                 Class338 @class = mf[keyValuePair.Key];
                 mf.method_15(@class);
                 @class.smethod_0(text);
                 @class.Data = null;
                 Class110.Instance.CreatedFileArchive.method_4(text);
             }
             count++;
             if (progressChanged != null)
             {
                 progressChanged(null, new EventArgs9((long)count, (long)total));
             }
         }
     }
 }
 // Token: 0x0600226B RID: 8811 RVA: 0x0000E7D2 File Offset: 0x0000C9D2
 public Struct34(long expectedSize, Struct43 expectedHash)
 {
     this.long_0     = expectedSize;
     this.struct43_0 = expectedHash;
 }
        // Token: 0x060020A9 RID: 8361 RVA: 0x0006E0CC File Offset: 0x0006C2CC
        private void method_7(Stream file_stream, BinaryReader reader, bool loadIcon, bool populateData)
        {
            Encoding encoding = Encoding.GetEncoding(1252);
            int      num      = reader.ReadInt32();

            if (num != 1)
            {
                throw new InvalidFileVersion <int>(1, 1, num);
            }
            decimal num2 = reader.ReadDecimal();
            decimal d    = reader.ReadDecimal();
            int     num3 = (int)Math.Floor(num2);

            this.MinimumVersion = new Version(num3, (int)((num2 - num3) * 100m), (int)(d * 100m), 0);
            this.Name           = Class132.smethod_4(reader, encoding);
            this.Description    = Class132.smethod_4(reader, encoding);
            this.Author         = Class132.smethod_4(reader, encoding);
            this.PasswordHash   = new Struct43(Class132.smethod_4(reader, encoding));
            if (Struct43.smethod_5(this.PasswordHash, Class132.struct43_0))
            {
                this.PasswordHash = Struct43.struct43_0;
            }
            Class132.smethod_4(reader, encoding);
            string text = Class132.smethod_4(reader, encoding);

            if (!string.IsNullOrEmpty(text))
            {
                this.ObsoleteDownloadURL = new Uri(text);
            }
            string text2 = Class132.smethod_4(reader, encoding);

            if (!string.IsNullOrEmpty(text2))
            {
                this.UpdateUri = new Uri(text2);
            }
            this.ID       = new Guid(Class132.smethod_4(reader, encoding));
            this.DataHash = new Struct43(Class132.smethod_4(reader, encoding));
            int num4 = reader.ReadInt32();

            if (num4 > 0)
            {
                if (loadIcon)
                {
                    using (Stream3 stream = new Stream3(file_stream, file_stream.Position, file_stream.Position + (long)num4))
                    {
                        this.memoryStream_0 = new MemoryStream();
                        stream.CopyTo(this.memoryStream_0);
                        this.Icon = (Bitmap)Image.FromStream(this.memoryStream_0);
                        goto IL_1AC;
                    }
                }
                file_stream.Position += (long)num4;
            }
IL_1AC:
            this.LoaderPack = reader.ReadBoolean();
            if (this.LoaderPack)
            {
                this.DataHash = Struct43.struct43_0;
            }
            if (this.LoaderPack)
            {
                if (populateData)
                {
                    this.Data = new Class136();
                    return;
                }
            }
            else
            {
                int num5 = reader.ReadInt32();
                for (int i = 0; i < num5; i++)
                {
                    this.ItemIndex.Add(Class132.smethod_4(reader, encoding), new Struct43(Class132.smethod_4(reader, encoding)));
                }
                int num6 = reader.ReadInt32();
                if (populateData)
                {
                    using (Stream3 stream2 = new Stream3(file_stream, file_stream.Position, file_stream.Position + (long)num6))
                    {
                        this.Data = new Class136(stream2);
                        this.Data.method_12();
                        return;
                    }
                }
                file_stream.Position += (long)num6;
            }
        }
 // Token: 0x06002643 RID: 9795 RVA: 0x00010F3E File Offset: 0x0000F13E
 public Class403(Struct43 hash, Enum76 state)
 {
     this.struct43_0 = hash;
     this.enum76_0   = state;
 }
        // Token: 0x06001E4A RID: 7754 RVA: 0x000624D8 File Offset: 0x000606D8
        public void method_1(Stream stream_orig, Stream stream_patch, Stream stream_dest, uint?overrideExpectedStartingFileLength, Struct43 overrideExpectedStartingHash, uint?overrideExpectedResultingFileLength, Struct43 overrideExpectedResultingHash, bool validate_expected, bool validate_result)
        {
            using (Stream3 stream = new Stream3(stream_orig))
            {
                using (Stream3 stream2 = new Stream3(stream_patch))
                {
                    using (Stream3 stream3 = new Stream3(stream_dest))
                    {
                        using (BinaryReader binaryReader = new BinaryReader(stream))
                        {
                            using (BinaryReader binaryReader2 = new BinaryReader(stream2))
                            {
                                using (BinaryWriter binaryWriter = new BinaryWriter(stream3))
                                {
                                    binaryReader2.ReadUInt32();
                                    ushort   num     = binaryReader2.ReadUInt16();
                                    uint     num2    = binaryReader2.ReadUInt32();
                                    Struct43 @struct = binaryReader2.BaseStream.smethod_22();
                                    uint     num3    = binaryReader2.ReadUInt32();
                                    Struct43 struct2 = binaryReader2.BaseStream.smethod_22();
                                    uint     num4    = 0U;
                                    if (validate_expected)
                                    {
                                        if (stream.Length != (long)((ulong)num2) && (overrideExpectedStartingFileLength == null || overrideExpectedStartingFileLength.Value != num2))
                                        {
                                            throw new InvalidDataException(string.Format("The starting file size: '{0}' does not match the expected file size: '{1}'.", stream.Length, num2));
                                        }
                                        Struct43 struct3 = stream_orig.smethod_2();
                                        if (Struct43.smethod_6(struct3, @struct) && (Struct43.smethod_5(overrideExpectedStartingHash, Struct43.struct43_0) || Struct43.smethod_6(overrideExpectedStartingHash, struct3)))
                                        {
                                            throw new InvalidDataException(string.Format("The actual starting hash: '{0}' does not match the expected hash: '{1}'.", struct3, @struct));
                                        }
                                    }
                                    byte[] buffer = new byte[4096];
                                    int    num5   = 0;
                                    uint   num7;
                                    uint   num10;
                                    do
                                    {
                                        ushort num6 = (ushort)(num7 = (uint)binaryReader2.ReadUInt16());
                                        while (num6 > 0 && !binaryReader2.smethod_3())
                                        {
                                            int num8 = binaryReader2.Read(buffer, 0, (int)((num6 > 4096) ? 4096 : num6));
                                            binaryWriter.Write(buffer, 0, num8);
                                            num6 -= (ushort)num8;
                                            num4 += (uint)((ushort)num8);
                                            if (this.eventHandler_0 != null)
                                            {
                                                int num9 = EventArgs9.smethod_0((long)((ulong)num4), (long)((ulong)num3));
                                                if (num5 != num9)
                                                {
                                                    num5 = num9;
                                                    this.eventHandler_0(this, new EventArgs9((long)((ulong)num4), (long)((ulong)num3)));
                                                }
                                            }
                                        }
                                        num6 = (ushort)(num10 = (uint)binaryReader2.ReadUInt16());
                                        if (num6 > 0)
                                        {
                                            int num11 = binaryReader2.ReadInt32();
                                            if (num < 2)
                                            {
                                                binaryReader.BaseStream.Seek((long)num11, SeekOrigin.Begin);
                                            }
                                            else
                                            {
                                                binaryReader.BaseStream.Seek((long)num11, SeekOrigin.Current);
                                            }
                                            while (num6 > 0 && !binaryReader2.smethod_3())
                                            {
                                                int num8 = binaryReader.Read(buffer, 0, (int)((num6 > 4096) ? 4096 : num6));
                                                binaryWriter.Write(buffer, 0, num8);
                                                num6 -= (ushort)num8;
                                                num4 += (uint)((ushort)num8);
                                                if (this.eventHandler_0 != null)
                                                {
                                                    int num9 = EventArgs9.smethod_0((long)((ulong)num4), (long)((ulong)num3));
                                                    if (num5 != num9)
                                                    {
                                                        num5 = num9;
                                                        this.eventHandler_0(this, new EventArgs9((long)((ulong)num4), (long)((ulong)num3)));
                                                    }
                                                }
                                            }
                                        }
                                    }while (num10 != 0U || num7 != 0U);
                                    if (validate_result)
                                    {
                                        if (stream3.Length != (long)((ulong)num3))
                                        {
                                            if (overrideExpectedResultingFileLength != null)
                                            {
                                                uint?num12  = overrideExpectedResultingFileLength;
                                                long length = stream3.Length;
                                                if ((ulong)num12.GetValueOrDefault() == (ulong)length && num12 != null)
                                                {
                                                    goto IL_2D7;
                                                }
                                            }
                                            throw new InvalidDataException(string.Format("The resulting file length: '{0}' does not match the expected data length: '{1}'.", stream3.Length, num3));
                                        }
IL_2D7:
                                        Struct43 struct4 = stream3.smethod_2();
                                        if (Struct43.smethod_6(struct4, struct2) && (Struct43.smethod_5(overrideExpectedResultingHash, Struct43.struct43_0) || Struct43.smethod_6(overrideExpectedResultingHash, struct4)))
                                        {
                                            throw new InvalidDataException(string.Format("The resulting hash: '{0}' does not match the expected hash: '{1}'.", struct4, struct2));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#27
0
 // Token: 0x060018C2 RID: 6338 RVA: 0x00008226 File Offset: 0x00006426
 public Class186(long expectedSize, Struct43 expectedHash, string version) : this()
 {
     this.ExpectedSize = expectedSize;
     this.ExpectedHash = expectedHash;
     this.Version      = version;
 }
示例#28
0
        // Token: 0x060018C6 RID: 6342 RVA: 0x0004341C File Offset: 0x0004161C
        public Enum23 method_3(string filename, out Struct43 actualFileHash)
        {
            long num;

            return(this.method_4(filename, out actualFileHash, out num));
        }
        // Token: 0x06001E4B RID: 7755 RVA: 0x000628E8 File Offset: 0x00060AE8
        public static void smethod_17(Stream compressed_patch_stream, string destination_file, uint?overrideExpectedStartingFileLength, Struct43 overrideExpectedStartingHash, uint?overrideExpectedResultingFileLength, Struct43 overrideExpectedResultingHash, EventHandler <EventArgs9> progressChanged)
        {
            string text = destination_file + ".tmp";

            try
            {
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    Class219.smethod_0(compressed_patch_stream, memoryStream, false);
                    memoryStream.Position = 0L;
                    Class234.smethod_14(destination_file, text, true);
                    using (Stream stream = File.Open(text, FileMode.Open, FileAccess.Read, FileShare.None))
                    {
                        using (Stream stream2 = File.Open(destination_file, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
                        {
                            Class292 @class = new Class292();
                            if (progressChanged != null)
                            {
                                @class.ProgressChanged += progressChanged;
                            }
                            @class.method_1(stream, memoryStream, stream2, overrideExpectedStartingFileLength, overrideExpectedStartingHash, overrideExpectedResultingFileLength, overrideExpectedResultingHash, false, false);
                        }
                    }
                }
            }
            finally
            {
                if (File.Exists(text))
                {
                    File.Delete(text);
                }
            }
        }
示例#30
0
        // Token: 0x06002618 RID: 9752 RVA: 0x00086750 File Offset: 0x00084950
        public static bool smethod_1(string data, bool loaderPack, out Class402 parser)
        {
            parser = null;
            string[] array = data.Split(new char[]
            {
                '\n',
                '\r'
            }, StringSplitOptions.RemoveEmptyEntries);
            List <KeyValuePair <Struct43, Class319> > patches = null;
            Uri      uri     = null;
            Struct43 hash    = Struct43.struct43_0;
            Version  version = null;

            for (int i = 0; i < array.Length; i++)
            {
                string text = array[i];
                if (!text.StartsWith("#"))
                {
                    string[] array2 = text.Split(new char[]
                    {
                        '='
                    });
                    if (array2.Length == 2)
                    {
                        string text2;
                        if (!Class402.smethod_4(array, array2[1], ref i, out text2))
                        {
                            return(false);
                        }
                        string a;
                        if ((a = array2[0]) != null)
                        {
                            if (!(a == "minimum_version"))
                            {
                                if (!(a == "download"))
                                {
                                    if (!(a == "hash"))
                                    {
                                        if (a == "patches" && !Class402.smethod_2(text2, out patches))
                                        {
                                            return(false);
                                        }
                                    }
                                    else
                                    {
                                        if (!text2.smethod_13())
                                        {
                                            return(false);
                                        }
                                        hash = new Struct43(text2);
                                    }
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(text2))
                                    {
                                        return(false);
                                    }
                                    Uri uri2;
                                    if (!Uri.TryCreate(text2, UriKind.Absolute, out uri2))
                                    {
                                        return(false);
                                    }
                                    if (!uri2.smethod_0())
                                    {
                                        return(false);
                                    }
                                    uri = uri2;
                                }
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(text2))
                                {
                                    return(false);
                                }
                                if (!Version.TryParse(text2, out version))
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }
            if (uri == null)
            {
                return(false);
            }
            if (version == null)
            {
                version = Class500.Current.FileVersion;
            }
            parser = new Class402(hash, uri, version, patches);
            return(true);
        }