GUI: Load metadata file

This commit is contained in:
Katy Coe
2020-02-07 03:52:08 +01:00
parent 8683da1a22
commit f4a1a21e9e
4 changed files with 63 additions and 15 deletions

View File

@@ -2,16 +2,34 @@
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;
namespace Il2CppInspector.GUI
namespace Il2CppInspectorGUI
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public Metadata CurrentMetadata { get; private set; }
public Exception LastException { get; private set; }
// Attempt to load an IL2CPP metadata file
public Task<bool> LoadMetadataAsync(string metadataFile) =>
Task.Run(() => {
try {
CurrentMetadata = new Metadata(new MemoryStream(File.ReadAllBytes(metadataFile)));
return true;
}
catch (Exception ex) {
LastException = ex;
return false;
}
});
}
}