mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge branch 'blocking_fixes' into pre-release
This commit is contained in:
commit
7b5a6e72e3
@ -1,9 +1,19 @@
|
||||
using Wabbajack.Downloaders;
|
||||
using Wabbajack.DTOs.JsonConverters;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.RateLimiter;
|
||||
using Wabbajack.Util;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
[JsonName("Mo2ModListInstallerSettings")]
|
||||
public class Mo2ModlistInstallationSettings
|
||||
{
|
||||
public AbsolutePath InstallationLocation { get; set; }
|
||||
public AbsolutePath DownloadLocation { get; set; }
|
||||
public bool AutomaticallyOverrideExistingInstall { get; set; }
|
||||
}
|
||||
|
||||
public class PerformanceSettings : ViewModel
|
||||
{
|
||||
private readonly Configuration.MainSettings _settings;
|
||||
|
@ -135,6 +135,8 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
public LogStream LoggerProvider { get; }
|
||||
|
||||
private AbsolutePath LastInstallPath { get; set; }
|
||||
|
||||
[Reactive] public bool OverwriteFiles { get; set; }
|
||||
|
||||
|
||||
// Command properties
|
||||
@ -225,7 +227,10 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
{
|
||||
UIUtils.OpenFolder(Installer.Location.TargetPath);
|
||||
});
|
||||
|
||||
|
||||
this.WhenAnyValue(x => x.OverwriteFiles)
|
||||
.Subscribe(x => ConfirmOverwrite());
|
||||
|
||||
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
||||
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
|
||||
.DisposeWith(CompositeDisposable);
|
||||
@ -314,24 +319,11 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
yield return ErrorResponse.Fail("Installing in this folder may overwrite Wabbajack");
|
||||
}
|
||||
|
||||
if (installPath.ToString().Length != 0 && installPath != LastInstallPath &&
|
||||
if (installPath.ToString().Length != 0 && installPath != LastInstallPath && !OverwriteFiles &&
|
||||
Directory.EnumerateFileSystemEntries(installPath.ToString()).Any())
|
||||
{
|
||||
string message =
|
||||
"There are files already in the chosen install path, if you are updating an existing modlist, this is fine. " + Environment.NewLine +
|
||||
" Otherwise, please ensure you intend for the folder contents to be deleted during the modlist install." + Environment.NewLine +
|
||||
" Continue? ";
|
||||
string title = "Files found in install folder";
|
||||
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
|
||||
DialogResult result = MessageBox.Show(message, title, buttons);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
// everythings fine
|
||||
}
|
||||
else
|
||||
{
|
||||
Installer.Location.TargetPath = "".ToAbsolutePath();
|
||||
}
|
||||
yield return ErrorResponse.Fail("There are files in the install folder, please tick 'Overwrite Installation' to confirm you want to install to this folder " + Environment.NewLine +
|
||||
"if you are updating an existing modlist, then this is expected and can be overwritten.");
|
||||
}
|
||||
|
||||
if (KnownFolders.IsInSpecialFolder(installPath) || KnownFolders.IsInSpecialFolder(downloadPath))
|
||||
@ -455,6 +447,13 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfirmOverwrite()
|
||||
{
|
||||
AbsolutePath prev = Installer.Location.TargetPath;
|
||||
Installer.Location.TargetPath = "".ToAbsolutePath();
|
||||
Installer.Location.TargetPath = prev;
|
||||
}
|
||||
|
||||
private async Task BeginInstall()
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
|
@ -20,6 +20,9 @@ namespace Wabbajack
|
||||
[Reactive]
|
||||
public IInstaller ActiveInstallation { get; private set; }
|
||||
|
||||
[Reactive]
|
||||
public Mo2ModlistInstallationSettings CurrentSettings { get; set; }
|
||||
|
||||
public FilePickerVM Location { get; }
|
||||
|
||||
public FilePickerVM DownloadLocation { get; }
|
||||
@ -60,6 +63,16 @@ namespace Wabbajack
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
SaveSettings(this.CurrentSettings);
|
||||
}
|
||||
|
||||
private void SaveSettings(Mo2ModlistInstallationSettings settings)
|
||||
{
|
||||
//Parent.MWVM.Settings.Installer.LastInstalledListLocation = Parent.ModListLocation.TargetPath;
|
||||
if (settings == null) return;
|
||||
settings.InstallationLocation = Location.TargetPath;
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
settings.AutomaticallyOverrideExistingInstall = AutomaticallyOverwrite;
|
||||
}
|
||||
|
||||
public void AfterInstallNavigation()
|
||||
|
@ -81,10 +81,11 @@
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<local:BeginButton Grid.Row="1"
|
||||
x:Name="BeginButton"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
x:Name="ErrorSummaryIconGlow"
|
||||
@ -99,8 +100,27 @@
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
x:Name="ErrorSummaryIcon"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{StaticResource WarningBrush}"
|
||||
Kind="ExclamationTriangleSolid" />
|
||||
<CheckBox Grid.Row="2" Grid.Column="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"
|
||||
x:Name="OverwriteCheckBox"
|
||||
Content="Overwrite Installation"
|
||||
IsChecked="False"
|
||||
ToolTip="Confirm to overwrite files in install folder.">
|
||||
<CheckBox.Style>
|
||||
<Style TargetType="CheckBox">
|
||||
<Setter Property="Opacity" Value="0.6" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</CheckBox.Style>
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</rxui:ReactiveUserControl>
|
||||
|
@ -39,9 +39,11 @@ namespace Wabbajack
|
||||
this.WhenAny(x => x.ViewModel.BeginCommand)
|
||||
.BindToStrict(this, x => x.BeginButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
this.BindStrict(ViewModel, vm => vm.OverwriteFiles, x => x.OverwriteCheckBox.IsChecked)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
// Error handling
|
||||
|
||||
|
||||
this.WhenAnyValue(x => x.ViewModel.ErrorState)
|
||||
.Select(v => !v.Failed)
|
||||
.BindToStrict(this, view => view.BeginButton.IsEnabled)
|
||||
|
Loading…
Reference in New Issue
Block a user