Fix timeouts caused by having too many patches

This commit is contained in:
Timothy Baldridge 2020-07-01 06:07:02 -06:00
parent 9cf2ef9705
commit f1e5fa9f0f

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Alphaleonis.Win32.Filesystem;
using F23.StringSimilarity;
using Newtonsoft.Json;
using Wabbajack.Common;
using Wabbajack.VirtualFileSystem;
@ -75,8 +76,11 @@ namespace Wabbajack.Lib.CompilationSteps
var relName = (RelativePath)Path.GetFileName(matchAllName);
if (_indexedByName.TryGetValue(relName, out var arch))
{
// Just match some file in the archive based on the smallest delta difference
found = arch.SelectMany(a => a.ThisAndAllChildren).ToArray();
var dist = new Levenshtein();
found = arch.SelectMany(a => a.ThisAndAllChildren)
.OrderBy(a => dist.Distance(a.FullPath.FileName.ToString(), source.File.FullPath.FileName.ToString()))
.Take(3)
.ToArray();
}
}