wabbajack/Wabbajack.Compiler/CompilationSteps/zEditIntegration.cs

25 lines
903 B
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using System.IO;
using System.Linq;
using Wabbajack.DTOs.Directives;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.Compiler.CompilationSteps;
public class zEditIntegration
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
public static void VerifyMerges(MO2Compiler compiler)
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
var byName = compiler.InstallDirectives.ToDictionary(f => f.To);
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
foreach (var directive in compiler.InstallDirectives.OfType<MergedPatch>())
foreach (var source in directive.Sources)
{
if (!byName.TryGetValue(source.RelativePath, out var result))
throw new InvalidDataException(
$"{source.RelativePath} is needed for merged patch {directive.To} but is not included in the install.");
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
if (result.Hash != source.Hash)
throw new InvalidDataException(
$"Hashes for {result.To} needed for zEdit merge sources don't match, this shouldn't happen");
2021-09-27 12:42:46 +00:00
}
}
}