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:
@ -1,9 +1,19 @@
|
|||||||
using Wabbajack.Downloaders;
|
using Wabbajack.Downloaders;
|
||||||
|
using Wabbajack.DTOs.JsonConverters;
|
||||||
|
using Wabbajack.Paths;
|
||||||
using Wabbajack.RateLimiter;
|
using Wabbajack.RateLimiter;
|
||||||
using Wabbajack.Util;
|
using Wabbajack.Util;
|
||||||
|
|
||||||
namespace Wabbajack
|
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
|
public class PerformanceSettings : ViewModel
|
||||||
{
|
{
|
||||||
private readonly Configuration.MainSettings _settings;
|
private readonly Configuration.MainSettings _settings;
|
||||||
|
@ -135,6 +135,8 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
|||||||
public LogStream LoggerProvider { get; }
|
public LogStream LoggerProvider { get; }
|
||||||
|
|
||||||
private AbsolutePath LastInstallPath { get; set; }
|
private AbsolutePath LastInstallPath { get; set; }
|
||||||
|
|
||||||
|
[Reactive] public bool OverwriteFiles { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// Command properties
|
// Command properties
|
||||||
@ -225,7 +227,10 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
|||||||
{
|
{
|
||||||
UIUtils.OpenFolder(Installer.Location.TargetPath);
|
UIUtils.OpenFolder(Installer.Location.TargetPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.WhenAnyValue(x => x.OverwriteFiles)
|
||||||
|
.Subscribe(x => ConfirmOverwrite());
|
||||||
|
|
||||||
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
MessageBus.Current.Listen<LoadModlistForInstalling>()
|
||||||
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
|
.Subscribe(msg => LoadModlistFromGallery(msg.Path, msg.Metadata).FireAndForget())
|
||||||
.DisposeWith(CompositeDisposable);
|
.DisposeWith(CompositeDisposable);
|
||||||
@ -314,24 +319,11 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
|
|||||||
yield return ErrorResponse.Fail("Installing in this folder may overwrite Wabbajack");
|
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())
|
Directory.EnumerateFileSystemEntries(installPath.ToString()).Any())
|
||||||
{
|
{
|
||||||
string message =
|
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 +
|
||||||
"There are files already in the chosen install path, if you are updating an existing modlist, this is fine. " + Environment.NewLine +
|
"if you are updating an existing modlist, then this is expected and can be overwritten.");
|
||||||
" 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KnownFolders.IsInSpecialFolder(installPath) || KnownFolders.IsInSpecialFolder(downloadPath))
|
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()
|
private async Task BeginInstall()
|
||||||
{
|
{
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
|
@ -20,6 +20,9 @@ namespace Wabbajack
|
|||||||
[Reactive]
|
[Reactive]
|
||||||
public IInstaller ActiveInstallation { get; private set; }
|
public IInstaller ActiveInstallation { get; private set; }
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public Mo2ModlistInstallationSettings CurrentSettings { get; set; }
|
||||||
|
|
||||||
public FilePickerVM Location { get; }
|
public FilePickerVM Location { get; }
|
||||||
|
|
||||||
public FilePickerVM DownloadLocation { get; }
|
public FilePickerVM DownloadLocation { get; }
|
||||||
@ -60,6 +63,16 @@ namespace Wabbajack
|
|||||||
|
|
||||||
public void Unload()
|
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()
|
public void AfterInstallNavigation()
|
||||||
|
@ -81,10 +81,11 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<local:BeginButton Grid.Row="1"
|
<local:BeginButton Grid.Row="1"
|
||||||
x:Name="BeginButton"
|
x:Name="BeginButton"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<icon:PackIconFontAwesome Grid.Row="2"
|
<icon:PackIconFontAwesome Grid.Row="2"
|
||||||
x:Name="ErrorSummaryIconGlow"
|
x:Name="ErrorSummaryIconGlow"
|
||||||
@ -99,8 +100,27 @@
|
|||||||
<icon:PackIconFontAwesome Grid.Row="2"
|
<icon:PackIconFontAwesome Grid.Row="2"
|
||||||
x:Name="ErrorSummaryIcon"
|
x:Name="ErrorSummaryIcon"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Top"
|
||||||
Foreground="{StaticResource WarningBrush}"
|
Foreground="{StaticResource WarningBrush}"
|
||||||
Kind="ExclamationTriangleSolid" />
|
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>
|
||||||
</Grid>
|
</Grid>
|
||||||
</rxui:ReactiveUserControl>
|
</rxui:ReactiveUserControl>
|
||||||
|
@ -39,9 +39,11 @@ namespace Wabbajack
|
|||||||
this.WhenAny(x => x.ViewModel.BeginCommand)
|
this.WhenAny(x => x.ViewModel.BeginCommand)
|
||||||
.BindToStrict(this, x => x.BeginButton.Command)
|
.BindToStrict(this, x => x.BeginButton.Command)
|
||||||
.DisposeWith(dispose);
|
.DisposeWith(dispose);
|
||||||
|
this.BindStrict(ViewModel, vm => vm.OverwriteFiles, x => x.OverwriteCheckBox.IsChecked)
|
||||||
|
.DisposeWith(dispose);
|
||||||
|
|
||||||
// Error handling
|
// Error handling
|
||||||
|
|
||||||
this.WhenAnyValue(x => x.ViewModel.ErrorState)
|
this.WhenAnyValue(x => x.ViewModel.ErrorState)
|
||||||
.Select(v => !v.Failed)
|
.Select(v => !v.Failed)
|
||||||
.BindToStrict(this, view => view.BeginButton.IsEnabled)
|
.BindToStrict(this, view => view.BeginButton.IsEnabled)
|
||||||
|
Reference in New Issue
Block a user