Rebase fixes

This commit is contained in:
erri120 2019-11-11 19:08:08 +01:00 committed by Timothy Baldridge
parent fa18a45ebc
commit 53b2dd5db1
2 changed files with 27 additions and 66 deletions

View File

@ -1,4 +1,4 @@
using Syroot.Windows.IO; using Syroot.Windows.IO;
using System; using System;
using ReactiveUI; using ReactiveUI;
using System.Diagnostics; using System.Diagnostics;
@ -50,21 +50,14 @@ namespace Wabbajack
[Reactive] [Reactive]
public bool InstallingMode { get; set; } public bool InstallingMode { get; set; }
public FilePickerVM Location { get; }
[Reactive] [Reactive]
public bool IsMO2ModList { get; set; } public bool IsMO2ModList { get; set; }
[Reactive] public FilePickerVM Location { get; }
public string DownloadLocation { get; set; }
public FilePickerVM DownloadLocation { get; } public FilePickerVM DownloadLocation { get; }
[Reactive] public FilePickerVM StagingLocation { get; }
public string StagingLocation { get; set; }
private readonly ObservableAsPropertyHelper<IErrorResponse> _stagingLocationError;
public IErrorResponse StagingLocationError => _stagingLocationError.Value;
private readonly ObservableAsPropertyHelper<float> _ProgressPercent; private readonly ObservableAsPropertyHelper<float> _ProgressPercent;
public float ProgressPercent => _ProgressPercent.Value; public float ProgressPercent => _ProgressPercent.Value;
@ -126,10 +119,17 @@ namespace Wabbajack
this.DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath) this.DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath)
.Select(x => Utils.IsDirectoryPathValid(x)); .Select(x => Utils.IsDirectoryPathValid(x));
StagingLocation = new FilePickerVM
{
DoExistsCheck = true,
PathType = FilePickerVM.PathTypeOptions.Folder,
PromptTitle = "Select your Vortex Staging Folder",
AdditionalError = this.WhenAny(x => x.StagingLocation.TargetPath)
.Select(Utils.IsDirectoryPathValid)
};
// Load settings // Load settings
InstallationSettings settings = this.MWVM.Settings.InstallationSettings.TryCreate(source); InstallationSettings settings = this.MWVM.Settings.InstallationSettings.TryCreate(source);
this.Location.TargetPath = settings.InstallationLocation;
this.DownloadLocation.TargetPath = settings.DownloadLocation;
this.MWVM.Settings.SaveSignal this.MWVM.Settings.SaveSignal
.Subscribe(_ => .Subscribe(_ =>
{ {
@ -179,15 +179,15 @@ namespace Wabbajack
if (!Directory.Exists(vortexFolder)) return new ModListVM(modList, modListPath); if (!Directory.Exists(vortexFolder)) return new ModListVM(modList, modListPath);
if (Directory.Exists(stagingFolder) && if (Directory.Exists(stagingFolder) &&
File.Exists(Path.Combine(stagingFolder, "__vortex_staging_folder"))) File.Exists(Path.Combine(stagingFolder, "__vortex_staging_folder")))
StagingLocation = stagingFolder; StagingLocation.TargetPath = stagingFolder;
if (Directory.Exists(Path.Combine(vortexFolder, "downloads")) && if (Directory.Exists(Path.Combine(vortexFolder, "downloads")) &&
File.Exists(Path.Combine(vortexFolder, "downloads", "__vortex_downloads_folder"))) File.Exists(Path.Combine(vortexFolder, "downloads", "__vortex_downloads_folder")))
DownloadLocation = downloadFolder; DownloadLocation.TargetPath = downloadFolder;
} }
else else
{ {
Location = settings.InstallationLocation; Location.TargetPath = settings.InstallationLocation;
DownloadLocation = settings.DownloadLocation; DownloadLocation.TargetPath = settings.DownloadLocation;
IsMO2ModList = true; IsMO2ModList = true;
} }
return new ModListVM(modList, modListPath); return new ModListVM(modList, modListPath);
@ -248,10 +248,6 @@ namespace Wabbajack
.Select(x => x?.Name) .Select(x => x?.Name)
.ToProperty(this, nameof(this.ModListName)); .ToProperty(this, nameof(this.ModListName));
_stagingLocationError = this.WhenAny(x => x.StagingLocation)
.Select(Utils.IsDirectoryPathValid)
.ToProperty(this, nameof(StagingLocationError));
// Define commands // Define commands
this.ShowReportCommand = ReactiveCommand.Create(ShowReport); this.ShowReportCommand = ReactiveCommand.Create(ShowReport);
this.OpenReadmeCommand = ReactiveCommand.Create( this.OpenReadmeCommand = ReactiveCommand.Create(
@ -263,9 +259,9 @@ namespace Wabbajack
execute: this.ExecuteBegin, execute: this.ExecuteBegin,
canExecute: Observable.CombineLatest( canExecute: Observable.CombineLatest(
this.WhenAny(x => x.Installing), this.WhenAny(x => x.Installing),
this.WhenAny(x => x.LocationError.InError), this.WhenAny(x => x.Location.InError),
this.WhenAny(x => x.DownloadLocationError.InError), this.WhenAny(x => x.DownloadLocation.InError),
this.WhenAny(x => x.StagingLocationError.InError), this.WhenAny(x => x.StagingLocation.InError),
resultSelector: (installing, loc, download, staging) => resultSelector: (installing, loc, download, staging) =>
{ {
if (installing) return false; if (installing) return false;
@ -344,8 +340,8 @@ namespace Wabbajack
{ {
var installer = new VortexInstaller(ModListPath, ModList.SourceModList) var installer = new VortexInstaller(ModListPath, ModList.SourceModList)
{ {
StagingFolder = StagingLocation, StagingFolder = StagingLocation.TargetPath,
DownloadFolder = DownloadLocation DownloadFolder = DownloadLocation.TargetPath
}; };
var th = new Thread(() => var th = new Thread(() =>
{ {

View File

@ -281,33 +281,6 @@
<RowDefinition Height="40" /> <RowDefinition Height="40" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border
x:Name="BeginButtonPurpleGlow"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="0"
Grid.ColumnSpan="5"
Width="76"
Height="76"
Margin="0,0,14,0"
HorizontalAlignment="Right"
Background="{StaticResource PrimaryVariantBrush}"
CornerRadius="43"
Visibility="{Binding IsEnabled, ElementName=BeginButton, Converter={StaticResource bool2VisibilityConverter}}">
<Border.Effect>
<BlurEffect Radius="10" />
</Border.Effect>
<Border.Style>
<Style TargetType="Border">
<Setter Property="Opacity" Value="0.5" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=BeginButton}" Value="True">
<Setter Property="Opacity" Value="0.8" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<Grid Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Visibility="{Binding IsMO2ModList, Converter={StaticResource bool2VisibilityConverter}}"> <Grid Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Visibility="{Binding IsMO2ModList, Converter={StaticResource bool2VisibilityConverter}}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="40" /> <RowDefinition Height="40" />
@ -342,7 +315,7 @@
Text="Download Location" Text="Download Location"
TextAlignment="Center" /> TextAlignment="Center" />
<local:FilePicker <local:FilePicker
Grid.Row="2" Grid.Row="1"
Grid.Column="2" Grid.Column="2"
Height="30" Height="30"
VerticalAlignment="Center" VerticalAlignment="Center"
@ -368,16 +341,12 @@
Text="Staging Folder" Text="Staging Folder"
TextAlignment="Center" /> TextAlignment="Center" />
<local:FilePicker <local:FilePicker
Grid.Row="0" Grid.Row="1"
Grid.Column="2" Grid.Column="2"
Height="30" Height="30"
VerticalAlignment="Center" VerticalAlignment="Center"
AdditionalError="{Binding StagingLocationError}" DataContext="{Binding StagingLocation}"
DoExistsCheck="False" FontSize="14" />
FontSize="14"
PathType="Folder"
PromptTitle="Select the Vortex staging directory"
TargetPath="{Binding StagingLocation}" />
<TextBlock <TextBlock
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
@ -391,12 +360,8 @@
Grid.Column="2" Grid.Column="2"
Height="30" Height="30"
VerticalAlignment="Center" VerticalAlignment="Center"
AdditionalError="{Binding DownloadLocationError}" DataContext="{Binding DownloadLocation}"
DoExistsCheck="False" FontSize="14" />
FontSize="14"
PathType="Folder"
PromptTitle="Select the Vortex downloads directory"
TargetPath="{Binding DownloadLocation}" />
</Grid> </Grid>
<Button <Button
x:Name="BeginButton" x:Name="BeginButton"