Moved OutputFolder to CompilerVM. Added to vortex compiler

This commit is contained in:
Justin Swanson 2019-12-13 21:44:27 -06:00
parent d2999748fb
commit b74a183aef
5 changed files with 52 additions and 26 deletions

View File

@ -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);

View File

@ -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();
}
}

View File

@ -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,

View File

@ -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>

View File

@ -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>