From 4129785e1758a575f94d119e619a58957d478912 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 9 Feb 2020 03:29:05 +0100 Subject: [PATCH] GUI: Create type models --- Il2CppInspector.GUI/App.xaml.cs | 14 ++++++++------ Il2CppInspector.GUI/MainWindow.xaml | 10 +++++----- Il2CppInspector.GUI/MainWindow.xaml.cs | 6 ++++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Il2CppInspector.GUI/App.xaml.cs b/Il2CppInspector.GUI/App.xaml.cs index b5727a1..76d4d8d 100644 --- a/Il2CppInspector.GUI/App.xaml.cs +++ b/Il2CppInspector.GUI/App.xaml.cs @@ -1,12 +1,11 @@ using System; using System.Collections.Generic; -using System.Configuration; -using System.Data; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; using Il2CppInspector; +using Il2CppInspector.Reflection; using Inspector = Il2CppInspector.Il2CppInspector; namespace Il2CppInspectorGUI @@ -18,7 +17,7 @@ namespace Il2CppInspectorGUI { private Metadata metadata; - public List Il2CppImages { get; } = new List(); + public List Il2CppModels { get; } = new List(); public Exception LastException { get; private set; } @@ -48,19 +47,22 @@ namespace Il2CppInspectorGUI } // Multi-image binaries may contain more than one Il2Cpp image - Il2CppImages.Clear(); + Il2CppModels.Clear(); foreach (var image in stream.Images) { // Architecture-agnostic load attempt try { // If we can't load the IL2CPP data here, it's probably packed or obfuscated; ignore it if (Il2CppBinary.Load(image, metadata.Version) is Il2CppBinary binary) { - Il2CppImages.Add(new Inspector(binary, metadata)); + var inspector = new Inspector(binary, metadata); + + // Build type model + Il2CppModels.Add(new Il2CppModel(inspector)); } } // Unsupported architecture; ignore it catch (NotImplementedException) { } } - if (!Il2CppImages.Any()) { + if (!Il2CppModels.Any()) { throw new InvalidOperationException("Could not auto-detect any IL2CPP binary images in the file. This may mean the binary file is packed, encrypted or obfuscated, that the file is not an IL2CPP image or that Il2CppInspector was not able to automatically find the required data. Please check the binary file in a disassembler to ensure that it is an unencrypted IL2CPP binary before submitting a bug report!"); } return true; diff --git a/Il2CppInspector.GUI/MainWindow.xaml b/Il2CppInspector.GUI/MainWindow.xaml index 5663f4c..2e2f10f 100644 --- a/Il2CppInspector.GUI/MainWindow.xaml +++ b/Il2CppInspector.GUI/MainWindow.xaml @@ -74,9 +74,9 @@ - - - + + + @@ -100,7 +100,7 @@ - + @@ -154,7 +154,7 @@ - Getting things ready... + Getting things ready... diff --git a/Il2CppInspector.GUI/MainWindow.xaml.cs b/Il2CppInspector.GUI/MainWindow.xaml.cs index f0a1bd2..7d52e2b 100644 --- a/Il2CppInspector.GUI/MainWindow.xaml.cs +++ b/Il2CppInspector.GUI/MainWindow.xaml.cs @@ -40,6 +40,7 @@ namespace Il2CppInspectorGUI }; if (openFileDialog.ShowDialog() == true) { + txtBusyStatus.Text = "Processing metadata..."; areaBusyIndicator.Visibility = Visibility.Visible; btnSelectMetadataFile.Visibility = Visibility.Hidden; @@ -72,6 +73,7 @@ namespace Il2CppInspectorGUI btnBack.IsEnabled = false; if (openFileDialog.ShowDialog() == true) { + txtBusyStatus.Text = "Processing binary..."; areaBusyIndicator.Visibility = Visibility.Visible; btnSelectBinaryFile.Visibility = Visibility.Hidden; @@ -81,12 +83,12 @@ namespace Il2CppInspectorGUI areaBusyIndicator.Visibility = Visibility.Hidden; rectModalLightBoxBackground.Visibility = Visibility.Hidden; - lstImages.ItemsSource = app.Il2CppImages; + lstImages.ItemsSource = app.Il2CppModels; } else { areaBusyIndicator.Visibility = Visibility.Hidden; btnSelectBinaryFile.Visibility = Visibility.Visible; - MessageBox.Show(this, app.LastException.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); + MessageBox.Show(this, "Something went wrong! " + app.LastException.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }