2019-10-03 04:35:29 +00:00
|
|
|
|
using System;
|
2019-10-30 19:36:02 +00:00
|
|
|
|
using System.Reflection;
|
2019-10-03 04:35:29 +00:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using Wabbajack.Common;
|
2019-10-16 03:10:34 +00:00
|
|
|
|
using Wabbajack.Lib.Updater;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Interaction logic for App.xaml
|
2019-07-22 22:17:46 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class App : Application
|
|
|
|
|
{
|
2019-10-03 04:35:29 +00:00
|
|
|
|
public App()
|
|
|
|
|
{
|
2019-10-23 04:18:16 +00:00
|
|
|
|
// Wire any unhandled crashing exceptions to log before exiting
|
|
|
|
|
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
2019-10-03 04:35:29 +00:00
|
|
|
|
{
|
2019-10-23 04:18:16 +00:00
|
|
|
|
// Don't do any special logging side effects
|
|
|
|
|
Utils.Log("Uncaught error:");
|
|
|
|
|
Utils.Log(((Exception)e.ExceptionObject).ExceptionToString());
|
|
|
|
|
};
|
2019-10-03 04:35:29 +00:00
|
|
|
|
|
2019-10-30 19:36:02 +00:00
|
|
|
|
var appPath = Assembly.GetExecutingAssembly().Location;
|
2019-10-31 11:14:14 +00:00
|
|
|
|
if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
|
2019-10-30 19:36:02 +00:00
|
|
|
|
{
|
|
|
|
|
ExtensionManager.Associate(appPath);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-30 17:09:55 +00:00
|
|
|
|
string[] args = Environment.GetCommandLineArgs();
|
2019-11-02 20:55:14 +00:00
|
|
|
|
StartupUri = new Uri("Views/ModeSelectionWindow.xaml", UriKind.Relative);
|
2019-10-30 17:09:55 +00:00
|
|
|
|
if (args.Length != 3) return;
|
|
|
|
|
if (!args[1].Contains("-i")) return;
|
|
|
|
|
// modlists gets loaded using a shell command
|
2019-11-02 20:55:14 +00:00
|
|
|
|
StartupUri = new Uri("Views/MainWindow.xaml", UriKind.Relative);
|
2019-10-06 21:58:36 +00:00
|
|
|
|
}
|
2019-07-22 22:17:46 +00:00
|
|
|
|
}
|
2019-09-14 04:35:42 +00:00
|
|
|
|
}
|