Merge pull request #1249 from Unnoen/filter-size-before-hash

Filter downloads for file size before hashing archives.
This commit is contained in:
Timothy Baldridge 2021-01-08 21:41:18 -07:00 committed by GitHub
commit 2ce0484680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
@ -279,11 +279,16 @@ namespace Wabbajack.Lib
public async Task HashArchives()
{
Utils.Log("Looking for files to hash");
var toHash = DownloadFolder.EnumerateFiles()
var allFiles = DownloadFolder.EnumerateFiles()
.Concat(Game.GameLocation().EnumerateFiles())
.ToList();
var hashDict = allFiles.GroupBy(f => f.Size).ToDictionary(g => g.Key);
var toHash = ModList.Archives.Where(a => hashDict.ContainsKey(a.Size)).SelectMany(a => hashDict[a.Size]).ToList();
Utils.Log($"Found {toHash.Count} files to hash");
Utils.Log($"Found {allFiles.Count} total files, {toHash.Count} matching filesize");
var hashResults = await
toHash