diff --git a/Wabbajack/View Models/Compilers/CompilerVM.cs b/Wabbajack/View Models/Compilers/CompilerVM.cs index 8200abde..cdf99da6 100644 --- a/Wabbajack/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/CompilerVM.cs @@ -41,6 +41,8 @@ namespace Wabbajack public IReactiveCommand BackCommand { get; } + public FilePickerVM OutputLocation { get; } + private readonly ObservableAsPropertyHelper<IUserIntervention> _ActiveGlobalUserIntervention; public IUserIntervention ActiveGlobalUserIntervention => _ActiveGlobalUserIntervention.Value; @@ -48,13 +50,22 @@ namespace Wabbajack { MWVM = mainWindowVM; + OutputLocation = new FilePickerVM() + { + ExistCheckOption = FilePickerVM.ExistCheckOptions.IfNotEmpty, + PathType = FilePickerVM.PathTypeOptions.Folder, + PromptTitle = "Select the folder to place the resulting modlist.wabbajack file", + }; + // Load settings CompilerSettings settings = MWVM.Settings.Compiler; SelectedCompilerType = settings.LastCompiledModManager; + OutputLocation.TargetPath = settings.OutputLocation; MWVM.Settings.SaveSignal .Subscribe(_ => { settings.LastCompiledModManager = SelectedCompilerType; + settings.OutputLocation = OutputLocation.TargetPath; }) .DisposeWith(CompositeDisposable); diff --git a/Wabbajack/View Models/Compilers/MO2CompilerVM.cs b/Wabbajack/View Models/Compilers/MO2CompilerVM.cs index 80f006ea..28bb50f7 100644 --- a/Wabbajack/View Models/Compilers/MO2CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/MO2CompilerVM.cs @@ -27,8 +27,6 @@ namespace Wabbajack public FilePickerVM ModlistLocation { get; } - public FilePickerVM OutputLocation { get; } - public IReactiveCommand BeginCommand { get; } [Reactive] @@ -55,12 +53,6 @@ namespace Wabbajack PathType = FilePickerVM.PathTypeOptions.Folder, PromptTitle = "Select download location", }; - OutputLocation = new FilePickerVM() - { - ExistCheckOption = FilePickerVM.ExistCheckOptions.IfNotEmpty, - PathType = FilePickerVM.PathTypeOptions.Folder, - PromptTitle = "Select the folder to place the resulting modlist.wabbajack file", - }; _mo2Folder = this.WhenAny(x => x.ModlistLocation.TargetPath) .Select(loc => @@ -104,7 +96,7 @@ namespace Wabbajack canExecute: Observable.CombineLatest( this.WhenAny(x => x.ModlistLocation.InError), this.WhenAny(x => x.DownloadLocation.InError), - this.WhenAny(x => x.OutputLocation.InError), + parent.WhenAny(x => x.OutputLocation.InError), resultSelector: (ml, down, output) => !ml && !down && !output) .ObserveOnGuiThread(), execute: async () => @@ -112,13 +104,13 @@ namespace Wabbajack try { string outputFile; - if (string.IsNullOrWhiteSpace(OutputLocation.TargetPath)) + if (string.IsNullOrWhiteSpace(parent.OutputLocation.TargetPath)) { outputFile = MOProfile + ExtensionManager.Extension; } else { - outputFile = Path.Combine(OutputLocation.TargetPath, MOProfile + ExtensionManager.Extension); + outputFile = Path.Combine(parent.OutputLocation.TargetPath, MOProfile + ExtensionManager.Extension); } ActiveCompilation = new MO2Compiler( mo2Folder: Mo2Folder, @@ -165,7 +157,6 @@ namespace Wabbajack { DownloadLocation.TargetPath = _settings.DownloadLocation; } - OutputLocation.TargetPath = parent.MWVM.Settings.Compiler.OutputLocation; parent.MWVM.Settings.SaveSignal .Subscribe(_ => Unload()) .DisposeWith(CompositeDisposable); @@ -218,7 +209,6 @@ namespace Wabbajack { _settings.DownloadLocation = DownloadLocation.TargetPath; _settings.LastCompiledProfileLocation = ModlistLocation.TargetPath; - Parent.MWVM.Settings.Compiler.OutputLocation = OutputLocation.TargetPath; ModlistSettings?.Save(); } } diff --git a/Wabbajack/View Models/Compilers/VortexCompilerVM.cs b/Wabbajack/View Models/Compilers/VortexCompilerVM.cs index 44d1bcf2..4fba5251 100644 --- a/Wabbajack/View Models/Compilers/VortexCompilerVM.cs +++ b/Wabbajack/View Models/Compilers/VortexCompilerVM.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using System.Reactive.Disposables; using System.Reactive.Linq; @@ -14,6 +15,8 @@ namespace Wabbajack { public class VortexCompilerVM : ViewModel, ISubCompilerVM { + public CompilerVM Parent { get; } + private readonly VortexCompilationSettings _settings; public IReactiveCommand BeginCommand { get; } @@ -53,6 +56,7 @@ namespace Wabbajack public VortexCompilerVM(CompilerVM parent) { + Parent = parent; GameLocation = new FilePickerVM() { ExistCheckOption = FilePickerVM.ExistCheckOptions.On, @@ -84,13 +88,18 @@ namespace Wabbajack { try { + string outputFile = $"{ModlistSettings.ModListName}{ExtensionManager.Extension}"; + if (!string.IsNullOrWhiteSpace(parent.OutputLocation.TargetPath)) + { + outputFile = Path.Combine(parent.OutputLocation.TargetPath, outputFile); + } ActiveCompilation = new VortexCompiler( game: SelectedGame.Game, gamePath: GameLocation.TargetPath, vortexFolder: VortexCompiler.TypicalVortexFolder(), downloadsFolder: DownloadsLocation.TargetPath, stagingFolder: StagingLocation.TargetPath, - outputFile: $"{ModlistSettings.ModListName}{ExtensionManager.Extension}") + outputFile: outputFile) { ModListName = ModlistSettings.ModListName, ModListAuthor = ModlistSettings.AuthorText, diff --git a/Wabbajack/Views/Compilers/MO2CompilerConfigView.xaml b/Wabbajack/Views/Compilers/MO2CompilerConfigView.xaml index fe698b30..2a61a010 100644 --- a/Wabbajack/Views/Compilers/MO2CompilerConfigView.xaml +++ b/Wabbajack/Views/Compilers/MO2CompilerConfigView.xaml @@ -68,7 +68,7 @@ Grid.Column="2" Height="30" VerticalAlignment="Center" - DataContext="{Binding OutputLocation}" + DataContext="{Binding Parent.OutputLocation}" FontSize="14" ToolTip="The folder to place the resulting modlist.wabbajack file" /> </Grid> diff --git a/Wabbajack/Views/Compilers/VortexCompilerConfigView.xaml b/Wabbajack/Views/Compilers/VortexCompilerConfigView.xaml index 24649bd6..5961c123 100644 --- a/Wabbajack/Views/Compilers/VortexCompilerConfigView.xaml +++ b/Wabbajack/Views/Compilers/VortexCompilerConfigView.xaml @@ -20,13 +20,12 @@ <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> - <RowDefinition Height="28" /> <RowDefinition Height="40" /> <RowDefinition Height="40" /> - <RowDefinition Height="28" /> + <RowDefinition Height="40" /> </Grid.RowDefinitions> <TextBlock - Grid.Row="1" + Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" @@ -35,7 +34,7 @@ TextAlignment="Center" ToolTip="The game you wish to target" /> <ComboBox - Grid.Row="1" + Grid.Row="0" Grid.Column="2" Height="30" VerticalAlignment="Center" @@ -51,7 +50,7 @@ </ComboBox.ItemTemplate> </ComboBox> <TextBlock - Grid.Row="2" + Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" @@ -60,7 +59,7 @@ TextAlignment="Center" ToolTip="The install folder for the game" /> <local:FilePicker - Grid.Row="2" + Grid.Row="1" Grid.Column="2" Height="30" VerticalAlignment="Center" @@ -68,7 +67,7 @@ FontSize="14" ToolTip="The install folder for the game" /> <Grid - Grid.Row="3" + Grid.Row="2" Grid.Column="2" Height="28" HorizontalAlignment="Left" @@ -97,7 +96,7 @@ </Grid> <TextBlock - Grid.Row="1" + Grid.Row="0" Grid.Column="4" HorizontalAlignment="Right" VerticalAlignment="Center" @@ -106,7 +105,7 @@ TextAlignment="Center" ToolTip="The folder to downloads your mods" /> <local:FilePicker - Grid.Row="1" + Grid.Row="0" Grid.Column="6" Height="30" VerticalAlignment="Center" @@ -114,7 +113,7 @@ FontSize="14" ToolTip="The folder to downloads your mods" /> <TextBlock - Grid.Row="2" + Grid.Row="1" Grid.Column="4" HorizontalAlignment="Right" VerticalAlignment="Center" @@ -122,11 +121,28 @@ Text="Staging Location" TextAlignment="Center" /> <local:FilePicker - Grid.Row="2" + Grid.Row="1" Grid.Column="6" Height="30" VerticalAlignment="Center" DataContext="{Binding StagingLocation}" FontSize="14" /> + <TextBlock + Grid.Row="2" + Grid.Column="4" + HorizontalAlignment="Right" + VerticalAlignment="Center" + FontSize="14" + Text="Output Location" + TextAlignment="Center" + ToolTip="The folder to place the resulting modlist.wabbajack file" /> + <local:FilePicker + Grid.Row="2" + Grid.Column="6" + Height="30" + VerticalAlignment="Center" + DataContext="{Binding Parent.OutputLocation}" + FontSize="14" + ToolTip="The folder to place the resulting modlist.wabbajack file" /> </Grid> </UserControl>