Exemplo n.º 1
0
        private TMDExcractionAndProcessing method_15(GClass30 gclass30_0, bool bool_5 = true)
        {
            this.method_17("Downloading TMD...");
            string path = Path.Combine(gclass30_0.OutputPath, "title.tmd");

            if (!bool_5 && gclass30_0.Tmd != null)
            {
                return(gclass30_0.Tmd);
            }
            GClass78 gclass78 = new GClass78();

            byte[] numArray = (byte[])null;
            try
            {
                numArray       = !(gclass30_0 is GClass33) ? gclass78.DownloadFile(gclass30_0.CDN_URL_PLUS_TITLEID + "tmd") : gclass78.DownloadFile(string.Format("{0}tmd.{1}", (object)gclass30_0.CDN_URL_PLUS_TITLEID, (object)gclass30_0.Version));
                gclass30_0.Tmd = TMDExcractionAndProcessing.ReadTMDBytes(numArray, gclass30_0.System);
            }
            catch (Exception ex)
            {
                this.method_5("TMD not found\n" + ex.ToString() + "\n" + ex.InnerException?.ToString());
            }
            if (bool_5)
            {
                System.IO.File.WriteAllBytes(path, numArray);
            }
            return(gclass30_0.Tmd);
        }
Exemplo n.º 2
0
 private GEnum2 method_19()
 {
     if (!Directory.Exists(this.OutputPath) || !File.Exists(Path.Combine(this.OutputPath, "title.tmd")) || !File.Exists(Path.Combine(this.OutputPath, "title.tik")) || (this.System == SystemType.SystemWiiU || this.System == SystemType.SystemWii) && !File.Exists(Path.Combine(this.OutputPath, "title.cert")))
     {
         return(GEnum2.const_0);
     }
     if ((this is GClass31 || this.Platform == Platform.Wii_U_Custom) && !new GClass78().DownloadFile(this.CDN_URL_PLUS_TITLEID + "tmd").smethod_5(File.ReadAllBytes(Path.Combine(this.OutputPath, "title.tmd"))))
     {
         return(GEnum2.const_1);
     }
     foreach (GClass101 gclass101 in TMDExcractionAndProcessing.smethod_0(Path.Combine(this.OutputPath, "title.tmd"), this.System).GClass101_0)
     {
         string outputPath1 = this.OutputPath;
         uint   contentId   = gclass101.ContentId;
         string path2_1     = contentId.ToString("x8") + ".app";
         string str         = Path.Combine(outputPath1, path2_1);
         if (!File.Exists(str) || new FileInfo(str).Length != (long)gclass101.ContentSize.TotalBytes.smethod_2(16U))
         {
             return(GEnum2.const_1);
         }
         if (gclass101.Boolean_0)
         {
             string outputPath2 = this.OutputPath;
             contentId = gclass101.ContentId;
             string path2_2 = contentId.ToString("x8") + ".h3";
             if (!File.Exists(Path.Combine(outputPath2, path2_2)))
             {
                 return(GEnum2.const_1);
             }
         }
     }
     return(GEnum2.const_2);
 }
Exemplo n.º 3
0
 private TMDExcractionAndProcessing method_6()
 {
     if (this.gclass30_0 is GClass33)
     {
         return(TMDExcractionAndProcessing.ReadTMDBytes(new GClass78().DownloadFile(string.Format("{0}tmd.{1}", (object)this.gclass30_0.CDN_URL_PLUS_TITLEID, (object)this.gclass30_0.Version)), SystemType.SystemWiiU));
     }
     return(TMDExcractionAndProcessing.ReadTMDBytes(new GClass78().DownloadFile(string.Format("{0}tmd", (object)this.gclass30_0.CDN_URL_PLUS_TITLEID)), SystemType.SystemWiiU));
 }
Exemplo n.º 4
0
 public void method_0(string string_4, string string_5, string string_6, string string_7)
 {
     this.gclass100_0 = TMDExcractionAndProcessing.smethod_0(string_6, SystemType.SystemWii);
     this.string_0    = string_4;
     this.string_1    = string_5;
     this.string_2    = string_6;
     this.string_3    = string_7;
     this.gclass108_0 = new GClass108();
 }
Exemplo n.º 5
0
        private static void smethod_3(IEnumerable <DirectoryInfo> ienumerable_0)
        {
            foreach (DirectoryInfo directoryInfo in ienumerable_0.Where <DirectoryInfo>((Func <DirectoryInfo, bool>)(directoryInfo_0 =>
            {
                ulong result;
                if (directoryInfo_0.Name.Length == 16 && ulong.TryParse(directoryInfo_0.Name, NumberStyles.HexNumber, (IFormatProvider)CultureInfo.CurrentCulture, out result) && !directoryInfo_0.FullName.Contains("EMULATORS"))
                {
                    return(!directoryInfo_0.FullName.Contains("SAVES"));
                }
                return(false);
            })))
            {
                TitleId  index    = new TitleId(directoryInfo.Name);
                GClass30 gclass30 = (GClass30)null;
                try
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    GClass26.Class36 class36 = new GClass26.Class36();
                    switch (index.IdType)
                    {
                    case DownloadType.Update:
                        TMDExcractionAndProcessing gclass100 = TMDExcractionAndProcessing.smethod_0(Path.Combine(directoryInfo.FullName, "title.tmd"), SystemType.SystemWiiU);
                        // ISSUE: reference to a compiler-generated field
                        class36.ushort_0 = gclass100.TitleVersion;
                        // ISSUE: reference to a compiler-generated method
                        gclass30 = (GClass30)GClass28.dictionary_0[index.FullGame].Updates.First <GClass33>(new Func <GClass33, bool>(class36.method_0));
                        break;

                    case DownloadType.GameWiiOrU:
                        gclass30 = (GClass30)GClass28.dictionary_0[index];
                        break;

                    case DownloadType.DLC:
                        gclass30 = (GClass30)GClass28.dictionary_0[index.FullGame].Dlc;
                        break;

                    case DownloadType.Game3DS:
                        gclass30 = (GClass30)GClass28.dictionary_0[index];
                        break;
                    }
                }
                catch
                {
                    continue;
                }
                try
                {
                    FileSystem.MoveDirectory(directoryInfo.FullName, gclass30.OutputPath);
                }
                catch
                {
                }
            }
        }
Exemplo n.º 6
0
 public static void smethod_2(GClass30 gclass30_0)
 {
     if (gclass30_0.GEnum2_0 != GEnum2.const_2)
     {
         throw new Exception("The title must have been downloaded!");
     }
     foreach (GClass101 gclass101 in TMDExcractionAndProcessing.ReadTMDBytes(File.ReadAllBytes(Path.Combine(gclass30_0.OutputPath, "title.tmd")), SystemType.System3DS).GClass101_0)
     {
         string string_0 = Path.Combine(gclass30_0.OutputPath, gclass101.ContentId.ToString("x8") + ".app");
         Class85.smethod_6(string_0, string_0 + ".dec", gclass30_0.byte_0, Class85.smethod_9(gclass101.Index));
     }
 }
Exemplo n.º 7
0
 public byte[] method_0(GClass12 gclass12_0, ulong ulong_2 = 0)
 {
     if (this.gclass100_0 == null || this.gclass99_0 == null)
     {
         this.gclass100_0 = TMDExcractionAndProcessing.ReadTMDBytes(new GClass78().DownloadFile(this.gclass30_0.CDN_URL_PLUS_TITLEID + "tmd"), SystemType.SystemWiiU);
         this.gclass99_0  = this.method_5();
     }
     if (gclass12_0.bool_1 || gclass12_0.bool_0)
     {
         return((byte[])null);
     }
     using (MemoryStream memoryStream = new MemoryStream())
     {
         this.method_2(gclass12_0, (Stream)memoryStream, true, ulong_2);
         return(memoryStream.ToArray());
     }
 }
Exemplo n.º 8
0
        public static TMDExcractionAndProcessing ReadTMDBytes(byte[] Nintendo_TMD_Bytes, SystemType SystemType)
        {
            TMDExcractionAndProcessing gclass100 = new TMDExcractionAndProcessing();
            MemoryStream TMD_MemoryStream        = new MemoryStream(Nintendo_TMD_Bytes);

            try
            {
                gclass100.method_0((Stream)TMD_MemoryStream, SystemType);
            }
            catch
            {
                TMD_MemoryStream.Dispose();
                throw;
            }
            TMD_MemoryStream.Dispose();
            return(gclass100);
        }
Exemplo n.º 9
0
        public GClass13 method_15()
        {
            if (this.System != SystemType.SystemWiiU)
            {
                throw new Exception("The FST can only be retrieved for WUP titles.");
            }
            TMDExcractionAndProcessing gclass100 = !(this is GClass33) ? TMDExcractionAndProcessing.ReadTMDBytes(new GClass78().DownloadFile(string.Format("{0}tmd", (object)this.CDN_URL_PLUS_TITLEID)), SystemType.SystemWiiU) : TMDExcractionAndProcessing.ReadTMDBytes(new GClass78().DownloadFile(string.Format("{0}tmd.{1}", (object)this.CDN_URL_PLUS_TITLEID, (object)this.Version)), SystemType.SystemWiiU);
            GClass99 gclass99 = this is GClass33 || this.Platform == Platform.Wii_U_Custom ? GClass99.smethod_7(new GClass78().DownloadFile(this.CDN_URL_PLUS_TITLEID + "cetk"), SystemType.SystemWiiU) : (!this.bool_0 ? GClass99.smethod_7(this.TicketArray, SystemType.SystemWiiU) : GClass99.smethod_7(File.ReadAllBytes(Path.Combine(Path.Combine(GClass88.DirectoryCache, "tickets"), this.TitleId.IdRaw + ".tik")), SystemType.SystemWiiU));

            byte[] inputBuffer = new GClass78().DownloadFile(this.CDN_URL_PLUS_TITLEID + gclass100.GClass101_0[0].ContentId.ToString("x8"));
            using (AesCryptoServiceProvider cryptoServiceProvider = new AesCryptoServiceProvider())
            {
                cryptoServiceProvider.Key     = gclass99.Byte_0;
                cryptoServiceProvider.Mode    = CipherMode.CBC;
                cryptoServiceProvider.Padding = PaddingMode.None;
                cryptoServiceProvider.IV      = new byte[16];
                return(new GClass13(cryptoServiceProvider.CreateDecryptor().TransformFinalBlock(inputBuffer, 0, inputBuffer.Length)));
            }
        }
Exemplo n.º 10
0
        private void method_9(GClass30 gclass30_0, TMDExcractionAndProcessing gclass100_0, string string_0)
        {
            this.method_17("Computing title.cert...");
            string str = Path.Combine(string_0, "title.cert");

            if (gclass30_0.System == SystemType.SystemWii)
            {
                System.IO.File.WriteAllBytes(str, GClass96.byte_0);
            }
            else if (gclass30_0.Platform == Platform.Wii_U_Custom)
            {
                this.gclass78_0.method_5(string.Format("{0}cert", (object)gclass30_0.CDN_URL_PLUS_TITLEID), str, 0UL, GClass78.GEnum4.const_0, this.Proxy, 0L, (byte[])null, (byte[])null, (byte)0);
            }
            else
            {
                using (BinaryWriter binaryWriter = new BinaryWriter((Stream)System.IO.File.Open(str, FileMode.Create)))
                {
                    binaryWriter.Write(gclass100_0.Certificate1);
                    binaryWriter.Write(gclass100_0.Certificate2);
                    binaryWriter.Write(TMDExcractionAndProcessing.Byte_0);
                }
            }
        }
Exemplo n.º 11
0
        public static List <GStruct7> smethod_1(GClass30 gclass30_0)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            Class85.Class86 class86 = new Class85.Class86();
            // ISSUE: reference to a compiler-generated field
            class86.gclass30_0 = gclass30_0;
            // ISSUE: reference to a compiler-generated field
            string str1 = Path.Combine(class86.gclass30_0.OutputPath, "title.tmd");
            // ISSUE: reference to a compiler-generated field
            string str2 = Path.Combine(class86.gclass30_0.OutputPath, "title.tik");

            // ISSUE: reference to a compiler-generated field
            if (File.Exists(str1) && (class86.gclass30_0.Ticket != null || File.Exists(str2)))
            {
                if (!File.Exists(str1))
                {
                    return(((IEnumerable <GStruct7>) new GStruct7[1]
                    {
                        new GStruct7((GClass101)null, new List <int>(), false, true)
                    }).ToList <GStruct7>());
                }
                // ISSUE: reference to a compiler-generated field
                TMDExcractionAndProcessing gclass100 = TMDExcractionAndProcessing.smethod_0(str1, class86.gclass30_0.System);
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                class86.gclass99_0 = class86.gclass30_0.Ticket ?? GClass99.smethod_6(str2, class86.gclass30_0.System);
                // ISSUE: reference to a compiler-generated method
                return(((IEnumerable <GClass101>)gclass100.GClass101_0).Select <GClass101, GStruct7>(new Func <GClass101, GStruct7>(class86.method_0)).ToList <GStruct7>());
            }
            return(((IEnumerable <GStruct7>) new GStruct7[1]
            {
                new GStruct7((GClass101)null, new List <int>(), false, true)
            }).ToList <GStruct7>());
        }
Exemplo n.º 12
0
        private void FrmImport_Load(object sender, EventArgs e)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            FrmImport.Class156 class156 = new FrmImport.Class156();
            // ISSUE: reference to a compiler-generated field
            class156.frmImport_0 = this;
            this.lstTitles.SortDescriptors.Add(new SortDescriptor("Value", ListSortDirection.Ascending));
            // ISSUE: reference to a compiler-generated field
            class156.string_0 = new string[0];
            // ISSUE: reference to a compiler-generated field
            class156.string_1 = new string[0];
            int num1;
            // ISSUE: reference to a compiler-generated method
            FrmWait frmWait = new FrmWait("USB Helper is looking for importable titles...", new Action(class156.method_0), (Action <Exception>)(exception_0 => num1 = (int)RadMessageBox.Show("An error has occured.\n" + (object)exception_0)));
            Struct4 struct4;

            // ISSUE: reference to a compiler-generated field
            foreach (string str1 in class156.string_0)
            {
                string str2 = "Ready to import";
                TMDExcractionAndProcessing gclass100 = TMDExcractionAndProcessing.smethod_0(str1, SystemType.SystemWiiU);
                TitleId titleId = new TitleId(gclass100.TitleId.ToString("x16"));
                if (!GClass28.dictionary_0.ContainsKey(titleId.FullGame))
                {
                    string           str3             = "Cannot be imported, not in the database";
                    ListViewDataItem listViewDataItem = new ListViewDataItem();
                    this.lstTitles.Items.Add(listViewDataItem);
                    listViewDataItem.Enabled = false;
                    listViewDataItem[0]      = (object)string.Format("UNKNOWN ({0})", (object)titleId.IdRaw);
                    listViewDataItem[1]      = (object)str3;
                }
                else
                {
                    GClass30 gclass30 = (GClass30)null;
                    switch (titleId.IdType)
                    {
                    case DownloadType.Update:
                        gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame];
                        if (gclass30.System == SystemType.System3DS)
                        {
                            gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame].Updates.Last <GClass33>();
                            break;
                        }
                        if (gclass30.System == SystemType.SystemWiiU)
                        {
                            // ISSUE: object of a compiler-generated type is created
                            // ISSUE: variable of a compiler-generated type
                            FrmImport.Class157 class157 = new FrmImport.Class157();
                            // ISSUE: reference to a compiler-generated field
                            class157.ushort_0 = gclass100.TitleVersion;
                            try
                            {
                                // ISSUE: reference to a compiler-generated method
                                gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame].Updates.Find(new Predicate <GClass33>(class157.method_0));
                                break;
                            }
                            catch
                            {
                                gclass30 = (GClass30)null;
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }

                    case DownloadType.GameWiiOrU:
                        gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame];
                        break;

                    case DownloadType.DLC:
                        gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame].Dlc;
                        break;

                    case DownloadType.Game3DS:
                        gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame];
                        break;

                    case DownloadType.GameDSI:
                        gclass30 = (GClass30)GClass28.dictionary_0[titleId.FullGame];
                        break;
                    }
                    if (gclass30 != null)
                    {
                        ListViewDataItem listViewDataItem1 = new ListViewDataItem();
                        struct4               = new Struct4();
                        struct4.gclass100_0   = gclass100;
                        struct4.gclass30_0    = gclass30;
                        struct4.string_0      = Path.GetDirectoryName(str1);
                        listViewDataItem1.Tag = (object)struct4;
                        ListViewDataItem listViewDataItem2 = listViewDataItem1;
                        if (gclass30.GEnum2_0 != GEnum2.const_0)
                        {
                            str2 = "Cannot be imported, already in the library";
                            listViewDataItem2.Enabled = false;
                        }
                        this.lstTitles.Items.Add(listViewDataItem2);
                        listViewDataItem2[0] = (object)gclass30.ToString();
                        listViewDataItem2[1] = (object)str2;
                    }
                }
            }
            // ISSUE: reference to a compiler-generated field
            foreach (string str in class156.string_1)
            {
                try
                {
                    if (!(new DirectoryInfo(Path.GetDirectoryName(str)).Name != "meta"))
                    {
                        TitleId key = new TitleId(XDocument.Load(str).Descendants((XName)"title_id").ElementAt <XElement>(0).Value);
                        if (key.IdType == DownloadType.GameWiiOrU)
                        {
                            if (GClass28.dictionary_0.ContainsKey(key))
                            {
                                GClass32 gclass32 = GClass28.dictionary_0[key];
                                GClass95 gclass95 = gclass32.method_14(false);
                                if (gclass95 != null)
                                {
                                    if (!gclass32.Boolean_1)
                                    {
                                        ListViewDataItem listViewDataItem1 = new ListViewDataItem();
                                        this.lstTitles.Items.Add(listViewDataItem1);
                                        listViewDataItem1[0] = (object)(gclass32.Name + " (EMU)");
                                        listViewDataItem1[1] = (object)"Importable";
                                        ListViewDataItem listViewDataItem2 = listViewDataItem1;
                                        struct4            = new Struct4();
                                        struct4.gclass30_0 = (GClass30)gclass32;
                                        struct4.gclass95_0 = gclass95;
                                        struct4.string_0   = new DirectoryInfo(Path.GetDirectoryName(str)).Parent.FullName;
                                        // ISSUE: variable of a boxed type
                                        __Boxed <Struct4> local = (ValueType)struct4;
                                        listViewDataItem2.Tag = (object)local;
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            if (this.lstTitles.Items.Count != 0)
            {
                return;
            }
            int num2 = (int)RadMessageBox.Show("No games were found. Please specify another path.");

            this.DialogResult = DialogResult.Abort;
            this.Close();
        }
Exemplo n.º 13
0
        private GClass80.Enum1 method_14(GClass30 gclass30_0)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            GClass80.Class63 class63 = new GClass80.Class63();
            // ISSUE: reference to a compiler-generated field
            class63.gclass30_0 = gclass30_0;
            // ISSUE: reference to a compiler-generated field
            GEnum2 genum20 = class63.gclass30_0.GEnum2_0;

            this.gclass78_0.method_9();
            this.timeSpan_1 = new TimeSpan(0L);
            this.timeSpan_0 = new TimeSpan(0L);
            this.gstruct3_0 = new GStruct3(0UL);
            // ISSUE: reference to a compiler-generated field
            class63.gclass30_0.CurrentlyDownloaded = true;
            // ISSUE: reference to a compiler-generated field
            if (!Directory.Exists(class63.gclass30_0.OutputPath))
            {
                // ISSUE: reference to a compiler-generated field
                Directory.CreateDirectory(class63.gclass30_0.OutputPath);
            }
            // ISSUE: reference to a compiler-generated field
            if (class63.gclass30_0.Boolean_0)
            {
                // ISSUE: reference to a compiler-generated field
                return(this.method_12((GClass32)class63.gclass30_0));
            }
            // ISSUE: reference to a compiler-generated field
            TMDExcractionAndProcessing gclass100_0 = this.method_15(class63.gclass30_0, true);
            // ISSUE: reference to a compiler-generated field
            GClass99 gclass99 = this.method_11(class63.gclass30_0);

            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            if (class63.gclass30_0.System == SystemType.SystemWiiU || class63.gclass30_0.System == SystemType.SystemWii)
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                this.method_9(class63.gclass30_0, gclass100_0, class63.gclass30_0.OutputPath);
            }
            this.dataSize_0 = gclass100_0.DataSize_0;
            this.method_17(string.Format("Content size is {0}", (object)this.dataSize_0));
            // ISSUE: reference to a compiler-generated field
            this.method_16(0, this.int_5, 0, this.timeSpan_1, this.timeSpan_2, this.timeSpan_0, new GStruct3(0UL), class63.gclass30_0);
label_7:
            for (int index = 0; index < (int)gclass100_0.NumOfContents; ++index)
            {
                bool flag1 = false;
                if (!this.bool_0)
                {
                    return(GClass80.Enum1.const_1);
                }
                GClass101 gclass101_0;
                DataSize  size;
                while (true)
                {
                    gclass101_0 = gclass100_0.GClass101_0[index];
                    this.method_17(string.Format("Downloading Content #{0} ({1:x8}) of {2}... ({3})", (object)(index + 1), (object)gclass101_0.ContentId, (object)gclass100_0.NumOfContents, (object)gclass101_0.ContentSize));
                    // ISSUE: reference to a compiler-generated field
                    string string_0 = Path.Combine(class63.gclass30_0.OutputPath, gclass101_0.ContentId.ToString("x8"));
                    ulong  num1     = 0;
                    GClass6.smethod_6(string_0 + ".app.partial");
                    if (System.IO.File.Exists(string_0 + ".app"))
                    {
                        goto label_35;
                    }
label_9:
                    try
                    {
                        int num2 = (int)Class64.SetThreadExecutionState(2147483649U);
                        this.method_17("Downloading content...");
                        if (gclass101_0.Boolean_0)
                        {
                            // ISSUE: reference to a compiler-generated field
                            int num3 = (int)this.method_10(class63.gclass30_0, gclass101_0, string_0, GClass80.Enum0.const_0, 0UL);
                        }
                        bool flag2 = false;
                        // ISSUE: reference to a compiler-generated field
                        if (class63.gclass30_0 is GClass33 && gclass101_0.Boolean_0)
                        {
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated method
                            foreach (GClass30 gclass30 in class63.gclass30_0.GClass32_0.Updates.Where <GClass33>(class63.func_0 ?? (class63.func_0 = new Func <GClass33, bool>(class63.method_0))))
                            {
                                string str1 = Path.Combine(gclass30.OutputPath, gclass101_0.ContentId.ToString("x8"));
                                string str2 = str1 + ".app";
                                string path = str1 + ".h3";
                                if (System.IO.File.Exists(path) && System.IO.File.Exists(str2) && System.IO.File.ReadAllBytes(path).smethod_5(System.IO.File.ReadAllBytes(string_0 + ".h3")))
                                {
                                    long length = new FileInfo(str2).Length;
                                    size = gclass101_0.ContentSize;
                                    long totalBytes1 = (long)size.TotalBytes;
                                    if (length == totalBytes1)
                                    {
                                        this.method_17("Found similar file in older update. Copying...");
                                        System.IO.File.Copy(str2, string_0 + ".app", true);
                                        GClass78 gclass780             = this.gclass78_0;
                                        DataSize downloadedCurrentGame = gclass780.TotalDownloadedCurrentGame;
                                        size = gclass101_0.ContentSize;
                                        long totalBytes2 = (long)size.TotalBytes;
                                        gclass780.TotalDownloadedCurrentGame = downloadedCurrentGame + (ulong)totalBytes2;
                                        this.gclass78_0.TotalDataDownloaded += gclass101_0.ContentSize;
                                        flag2 = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!flag2)
                        {
                            // ISSUE: reference to a compiler-generated field
                            if (this.method_10(class63.gclass30_0, gclass101_0, string_0, GClass80.Enum0.const_1, num1) == GClass80.Enum1.const_1)
                            {
                                return(GClass80.Enum1.const_1);
                            }
                            if (this.bool_2)
                            {
                                if (gclass101_0.Boolean_0)
                                {
                                    if (genum20 != GEnum2.const_2)
                                    {
                                        goto label_7;
                                    }
                                }
                                this.method_17("Verifying download...");
                                this.method_13(true);
                                // ISSUE: reference to a compiler-generated field
                                GStruct7 gstruct7 = Class85.smethod_4(class63.gclass30_0, gclass101_0, gclass99.Byte_0);
                                this.method_13(false);
                                if (!gstruct7.Boolean_0)
                                {
                                    this.gclass78_0.TotalDataDownloaded        -= gclass101_0.ContentSize;
                                    this.gclass78_0.TotalDownloadedCurrentGame -= gclass101_0.ContentSize;
                                    continue;
                                }
                                goto label_7;
                            }
                            else
                            {
                                goto label_7;
                            }
                        }
                        else
                        {
                            goto label_7;
                        }
                    }
                    catch (Exception ex)
                    {
                        bool         flag2 = false;
                        WebException webException;
                        if ((webException = ex as WebException) != null && webException.Status == WebExceptionStatus.ProtocolError && webException.Response != null)
                        {
                            flag2 = ((HttpWebResponse)webException.Response).StatusCode == HttpStatusCode.NotFound;
                        }
                        if (!flag2)
                        {
                            this.method_17(string.Format("Downloading Content #{0} of {1} failed...", (object)(index + 1), (object)gclass100_0.NumOfContents));
                            this.method_17(ex.Message);
                            // ISSUE: reference to a compiler-generated field
                            class63.gclass30_0.CurrentlyDownloaded = false;
                            this.method_5("Downloading Content Failed:\n" + ex.Message);
                            goto label_48;
                        }
                        else
                        {
                            this.method_17(string.Format("Downloading Content #{0} of {1} failed... (File not on NUS)", (object)(index + 1), (object)gclass100_0.NumOfContents));
                            goto label_48;
                        }
                    }
label_35:
                    num1 = (ulong)new FileInfo(string_0 + ".app").Length;
                    this.method_17("Local file detected. Checking size...");
                    long num4 = (long)num1;
                    size = gclass101_0.ContentSize;
                    long totalBytes = (long)size.TotalBytes;
                    if (num4 == totalBytes)
                    {
                        this.method_17("Sizes match. Checking file....");
                        if (gclass101_0.Boolean_0 && !System.IO.File.Exists(string_0 + ".h3"))
                        {
                            // ISSUE: reference to a compiler-generated field
                            int num2 = (int)this.method_10(class63.gclass30_0, gclass101_0, string_0, GClass80.Enum0.const_0, 0UL);
                        }
                        if (this.bool_3)
                        {
                            this.method_13(true);
                            // ISSUE: reference to a compiler-generated field
                            GStruct7 gstruct7 = Class85.smethod_4(class63.gclass30_0, gclass101_0, gclass99.Byte_0);
                            this.method_13(false);
                            if (!gstruct7.Boolean_0)
                            {
                                // ISSUE: reference to a compiler-generated field
                                if (gclass101_0.Boolean_0 && class63.gclass30_0.Platform != Platform.Wii_U_Custom && !flag1)
                                {
                                    this.method_17(string.Format("File has {0} corrupted block(s) for a total of  {1} bytes", (object)gstruct7.list_0.Count, (object)(gstruct7.list_0.Count * 65536)));
                                    this.method_17("Attempting repair. This may take a while depending on the state of the file.");
                                    string str = gclass101_0.ContentId.ToString("x8");
                                    // ISSUE: reference to a compiler-generated field
                                    // ISSUE: reference to a compiler-generated field
                                    GClass78.smethod_0(class63.gclass30_0.String_1 + str, string_0 + ".app", System.IO.File.ReadAllBytes(string_0 + ".h3"), class63.gclass30_0.Ticket.Byte_0, (IEnumerable <int>)gstruct7.list_0);
                                    flag1 = true;
                                }
                                else
                                {
                                    this.method_17("This file is corrupted but cannot be repaired. Now redownloading...");
                                    GClass6.smethod_6(string_0 + ".app");
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        size = gclass101_0.ContentSize;
                        if (size.TotalBytes < num1)
                        {
                            this.method_17("This file does not qualify for intelligent resuming. Redownloading...");
                            GClass6.smethod_6(string_0 + ".app");
                        }
                        else
                        {
                            this.method_17(string.Format("Sizes mismatch. Resuming download at {0}", (object)new DataSize(num1)));
                            goto label_9;
                        }
                    }
                }
                this.method_17("This file is good, skipping...");
                GClass78 gclass780_1            = this.gclass78_0;
                DataSize downloadedCurrentGame1 = gclass780_1.TotalDownloadedCurrentGame;
                size = gclass101_0.ContentSize;
                long totalBytes3 = (long)size.TotalBytes;
                gclass780_1.TotalDownloadedCurrentGame = downloadedCurrentGame1 + (ulong)totalBytes3;
                this.gclass78_0.TotalDataDownloaded   += gclass101_0.ContentSize;
                continue;
label_48:
                GC.Collect();
            }
            // ISSUE: reference to a compiler-generated field
            this.method_17(string.Format("Downloading Title {0} v{1} Finished...", (object)class63.gclass30_0.TitleId, (object)gclass100_0.TitleVersion));
            // ISSUE: reference to a compiler-generated field
            this.method_16(100, this.int_5, 100, new TimeSpan(0L), this.timeSpan_2, new TimeSpan(0L), this.gstruct3_0, class63.gclass30_0);
            return(GClass80.Enum1.const_0);
        }
Exemplo n.º 14
0
 public static TMDExcractionAndProcessing smethod_0(string Nintendo_TMD_File, SystemType SystemType)
 {
     return(TMDExcractionAndProcessing.ReadTMDBytes(File.ReadAllBytes(Nintendo_TMD_File), SystemType));
 }