mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Target Modlist exposure on Install Config View
This commit is contained in:
parent
5533b14cda
commit
d1fec7feec
@ -58,6 +58,7 @@ namespace Wabbajack.Lib
|
||||
|
||||
public static ModList LoadFromFile(string path)
|
||||
{
|
||||
if (!File.Exists(path)) return null;
|
||||
using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
{
|
||||
|
@ -31,8 +31,7 @@ namespace Wabbajack
|
||||
private readonly ObservableAsPropertyHelper<ModListVM> _modList;
|
||||
public ModListVM ModList => _modList.Value;
|
||||
|
||||
[Reactive]
|
||||
public string ModListPath { get; set; }
|
||||
public FilePickerVM ModListPath { get; }
|
||||
|
||||
[Reactive]
|
||||
public bool UIReady { get; set; }
|
||||
@ -120,9 +119,15 @@ namespace Wabbajack
|
||||
};
|
||||
DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath)
|
||||
.Select(x => Utils.IsDirectoryPathValid(x));
|
||||
ModListPath = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.On,
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
PromptTitle = "Select a modlist to install"
|
||||
};
|
||||
|
||||
// Load settings
|
||||
_CurrentSettings = this.WhenAny(x => x.ModListPath)
|
||||
_CurrentSettings = this.WhenAny(x => x.ModListPath.TargetPath)
|
||||
.Select(path => path == null ? null : MWVM.Settings.Installer.ModlistSettings.TryCreate(path))
|
||||
.ToProperty(this, nameof(CurrentSettings));
|
||||
this.WhenAny(x => x.CurrentSettings)
|
||||
@ -139,7 +144,7 @@ namespace Wabbajack
|
||||
.Subscribe(_ => SaveSettings(CurrentSettings))
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
_modList = this.WhenAny(x => x.ModListPath)
|
||||
_modList = this.WhenAny(x => x.ModListPath.TargetPath)
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
.Select(modListPath =>
|
||||
{
|
||||
@ -285,7 +290,7 @@ namespace Wabbajack
|
||||
private void OpenReadmeWindow()
|
||||
{
|
||||
if (string.IsNullOrEmpty(ModList.Readme)) return;
|
||||
using (var fs = new FileStream(ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var fs = new FileStream(ModListPath.TargetPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
@ -315,7 +320,7 @@ namespace Wabbajack
|
||||
|
||||
try
|
||||
{
|
||||
installer = new MO2Installer(ModListPath, ModList.SourceModList, Location.TargetPath)
|
||||
installer = new MO2Installer(ModListPath.TargetPath, ModList.SourceModList, Location.TargetPath)
|
||||
{
|
||||
DownloadFolder = DownloadLocation.TargetPath
|
||||
};
|
||||
@ -357,6 +362,7 @@ namespace Wabbajack
|
||||
|
||||
private void SaveSettings(ModlistInstallationSettings settings)
|
||||
{
|
||||
MWVM.Settings.Installer.LastInstalledListLocation = ModListPath.TargetPath;
|
||||
if (settings == null) return;
|
||||
settings.InstallationLocation = Location.TargetPath;
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
|
@ -1,16 +0,0 @@
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.ModListRegistry;
|
||||
|
||||
namespace Wabbajack.UI
|
||||
{
|
||||
public class ModListDefinition : ViewModel
|
||||
{
|
||||
private readonly ModlistMetadata _meta;
|
||||
|
||||
public ModListDefinition(ModlistMetadata meta)
|
||||
{
|
||||
_meta = meta;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -29,10 +29,13 @@ namespace Wabbajack
|
||||
InstallCommand = ReactiveCommand.Create(
|
||||
execute: () =>
|
||||
{
|
||||
OpenInstaller(
|
||||
UIUtils.OpenFileDialog(
|
||||
$"*{ExtensionManager.Extension}|*{ExtensionManager.Extension}",
|
||||
initialDirectory: mainVM.Settings.Installer.LastInstalledListLocation));
|
||||
var path = mainVM.Settings.Installer.LastInstalledListLocation;
|
||||
if (string.IsNullOrWhiteSpace(path)
|
||||
|| !File.Exists(path))
|
||||
{
|
||||
path = UIUtils.OpenFileDialog($"*{ExtensionManager.Extension}|*{ExtensionManager.Extension}");
|
||||
}
|
||||
OpenInstaller(path);
|
||||
});
|
||||
|
||||
CompileCommand = ReactiveCommand.Create(
|
||||
@ -57,7 +60,7 @@ namespace Wabbajack
|
||||
var installer = _mainVM.Installer.Value;
|
||||
_mainVM.Settings.Installer.LastInstalledListLocation = path;
|
||||
_mainVM.ActivePane = installer;
|
||||
installer.ModListPath = path;
|
||||
installer.ModListPath.TargetPath = path;
|
||||
}
|
||||
|
||||
private string Download()
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Wabbajack.UI"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
Style="{StaticResource {x:Type Window}}" Icon="../Resources/Icons/wabbajack.ico" WindowStyle="ToolWindow"
|
||||
mc:Ignorable="d"
|
||||
Title="Downloading Modlist" Height="200" Width="800">
|
||||
|
@ -286,6 +286,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
@ -294,14 +295,14 @@
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Installation Location"
|
||||
Text="Target Modlist"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding Location}"
|
||||
DataContext="{Binding ModListPath}"
|
||||
FontSize="14" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
@ -309,18 +310,33 @@
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Download Location"
|
||||
Text="Installation Location"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding Location}"
|
||||
FontSize="14" />
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Download Location"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding DownloadLocation}"
|
||||
FontSize="14" />
|
||||
<local:BeginButton
|
||||
Grid.Row="1"
|
||||
Grid.RowSpan="2"
|
||||
Grid.RowSpan="3"
|
||||
Grid.Column="4"
|
||||
Margin="0,0,25,0"
|
||||
HorizontalAlignment="Right"
|
||||
|
@ -51,7 +51,6 @@
|
||||
<RowDefinition Height="15" />
|
||||
<RowDefinition Height="150" />
|
||||
<RowDefinition Height="20" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
|
@ -215,7 +215,6 @@
|
||||
<DependentUpon>DownloadWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View Models\ModeSelectionVM.cs" />
|
||||
<Compile Include="View Models\ModListDefinition.cs" />
|
||||
<Compile Include="Views\Common\FilePicker.xaml.cs">
|
||||
<DependentUpon>FilePicker.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
Loading…
Reference in New Issue
Block a user