diff --git a/Wabbajack.App.Wpf/App.xaml.cs b/Wabbajack.App.Wpf/App.xaml.cs index 7572f6a2..8b467a48 100644 --- a/Wabbajack.App.Wpf/App.xaml.cs +++ b/Wabbajack.App.Wpf/App.xaml.cs @@ -17,11 +17,13 @@ using Wabbajack.DTOs.Interventions; using Wabbajack.Interventions; using Wabbajack.LoginManagers; using Wabbajack.Models; +using Wabbajack.Paths; using Wabbajack.Paths.IO; using Wabbajack.Services.OSIntegrated; using Wabbajack.UserIntervention; using Wabbajack.Util; using WebView2.Runtime.AutoInstaller; +using Ext = Wabbajack.Common.Ext; namespace Wabbajack { @@ -47,10 +49,18 @@ namespace Wabbajack var args = e.Args; - RxApp.MainThreadScheduler.Schedule(0, (_, _) => { - if (args.Length > 0) + if (args.Length == 1) + { + var arg = args[0].ToAbsolutePath(); + if (arg.FileExists() && arg.Extension == Ext.Wabbajack) + { + var mainWindow = _host.Services.GetRequiredService(); + mainWindow!.Show(); + return Disposable.Empty; + } + } else if (args.Length > 0) { var builder = _host.Services.GetRequiredService(); builder.Run(e.Args).ContinueWith(async x => @@ -65,6 +75,8 @@ namespace Wabbajack mainWindow!.Show(); return Disposable.Empty; } + + return Disposable.Empty; }); } diff --git a/Wabbajack.App.Wpf/VerbRegistration.cs b/Wabbajack.App.Wpf/VerbRegistration.cs index d6cd9e4c..b545ece6 100644 --- a/Wabbajack.App.Wpf/VerbRegistration.cs +++ b/Wabbajack.App.Wpf/VerbRegistration.cs @@ -1,13 +1,14 @@ - -using Microsoft.Extensions.DependencyInjection; -namespace Wabbajack; +using Microsoft.Extensions.DependencyInjection; using Wabbajack.Verbs; using Wabbajack.CLI.Builder; -public static class CommandLineBuilderExtensions{ +namespace Wabbajack; -public static void AddCLIVerbs(this IServiceCollection services) { -CommandLineBuilder.RegisterCommand(NexusLogin.Definition, c => ((NexusLogin)c).Run); -services.AddSingleton(); +public static class CommandLineBuilderExtensions +{ + public static void AddCLIVerbs(this IServiceCollection services) + { + CommandLineBuilder.RegisterCommand(NexusLogin.Definition, c => ((NexusLogin)c).Run); + services.AddSingleton(); + } } -} \ No newline at end of file diff --git a/Wabbajack.App.Wpf/View Models/MainWindowVM.cs b/Wabbajack.App.Wpf/View Models/MainWindowVM.cs index 3fd05449..872ef742 100644 --- a/Wabbajack.App.Wpf/View Models/MainWindowVM.cs +++ b/Wabbajack.App.Wpf/View Models/MainWindowVM.cs @@ -25,6 +25,7 @@ using Wabbajack.Messages; using Wabbajack.Models; using Wabbajack.Networking.WabbajackClientApi; using Wabbajack.Paths; +using Wabbajack.Paths.IO; using Wabbajack.UserIntervention; using Wabbajack.View_Models; @@ -219,16 +220,17 @@ namespace Wabbajack private static bool IsStartingFromModlist(out AbsolutePath modlistPath) { - /* TODO - if (CLIArguments.InstallPath == null) + var args = Environment.GetCommandLineArgs(); + if (args.Length == 2) { - modlistPath = default; - return false; + var arg = args[1].ToAbsolutePath(); + if (arg.FileExists() && arg.Extension == Ext.Wabbajack) + { + modlistPath = arg; + return true; + } } - modlistPath = (AbsolutePath)CLIArguments.InstallPath; - return true; - */ modlistPath = default; return false; }