#### Version - 3.0.1.1 - 9/19/2022

* Auto install WebView2 if Windows doesn't already have it installed
* Save settings before exiting the app
* Add more logging to the launcher
This commit is contained in:
Timothy Baldridge 2022-09-19 17:47:54 -06:00
parent 422d618bb5
commit f450cdf030
8 changed files with 37 additions and 9 deletions

View File

@ -1,5 +1,10 @@
### Changelog
#### Version - 3.0.1.1 - 9/19/2022
* Auto install WebView2 if Windows doesn't already have it installed
* Save settings before exiting the app
* Add more logging to the launcher
#### Version - 3.0.1.0 - 9/19/2022
* Official release of the 3.0 codebase

View File

@ -17,6 +17,7 @@ using Wabbajack.Models;
using Wabbajack.Services.OSIntegrated;
using Wabbajack.UserIntervention;
using Wabbajack.Util;
using WebView2.Runtime.AutoInstaller;
namespace Wabbajack
{
@ -30,6 +31,8 @@ namespace Wabbajack
public App()
{
WebView2AutoInstaller.CheckAndInstallAsync(false, false).Wait();
RxApp.MainThreadScheduler = new DispatcherScheduler(Dispatcher.CurrentDispatcher);
_host = Host.CreateDefaultBuilder(Array.Empty<string>())
.ConfigureLogging(AddLogging)

View File

@ -29,7 +29,7 @@ where T : IUserIntervention
public BrowserView? Browser { get; set; }
private WebView2 _browser => Browser!.Browser;
private Microsoft.Web.WebView2.Wpf.WebView2 _browser => Browser!.Browser;
public async Task RunWrapper(CancellationToken token)
{

View File

@ -28,7 +28,7 @@ public abstract class BrowserWindowViewModel : ViewModel
public BrowserWindow? Browser { get; set; }
private WebView2 _browser => Browser!.Browser;
private Microsoft.Web.WebView2.Wpf.WebView2 _browser => Browser!.Browser;
public async Task RunWrapper(CancellationToken token)
{

View File

@ -55,7 +55,11 @@ namespace Wabbajack
Closed += (s, e) =>
{
Environment.Exit(0);
Task.Run(async () =>
{
await Task.Delay(5000);
Environment.Exit(0);
});
};
MessageBus.Current.Listen<TaskBarUpdate>()

View File

@ -85,6 +85,7 @@
<PackageReference Include="ReactiveUI.WPF" Version="18.3.1" />
<PackageReference Include="Silk.NET.DXGI" Version="2.16.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="WebView2.Runtime.AutoInstaller" Version="1.0.0" />
<PackageReference Include="WPFThemes.DarkBlend" Version="1.0.8" />
</ItemGroup>

View File

@ -134,6 +134,7 @@ public class NexusDownloader : ADownloader<Nexus>, IUrlDownloader
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "While downloading from the Nexus {Message}", ex.Message);
if (ex.StatusCode == HttpStatusCode.Forbidden)
{
return await DownloadManually(archive, state, destination, job, token);

View File

@ -220,6 +220,12 @@ public class MainWindowViewModel : ViewModelBase
Version.TryParse(v.FileName.ToString(), out var ver) ? ver : new Version(0, 0, 0, 0))
.FirstOrDefault();
if (wjFolder == default)
{
_errors.Add("No WJ install found");
throw new Exception("No WJ install found");
}
var filename = wjFolder.Combine("Wabbajack.exe");
await CreateBatchFile(filename);
var info = new ProcessStartInfo
@ -231,8 +237,9 @@ public class MainWindowViewModel : ViewModelBase
};
Process.Start(info);
}
catch (Exception)
catch (Exception ex)
{
_errors.Add(ex.Message);
if (_errors.Count == 0)
{
Status = "Failed: Unknown error";
@ -253,11 +260,18 @@ public class MainWindowViewModel : ViewModelBase
private async Task CreateBatchFile(AbsolutePath filename)
{
filename = filename.Parent.Combine("wabbajack-cli.exe");
var data = $"\"{filename}\" %*";
var file = Path.Combine(Directory.GetCurrentDirectory(), "wabbajack-cli.bat");
if (File.Exists(file) && await File.ReadAllTextAsync(file) == data) return;
await File.WriteAllTextAsync(file, data);
try
{
filename = filename.Parent.Combine("wabbajack-cli.exe");
var data = $"\"{filename}\" %*";
var file = Path.Combine(Directory.GetCurrentDirectory(), "wabbajack-cli.bat");
if (File.Exists(file) && await File.ReadAllTextAsync(file) == data) return;
await File.WriteAllTextAsync(file, data);
}
catch (Exception ex)
{
_errors.Add($"Creating Batch File : {ex}");
}
}
private void UpdateProgress(object sender, DownloadProgressChangedEventArgs e)