public static Enum3 smethod_0(byte[] byte_1, byte[] byte_2, int int_5, byte[] byte_3, byte byte_4) { byte[] numArray1 = new byte[16]; numArray1[1] = byte_4; byte[] byte_3_1 = numArray1; SHA1 shA1 = SHA1.Create(); byte[] byte_1_1 = new byte[1024]; Buffer.BlockCopy((Array)byte_1, 0, (Array)byte_1_1, 0, 1024); byte[] numArray2 = Class85.smethod_5(byte_1_1, byte_3, byte_3_1); numArray2[1] ^= byte_4; int srcOffset1 = int_5 % 16 * 20; int srcOffset2 = (16 + int_5 / 16 % 16) * 20; int srcOffset3 = (32 + int_5 / 256 % 16) * 20; int srcOffset4 = int_5 / 4096 % 16 * 20; byte[] byte_0_1 = new byte[20]; byte[] byte_1_2 = new byte[20]; byte[] byte_0_2 = new byte[20]; byte[] byte_1_3 = new byte[20]; Buffer.BlockCopy((Array)numArray2, srcOffset1, (Array)byte_0_1, 0, 20); Buffer.BlockCopy((Array)numArray2, srcOffset1, (Array)byte_3_1, 0, 16); byte[] byte_1_4 = new byte[64512]; Buffer.BlockCopy((Array)byte_1, 1024, (Array)byte_1_4, 0, 64512); byte[] buffer1 = Class85.smethod_5(byte_1_4, byte_3, byte_3_1); byte[] hash1 = shA1.ComputeHash(buffer1); if (!GClass27.smethod_1(byte_0_1, hash1)) { return(Enum3.const_1); } if (int_5 % 16 == 0) { byte[] buffer2 = new byte[320]; Buffer.BlockCopy((Array)numArray2, srcOffset1, (Array)buffer2, 0, 320); Buffer.BlockCopy((Array)numArray2, srcOffset2, (Array)byte_1_2, 0, 20); if (!GClass27.smethod_1(shA1.ComputeHash(buffer2), byte_1_2)) { return(Enum3.const_1); } } if (int_5 % 256 == 0) { byte[] buffer2 = new byte[320]; Buffer.BlockCopy((Array)numArray2, srcOffset2, (Array)buffer2, 0, 320); Buffer.BlockCopy((Array)numArray2, srcOffset3, (Array)byte_0_2, 0, 20); byte[] hash2 = shA1.ComputeHash(buffer2); if (!GClass27.smethod_1(byte_0_2, hash2)) { return(Enum3.const_1); } } if (int_5 % 4096 != 0) { return(Enum3.const_0); } byte[] buffer3 = new byte[320]; Buffer.BlockCopy((Array)numArray2, srcOffset3, (Array)buffer3, 0, 320); Buffer.BlockCopy((Array)byte_2, srcOffset4, (Array)byte_1_3, 0, 20); return(!GClass27.smethod_1(shA1.ComputeHash(buffer3), byte_1_3) ? Enum3.const_1 : Enum3.const_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)); } }
private static Tuple <int[], int> smethod_11(int int_5, int int_6, int int_7) { int[] array = Enumerable.Repeat <int>(0, int_6).ToArray <int>(); int num1 = 0; for (int index = 0; index < int_6; ++index) { int num2 = Class85.smethod_12(int_5, int_7); num1 += num2; array[index] = num2; int_5 -= num2; } return(new Tuple <int[], int>(array, num1)); }
private static List <int> smethod_8(byte[] byte_1, byte[] byte_2, int int_5, int int_6, byte[] byte_3, byte byte_4) { List <int> intList = new List <int>(); for (int index = 0; index < int_6; ++index) { byte[] byte_1_1 = new byte[65536]; Buffer.BlockCopy((Array)byte_1, index * 65536, (Array)byte_1_1, 0, 65536); if (Class85.smethod_0(byte_1_1, byte_2, index + int_5, byte_3, byte_4) == Enum3.const_1) { intList.Add(index + int_5); } } return(intList); }
private static bool smethod_10(GClass30 gclass30_0, GClass101 gclass101_0, byte[] byte_1) { string str = Path.Combine(gclass30_0.OutputPath, gclass101_0.ContentId.ToString("x8") + ".app"); byte[] numArray = Class85.smethod_9(gclass101_0.Index); byte[] byte_0; if (gclass30_0.System != SystemType.SystemWiiU && gclass30_0.System != SystemType.SystemWii) { if (gclass30_0.System != SystemType.System3DS) { throw new NotImplementedException(); } byte_0 = Class85.smethod_3(str, byte_1, numArray); } else { byte[] array = File.ReadAllBytes(str); Array.Resize <byte>(ref array, GClass27.smethod_0(array.Length, 16)); byte_0 = SHA1.Create().ComputeHash(Class85.smethod_5(array, byte_1, numArray), 0, (int)gclass101_0.ContentSize.TotalBytes); } return(GClass27.smethod_1(byte_0, gclass101_0.Hash)); }
public static GStruct7 smethod_4(GClass30 gclass30_0, GClass101 gclass101_0, byte[] byte_1) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type Class85.Class87 class87 = new Class85.Class87(); // ISSUE: reference to a compiler-generated field class87.byte_1 = byte_1; // ISSUE: reference to a compiler-generated field class87.gclass101_0 = gclass101_0; List <int> list_1 = new List <int>(); // ISSUE: reference to a compiler-generated field string path1 = Path.Combine(gclass30_0.OutputPath, class87.gclass101_0.ContentId.ToString("x8") + ".app"); // ISSUE: reference to a compiler-generated field string path2 = Path.Combine(gclass30_0.OutputPath, class87.gclass101_0.ContentId.ToString("x8") + ".h3"); // ISSUE: reference to a compiler-generated field if (!class87.gclass101_0.Boolean_0) { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field if (!Class85.smethod_10(gclass30_0, class87.gclass101_0, class87.byte_1)) { // ISSUE: reference to a compiler-generated field return(new GStruct7(class87.gclass101_0, new List <int>(), false, true)); } // ISSUE: reference to a compiler-generated field return(new GStruct7(class87.gclass101_0, new List <int>(), false, false)); } if (!File.Exists(path2)) { // ISSUE: reference to a compiler-generated field return(new GStruct7(class87.gclass101_0, list_1, true, true)); } // ISSUE: reference to a compiler-generated field class87.byte_0 = File.ReadAllBytes(path2); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field if (!GClass27.smethod_1(SHA1.Create().ComputeHash(class87.byte_0), class87.gclass101_0.Hash)) { // ISSUE: reference to a compiler-generated field return(new GStruct7(class87.gclass101_0, list_1, true, true)); } using (FileStream fileStream = File.OpenRead(path1)) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type Class85.Class88 class88 = new Class85.Class88(); // ISSUE: reference to a compiler-generated field class88.class87_0 = class87; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field int int_5 = (int)(class88.class87_0.gclass101_0.Size.TotalBytes / 65536UL); int num1 = (int)Math.Ceiling((double)int_5 / 768.0); int num2 = 0; // ISSUE: reference to a compiler-generated field class88.bool_0 = Enumerable.Repeat <bool>(false, 3).ToArray <bool>(); // ISSUE: reference to a compiler-generated field class88.list_0 = Enumerable.Repeat <List <int> >(new List <int>(), 3).ToArray <List <int> >(); Thread[] threadArray = new Thread[3]; for (int index = 0; index < 3; ++index) { if (Class85.byte_0[index] == null) { Class85.byte_0[index] = new byte[16777216]; } } for (int index1 = 0; index1 < num1; ++index1) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type Class85.Class89 class89 = new Class85.Class89(); // ISSUE: reference to a compiler-generated field class89.class88_0 = class88; // ISSUE: reference to a compiler-generated field class89.tuple_0 = Class85.smethod_11(int_5, 3, 256); // ISSUE: reference to a compiler-generated field int_5 -= class89.tuple_0.Item2; for (int index2 = 0; index2 < 3; ++index2) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type Class85.Class90 class90 = new Class85.Class90(); // ISSUE: reference to a compiler-generated field class90.class89_0 = class89; // ISSUE: reference to a compiler-generated field class90.int_0 = index2; // ISSUE: reference to a compiler-generated field class90.int_1 = num2; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field class90.class89_0.class88_0.bool_0[index2] = false; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field class90.class89_0.class88_0.list_0[index2] = new List <int>(); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field fileStream.Read(Class85.byte_0[index2], 0, class90.class89_0.tuple_0.Item1[index2] * 65536); if (Class85.byte_0[index2].Length != 0) { // ISSUE: reference to a compiler-generated method threadArray[index2] = new Thread(new ThreadStart(class90.method_0)) { IsBackground = true }; threadArray[index2].Start(); } else { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field class90.class89_0.class88_0.bool_0[index2] = true; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field class90.class89_0.class88_0.list_0[index2] = new List <int>(); } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field num2 += class90.class89_0.tuple_0.Item1[index2]; } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field while (!Class85.smethod_7(class89.class88_0.bool_0)) { Thread.Sleep(10); } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field foreach (List <int> intList in class89.class88_0.list_0) { list_1.AddRange((IEnumerable <int>)intList); } } } // ISSUE: reference to a compiler-generated field return(new GStruct7(class87.gclass101_0, list_1, false, false)); }
private void method_10(string string_0, string string_1, ulong ulong_1, GClass78.GEnum4 genum4_0, WebProxy webProxy_0, byte[] byte_0 = null, byte[] byte_1 = null, byte byte_2 = 0, long long_0 = 0) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type GClass78.Class53 class53 = new GClass78.Class53(); // ISSUE: reference to a compiler-generated field class53.gclass78_0 = this; // ISSUE: reference to a compiler-generated field class53.long_0 = (long)ulong_1; HttpWebRequest http = WebRequest.CreateHttp(string_0); http.Proxy = (IWebProxy)webProxy_0; http.Method = "GET"; http.AddRange((long)ulong_1); http.Timeout = 10000; http.ReadWriteTimeout = 15000; int int_5 = (int)(ulong_1 / 65536UL); using (WebResponse response = http.GetResponse()) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type GClass78.Class54 class54 = new GClass78.Class54(); // ISSUE: reference to a compiler-generated field class54.class53_0 = class53; // ISSUE: reference to a compiler-generated field class54.long_0 = response.ContentLength + (long)ulong_1; using (Stream0 stream_0 = new Stream0(response.GetResponseStream())) { int bufferSize = GClass28.bool_0 ? 4096 : 65536; using (FileStream fileStream = new FileStream(string_1, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite, bufferSize)) { fileStream.Seek((long)ulong_1, SeekOrigin.Begin); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field while (this.bool_1 && class54.class53_0.long_0 < class54.long_0) { byte[] numArray = new byte[65536]; stream_0.Int64_0 = (long)this.MaximumSpeed; long long_3; if (genum4_0 == GClass78.GEnum4.const_1) { // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method numArray = stream_0.smethod_3(numArray.Length, class54.action_0 ?? (class54.action_0 = new Action <int>(class54.method_0))); if (numArray.Length < 65536) { throw new Exception("Block has invalid size"); } if (GClass28.bool_1 && Class85.smethod_0(numArray, byte_0, int_5, byte_1, byte_2) == Enum3.const_1) { throw new Exception("Invalid block"); } ++int_5; long_3 = 65536L; } else { long_3 = (long)stream_0.Read(numArray, 0, numArray.Length); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field class54.class53_0.long_0 += long_3; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field this.method_11(new Class58(long_3, class54.class53_0.long_0, class54.long_0)); } if (long_3 != 0L) { fileStream.Write(numArray, 0, (int)long_3); } else { break; } } fileStream.Flush(); } } } }
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); }