Missing ExtractLibs awaits

This commit is contained in:
Justin Swanson 2019-12-17 21:18:33 -06:00
parent e0a91036d0
commit b0bff6e121
5 changed files with 29 additions and 23 deletions

View File

@ -19,7 +19,7 @@ namespace Wabbajack.Lib.LibCefHelpers
/// <summary>
/// We bundle the cef libs inside the .exe, we need to extract them before loading any wpf code that requires them
/// </summary>
public static void ExtractLibs()
public static async Task ExtractLibs()
{
if (File.Exists("cefglue.7z") && File.Exists("libcef.dll")) return;
@ -30,8 +30,9 @@ namespace Wabbajack.Lib.LibCefHelpers
Utils.Log("Extracting libCef files");
}
using (var wq = new WorkQueue(1))
FileExtractor.ExtractAll(wq, "cefglue.7z", ".");
{
await FileExtractor.ExtractAll(wq, "cefglue.7z", ".");
}
}
public static HttpClient GetClient(IEnumerable<Cookie> cookies, string referer)
{

View File

@ -13,9 +13,9 @@ namespace Wabbajack.Test
protected TestUtils utils { get; set; }
[TestInitialize]
public void TestInitialize()
public async Task TestInitialize()
{
Helpers.ExtractLibs();
await Helpers.ExtractLibs();
Consts.TestMode = true;
utils = new TestUtils();

View File

@ -24,9 +24,9 @@ namespace Wabbajack.Test
public TestContext TestContext { get; set; }
[TestInitialize]
public void Setup()
public async Task Setup()
{
Helpers.ExtractLibs();
await Helpers.ExtractLibs();
Utils.LogMessages.OfType<IInfo>().Subscribe(onNext: msg => TestContext.WriteLine(msg.ShortDescription));
Utils.LogMessages.OfType<IUserIntervention>().Subscribe(msg =>
TestContext.WriteLine("ERROR: User intervetion required: " + msg.ShortDescription));

View File

@ -4,7 +4,6 @@ using System.Reflection;
using System.Windows;
using MahApps.Metro;
using Wabbajack.Common;
using Wabbajack.Lib.LibCefHelpers;
namespace Wabbajack
{
@ -15,7 +14,7 @@ namespace Wabbajack
{
public App()
{
Helpers.ExtractLibs();
// Do initialization in MainWindow ctor
}
}
}

View File

@ -1,8 +1,10 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using MahApps.Metro.Controls;
using Wabbajack.Common;
using Wabbajack.Lib.LibCefHelpers;
using Application = System.Windows.Application;
using Utils = Wabbajack.Common.Utils;
@ -25,22 +27,26 @@ namespace Wabbajack
Wabbajack.Common.Utils.Error(((Exception)e.ExceptionObject), "Uncaught error");
};
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
try
{
if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
{
ExtensionManager.Associate(appPath);
}
}
catch (Exception e)
{
Utils.Log($"ExtensionManager had an exception:\n{e}");
}
Wabbajack.Common.Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
// Run some init tasks in background
Task.Run(async () =>
{
await Helpers.ExtractLibs();
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
try
{
if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
{
ExtensionManager.Associate(appPath);
}
}
catch (Exception e)
{
Utils.Log($"ExtensionManager had an exception:\n{e}");
}
}).FireAndForget();
// Load settings
string[] args = Environment.GetCommandLineArgs();
if ((args.Length > 1 && args[1] == "nosettings")