GUI: Auto-migrate settings from previous version if needed

This commit is contained in:
Katy Coe
2020-12-26 06:06:21 +01:00
parent f64d224b5a
commit d7fcab640c
3 changed files with 25 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Markup;
using Il2CppInspector;
using Il2CppInspector.GUI;
using Il2CppInspector.Model;
using Il2CppInspector.PluginAPI.V100;
using Il2CppInspector.Reflection;
@@ -26,8 +27,8 @@ namespace Il2CppInspectorGUI
/// </summary>
public partial class App : Application, INotifyPropertyChanged
{
// Catch unhandled exceptions for debugging startup failures and plugins
public App() : base() {
// Catch unhandled exceptions for debugging startup failures and plugins
var np = Environment.NewLine + Environment.NewLine;
Dispatcher.UnhandledException += (s, e) => {
@@ -49,6 +50,13 @@ namespace Il2CppInspectorGUI
}
};
// Migrate settings from previous version if necessary
if (User.Default.UpgradeRequired) {
User.Default.Upgrade();
User.Default.UpgradeRequired = false;
User.Default.Save();
}
// Load plugins
PluginManager.EnsureInit();
}