mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Removed internal WorkQueue in ValidateModlist that was un-disposed
This commit is contained in:
parent
03c88b0f38
commit
e90759937b
@ -267,7 +267,7 @@ namespace Wabbajack.Lib
|
||||
|
||||
UpdateTracker.NextStep("Running Validation");
|
||||
|
||||
ValidateModlist.RunValidation(ModList);
|
||||
ValidateModlist.RunValidation(Queue, ModList);
|
||||
UpdateTracker.NextStep("Generating Report");
|
||||
|
||||
GenerateReport();
|
||||
|
@ -61,7 +61,7 @@ namespace Wabbajack.Lib
|
||||
|
||||
if (cancel.IsCancellationRequested) return false;
|
||||
UpdateTracker.NextStep("Validating Modlist");
|
||||
ValidateModlist.RunValidation(ModList);
|
||||
ValidateModlist.RunValidation(Queue, ModList);
|
||||
|
||||
Directory.CreateDirectory(OutputFolder);
|
||||
Directory.CreateDirectory(DownloadFolder);
|
||||
|
@ -17,9 +17,14 @@ namespace Wabbajack.Lib.Validation
|
||||
{
|
||||
public Dictionary<string, Author> AuthorPermissions { get; set; } = new Dictionary<string, Author>();
|
||||
|
||||
private WorkQueue Queue = new WorkQueue();
|
||||
private readonly WorkQueue _queue;
|
||||
public ServerWhitelist ServerWhitelist { get; set; } = new ServerWhitelist();
|
||||
|
||||
public ValidateModlist(WorkQueue workQueue)
|
||||
{
|
||||
_queue = workQueue;
|
||||
}
|
||||
|
||||
public void LoadAuthorPermissionsFromString(string s)
|
||||
{
|
||||
AuthorPermissions = s.FromYaml<Dictionary<string, Author>>();
|
||||
@ -49,9 +54,9 @@ namespace Wabbajack.Lib.Validation
|
||||
|
||||
}
|
||||
|
||||
public static void RunValidation(ModList modlist)
|
||||
public static void RunValidation(WorkQueue queue, ModList modlist)
|
||||
{
|
||||
var validator = new ValidateModlist();
|
||||
var validator = new ValidateModlist(queue);
|
||||
|
||||
validator.LoadListsFromGithub();
|
||||
|
||||
@ -103,12 +108,12 @@ namespace Wabbajack.Lib.Validation
|
||||
|
||||
var nexus_mod_permissions = modlist.Archives
|
||||
.Where(a => a.State is NexusDownloader.State)
|
||||
.PMap(Queue, a => (a.Hash, FilePermissions((NexusDownloader.State)a.State), a))
|
||||
.PMap(_queue, a => (a.Hash, FilePermissions((NexusDownloader.State)a.State), a))
|
||||
.ToDictionary(a => a.Hash, a => new { permissions = a.Item2, archive = a.a });
|
||||
|
||||
modlist.Directives
|
||||
.OfType<PatchedFromArchive>()
|
||||
.PMap(Queue, p =>
|
||||
.PMap(_queue, p =>
|
||||
{
|
||||
if (nexus_mod_permissions.TryGetValue(p.ArchiveHashPath[0], out var archive))
|
||||
{
|
||||
@ -127,7 +132,7 @@ namespace Wabbajack.Lib.Validation
|
||||
|
||||
modlist.Directives
|
||||
.OfType<FromArchive>()
|
||||
.PMap(Queue,p =>
|
||||
.PMap(_queue, p =>
|
||||
{
|
||||
if (nexus_mod_permissions.TryGetValue(p.ArchiveHashPath[0], out var archive))
|
||||
{
|
||||
|
@ -6,6 +6,7 @@ using Wabbajack.Lib.Downloaders;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.Validation;
|
||||
using Game = Wabbajack.Common.Game;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
@ -47,9 +48,12 @@ namespace Wabbajack.Test
|
||||
[TestInitialize]
|
||||
public void TestSetup()
|
||||
{
|
||||
validate = new ValidateModlist();
|
||||
validate.LoadAuthorPermissionsFromString(permissions);
|
||||
validate.LoadServerWhitelist(server_whitelist);
|
||||
using (var workQueue = new WorkQueue())
|
||||
{
|
||||
validate = new ValidateModlist(workQueue);
|
||||
validate.LoadAuthorPermissionsFromString(permissions);
|
||||
validate.LoadServerWhitelist(server_whitelist);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -243,7 +247,10 @@ namespace Wabbajack.Test
|
||||
[TestMethod]
|
||||
public void CanLoadFromGithub()
|
||||
{
|
||||
new ValidateModlist().LoadListsFromGithub();
|
||||
using (var workQueue = new WorkQueue())
|
||||
{
|
||||
new ValidateModlist(workQueue).LoadListsFromGithub();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user