CLI/GUI: Add support for saving processed metadata and binary

This commit is contained in:
Katy Coe
2020-12-09 19:44:19 +01:00
parent f6eed36284
commit 34819a114d
4 changed files with 145 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ using Il2CppInspector.Reflection;
using Ookii.Dialogs.Wpf;
using Path = System.IO.Path;
using Il2CppInspector.Cpp.UnityHeaders;
using System.IO.Packaging;
namespace Il2CppInspectorGUI
{
@@ -42,6 +43,9 @@ namespace Il2CppInspectorGUI
public MainWindow() {
InitializeComponent();
// Allow XAML to access properties in the App class
DataContext = ((App) Application.Current);
// Subscribe to status update events
((App) Application.Current).OnStatusUpdate += OnStatusUpdate;
@@ -314,6 +318,43 @@ namespace Il2CppInspectorGUI
return false;
}
/// <summary>
/// Save extracted or decrypted files
/// </summary>
private async void BtnSaveMetadata_OnClick(object sender, RoutedEventArgs e) {
var package = ((AppModel) lstImages.SelectedItem).TypeModel.Package;
var saveFileDialog = new SaveFileDialog {
Filter = "IL2CPP metadata files (*.dat)|*.dat|All files (*.*)|*.*",
FileName = "global-metadata.dat",
CheckFileExists = false,
OverwritePrompt = true
};
if (saveFileDialog.ShowDialog() == false)
return;
var outPath = saveFileDialog.FileName;
await Task.Run(() => package.SaveMetadataToFile(outPath));
}
private async void BtnSaveBinary_OnClick(object sender, RoutedEventArgs e) {
var package = ((AppModel) lstImages.SelectedItem).TypeModel.Package;
var binaryName = package.BinaryImage.DefaultFilename;
var saveFileDialog = new SaveFileDialog {
Filter = "All files (*.*)|*.*",
FileName = binaryName,
CheckFileExists = false,
OverwritePrompt = true
};
if (saveFileDialog.ShowDialog() == false)
return;
var outPath = saveFileDialog.FileName;
await Task.Run(() => package.SaveBinaryToFile(outPath));
}
/// <summary>
/// Perform export
/// </summary>