2020-03-28 02:54:14 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-01-05 05:07:00 +00:00
|
|
|
|
using System.IO;
|
2019-09-26 23:08:10 +00:00
|
|
|
|
using System.Linq;
|
2019-12-07 02:54:27 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2020-04-22 20:58:50 +00:00
|
|
|
|
using Compression.BSA;
|
2019-12-06 04:58:18 +00:00
|
|
|
|
using Wabbajack.Common;
|
2019-10-16 03:10:34 +00:00
|
|
|
|
using Wabbajack.Lib;
|
2019-12-06 00:05:26 +00:00
|
|
|
|
using Wabbajack.Lib.CompilationSteps.CompilationErrors;
|
2020-03-28 02:54:14 +00:00
|
|
|
|
using Xunit;
|
|
|
|
|
using Xunit.Abstractions;
|
2019-11-02 21:08:37 +00:00
|
|
|
|
using File = Alphaleonis.Win32.Filesystem.File;
|
|
|
|
|
using Path = Alphaleonis.Win32.Filesystem.Path;
|
2019-09-24 04:20:24 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Test
|
|
|
|
|
{
|
2019-10-31 02:24:42 +00:00
|
|
|
|
public class SanityTests : ACompilerTest
|
2019-09-24 04:20:24 +00:00
|
|
|
|
{
|
2020-03-28 02:54:14 +00:00
|
|
|
|
|
|
|
|
|
public SanityTests(ITestOutputHelper helper) : base(helper)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task TestDirectMatch()
|
2019-09-24 04:20:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var testPex = utils.AddModFile(mod, @"Data\scripts\test.pex", 10);
|
2019-09-26 22:32:15 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2019-09-24 04:20:24 +00:00
|
|
|
|
|
|
|
|
|
utils.AddManualDownload(
|
2020-03-28 02:54:14 +00:00
|
|
|
|
new Dictionary<string, byte[]> {{"/baz/biz.pex", await testPex.ReadAllBytesAsync()}});
|
2019-09-24 04:20:24 +00:00
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
await CompileAndInstall(profile);
|
2019-09-24 04:20:24 +00:00
|
|
|
|
|
2019-09-26 22:32:15 +00:00
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\test.pex");
|
|
|
|
|
}
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2020-01-07 00:24:33 +00:00
|
|
|
|
public async Task TestDirectMatchFromGameFolder()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var testPex = utils.AddGameFile(@"enbstuff\test.pex", 10);
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
|
|
|
|
utils.AddManualDownload(
|
2020-03-28 02:54:14 +00:00
|
|
|
|
new Dictionary<string, byte[]> {{"/baz/biz.pex", await testPex.ReadAllBytesAsync()}});
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
|
|
|
|
await CompileAndInstall(profile);
|
|
|
|
|
|
|
|
|
|
utils.VerifyInstalledGameFile(@"enbstuff\test.pex");
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2020-01-07 00:24:33 +00:00
|
|
|
|
public async Task TestDirectMatchIsIgnoredWhenGameFolderFilesOverrideExists()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var testPex = utils.AddGameFile(@"enbstuff\test.pex", 10);
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
utils.MO2Folder.Combine(Consts.GameFolderFilesDir).CreateDirectory();
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
|
|
|
|
utils.AddManualDownload(
|
2020-03-28 02:54:14 +00:00
|
|
|
|
new Dictionary<string, byte[]> {{"/baz/biz.pex", await testPex.ReadAllBytesAsync()}});
|
2020-01-07 00:24:33 +00:00
|
|
|
|
|
|
|
|
|
await CompileAndInstall(profile);
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.False(utils.InstallFolder.Combine(Consts.GameFolderFilesDir, (RelativePath)@"enbstuff\test.pex").IsFile);
|
2020-01-07 00:24:33 +00:00
|
|
|
|
}
|
2019-09-26 22:32:15 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2019-12-07 02:54:27 +00:00
|
|
|
|
public async Task TestDuplicateFilesAreCopied()
|
2019-11-07 04:43:30 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var testPex = utils.AddModFile(mod, @"Data\scripts\test.pex", 10);
|
2019-11-07 04:43:30 +00:00
|
|
|
|
|
|
|
|
|
// Make a copy to make sure it gets picked up and moved around.
|
2020-03-28 02:54:14 +00:00
|
|
|
|
testPex.CopyTo(testPex.WithExtension(new Extension(".copy")));
|
2019-11-07 04:43:30 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2019-11-07 04:43:30 +00:00
|
|
|
|
|
|
|
|
|
utils.AddManualDownload(
|
2020-03-28 02:54:14 +00:00
|
|
|
|
new Dictionary<string, byte[]> { { "/baz/biz.pex", await testPex.ReadAllBytesAsync() } });
|
2019-11-07 04:43:30 +00:00
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
await CompileAndInstall(profile);
|
2019-11-07 04:43:30 +00:00
|
|
|
|
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\test.pex");
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\test.pex.copy");
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2019-12-07 02:54:27 +00:00
|
|
|
|
public async Task TestUpdating()
|
2019-11-18 05:21:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
|
|
|
|
var unchanged = utils.AddModFile(mod, @"Data\scripts\unchanged.pex", 10);
|
|
|
|
|
var deleted = utils.AddModFile(mod, @"Data\scripts\deleted.pex", 10);
|
|
|
|
|
var modified = utils.AddModFile(mod, @"Data\scripts\modified.pex", 10);
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
|
|
|
|
utils.AddManualDownload(
|
|
|
|
|
new Dictionary<string, byte[]>
|
|
|
|
|
{
|
2020-03-28 02:54:14 +00:00
|
|
|
|
{ "/baz/unchanged.pex", await unchanged.ReadAllBytesAsync() },
|
|
|
|
|
{ "/baz/deleted.pex", await deleted.ReadAllBytesAsync() },
|
|
|
|
|
{ "/baz/modified.pex", await modified.ReadAllBytesAsync() },
|
2019-11-18 05:21:24 +00:00
|
|
|
|
});
|
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
await CompileAndInstall(profile);
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\unchanged.pex");
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\deleted.pex");
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\modified.pex");
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var unchangedPath = utils.PathOfInstalledFile(mod, @"Data\scripts\unchanged.pex");
|
|
|
|
|
var deletedPath = utils.PathOfInstalledFile(mod, @"Data\scripts\deleted.pex");
|
|
|
|
|
var modifiedPath = utils.PathOfInstalledFile(mod, @"Data\scripts\modified.pex");
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var extraPath = utils.PathOfInstalledFile(mod, @"something_i_made.foo");
|
|
|
|
|
await extraPath.WriteAllTextAsync("bleh");
|
2019-11-20 00:15:46 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var extraFolder = utils.PathOfInstalledFile(mod, @"something_i_made.foo").Parent.Combine("folder_i_made");
|
|
|
|
|
extraFolder.CreateDirectory();
|
2020-01-05 05:07:00 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.True(extraFolder.IsDirectory);
|
2020-01-05 05:07:00 +00:00
|
|
|
|
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var unchangedModified = unchangedPath.LastModified;
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await modifiedPath.WriteAllTextAsync("random data");
|
|
|
|
|
var modifiedModified = modifiedPath.LastModified;
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
deletedPath.Delete();
|
2019-11-20 00:15:46 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.True(extraPath.Exists);
|
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
await CompileAndInstall(profile);
|
2019-11-18 05:21:24 +00:00
|
|
|
|
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\unchanged.pex");
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\deleted.pex");
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\modified.pex");
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.Equal(unchangedModified, unchangedPath.LastModified);
|
|
|
|
|
Assert.NotEqual(modifiedModified, modifiedPath.LastModified);
|
|
|
|
|
Assert.False(extraPath.Exists);
|
|
|
|
|
Assert.False(extraFolder.Exists);
|
2019-11-18 05:21:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-07 04:43:30 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2019-12-07 02:54:27 +00:00
|
|
|
|
public async Task CleanedESMTest()
|
2019-11-02 21:08:37 +00:00
|
|
|
|
{
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod("Cleaned ESMs");
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var updateEsm = utils.AddModFile(mod, @"Update.esm", 10);
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var gameFile = utils.GameFolder.Combine("Data", "Update.esm");
|
|
|
|
|
utils.GenerateRandomFileData(gameFile, 20);
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
2019-12-13 13:02:58 +00:00
|
|
|
|
var modlist = await CompileAndInstall(profile);
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Update.esm");
|
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
var compiler = await ConfigureAndRunCompiler(profile);
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
|
|
|
|
// Update the file and verify that it throws an error.
|
2020-03-28 02:54:14 +00:00
|
|
|
|
utils.GenerateRandomFileData(gameFile, 20);
|
|
|
|
|
var exception = await Assert.ThrowsAsync<InvalidGameESMError>(async () => await Install(compiler));
|
|
|
|
|
Assert.IsAssignableFrom<InvalidGameESMError>(exception);
|
2019-12-06 04:58:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2019-12-13 13:02:58 +00:00
|
|
|
|
public async Task SetScreenSizeTest()
|
2019-12-06 04:58:18 +00:00
|
|
|
|
{
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod("dummy");
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
|
|
|
|
await utils.MO2Folder.Combine("profiles", profile, "somegameprefs.ini").WriteAllLinesAsync(
|
|
|
|
|
// Beth inis are messy, let's make ours just as messy to catch some parse failures
|
|
|
|
|
"[Display]",
|
|
|
|
|
"foo=4",
|
|
|
|
|
"[Display]",
|
|
|
|
|
"STestFile=f",
|
|
|
|
|
"STestFile=",
|
|
|
|
|
"[Display]",
|
|
|
|
|
"foo=4",
|
|
|
|
|
"iSize H=50",
|
|
|
|
|
"iSize W=100",
|
|
|
|
|
"[MEMORY]",
|
|
|
|
|
"VideoMemorySizeMb=22");
|
2019-12-06 04:58:18 +00:00
|
|
|
|
|
2019-12-13 13:02:58 +00:00
|
|
|
|
var modlist = await CompileAndInstall(profile);
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var ini = utils.InstallFolder.Combine("profiles", profile, "somegameprefs.ini").LoadIniFile();
|
2019-11-02 21:08:37 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var sysinfo = CreateDummySystemParameters();
|
2020-03-10 04:11:11 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.Equal(sysinfo.ScreenHeight.ToString(), ini?.Display?["iSize H"]);
|
|
|
|
|
Assert.Equal(sysinfo.ScreenWidth.ToString(), ini?.Display?["iSize W"]);
|
|
|
|
|
Assert.Equal(sysinfo.EnbLEVRAMSize.ToString(), ini?.MEMORY?["VideoMemorySizeMb"]);
|
2019-11-02 21:08:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2019-12-07 02:54:27 +00:00
|
|
|
|
public async Task UnmodifiedInlinedFilesArePulledFromArchives()
|
2019-09-26 23:08:10 +00:00
|
|
|
|
{
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
|
|
|
|
var ini = utils.AddModFile(mod, @"foo.ini", 10);
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
|
|
|
|
utils.AddManualDownload(
|
2020-03-28 02:54:14 +00:00
|
|
|
|
new Dictionary<string, byte[]> { { "/baz/biz.pex", await ini.ReadAllBytesAsync() } });
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
var modlist = await CompileAndInstall(profile);
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var directive = modlist.Directives.FirstOrDefault(m => m.To == (RelativePath)$"mods\\{mod}\\foo.ini");
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.NotNull(directive);
|
|
|
|
|
Assert.IsAssignableFrom<FromArchive>(directive);
|
2019-09-26 23:08:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
[Fact]
|
2019-12-07 02:54:27 +00:00
|
|
|
|
public async Task ModifiedIniFilesArePatchedAgainstFileWithSameName()
|
2019-09-26 23:08:10 +00:00
|
|
|
|
{
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
|
|
|
|
var ini = utils.AddModFile(mod, @"foo.ini", 10);
|
2019-11-21 21:32:58 +00:00
|
|
|
|
var meta = utils.AddModFile(mod, "meta.ini");
|
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await utils.Configure();
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
|
|
|
|
|
2019-11-21 21:32:58 +00:00
|
|
|
|
var archive = utils.AddManualDownload(
|
2020-03-28 02:54:14 +00:00
|
|
|
|
new Dictionary<string, byte[]> { { "/baz/foo.ini", await ini.ReadAllBytesAsync() } });
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await meta.WriteAllLinesAsync(
|
2019-11-21 21:32:58 +00:00
|
|
|
|
"[General]",
|
2020-03-28 02:54:14 +00:00
|
|
|
|
$"installationFile={archive}");
|
2019-11-21 21:32:58 +00:00
|
|
|
|
|
2019-09-26 23:08:10 +00:00
|
|
|
|
// Modify after creating mod archive in the downloads folder
|
2020-03-28 02:54:14 +00:00
|
|
|
|
await ini.WriteAllTextAsync("Wabbajack, Wabbajack, Wabbajack!");
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
2019-12-07 02:54:27 +00:00
|
|
|
|
var modlist = await CompileAndInstall(profile);
|
2020-03-28 02:54:14 +00:00
|
|
|
|
var directive = modlist.Directives.FirstOrDefault(m => m.To == (RelativePath)$"mods\\{mod}\\foo.ini");
|
2019-09-26 23:08:10 +00:00
|
|
|
|
|
2020-03-28 02:54:14 +00:00
|
|
|
|
Assert.NotNull(directive);
|
|
|
|
|
Assert.IsAssignableFrom<PatchedFromArchive>(directive);
|
2019-09-26 23:08:10 +00:00
|
|
|
|
}
|
2020-04-22 20:58:50 +00:00
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task CanPatchFilesSourcedFromBSAs()
|
|
|
|
|
{
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
|
|
|
|
var file = utils.AddModFile(mod, @"baz.bin", 10);
|
|
|
|
|
|
|
|
|
|
await utils.Configure();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using var tempFile = new TempFile();
|
|
|
|
|
var bsaState = new BSAStateObject
|
|
|
|
|
{
|
|
|
|
|
Magic = "BSA\0", Version = 0x69, ArchiveFlags = 0x107, FileFlags = 0x0,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await using (var bsa = bsaState.MakeBuilder(1024 * 1024))
|
|
|
|
|
{
|
|
|
|
|
await bsa.AddFile(new BSAFileStateObject
|
|
|
|
|
{
|
|
|
|
|
Path = (RelativePath)@"foo\bar\baz.bin", Index = 0, FlipCompression = false
|
|
|
|
|
}, new MemoryStream(utils.RandomData()));
|
|
|
|
|
await bsa.Build(tempFile.Path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var archive = utils.AddManualDownload(
|
|
|
|
|
new Dictionary<string, byte[]> { { "/stuff/files.bsa", await tempFile.Path.ReadAllBytesAsync() } });
|
|
|
|
|
|
|
|
|
|
await CompileAndInstall(profile);
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"baz.bin");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task CanRecreateBSAsFromFilesSourcedInOtherBSAs()
|
|
|
|
|
{
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
|
|
|
|
var file = utils.AddModFile(mod, @"baz.bsa", 10);
|
|
|
|
|
|
|
|
|
|
await utils.Configure();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bsaState = new BSAStateObject
|
|
|
|
|
{
|
|
|
|
|
Magic = "BSA\0", Version = 0x69, ArchiveFlags = 0x107, FileFlags = 0x0,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Create the download
|
|
|
|
|
using var tempFile = new TempFile();
|
|
|
|
|
await using (var bsa = bsaState.MakeBuilder(1024 * 1024))
|
|
|
|
|
{
|
|
|
|
|
await bsa.AddFile(new BSAFileStateObject
|
|
|
|
|
{
|
|
|
|
|
Path = (RelativePath)@"foo\bar\baz.bin", Index = 0, FlipCompression = false
|
|
|
|
|
}, new MemoryStream(utils.RandomData()));
|
|
|
|
|
await bsa.Build(tempFile.Path);
|
|
|
|
|
}
|
|
|
|
|
var archive = utils.AddManualDownload(
|
|
|
|
|
new Dictionary<string, byte[]> { { "/stuff/baz.bsa", await tempFile.Path.ReadAllBytesAsync() } });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create the result
|
|
|
|
|
await using (var bsa = bsaState.MakeBuilder(1024 * 1024))
|
|
|
|
|
{
|
|
|
|
|
await bsa.AddFile(new BSAFileStateObject
|
|
|
|
|
{
|
|
|
|
|
Path = (RelativePath)@"foo\bar\baz.bin", Index = 0, FlipCompression = false
|
|
|
|
|
}, new MemoryStream(utils.RandomData()));
|
|
|
|
|
await bsa.Build(file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await CompileAndInstall(profile);
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"baz.bsa");
|
|
|
|
|
|
|
|
|
|
}
|
2020-04-22 04:13:07 +00:00
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async Task NoMatchIncludeIncludesNonMatchingFiles()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var profile = utils.AddProfile();
|
|
|
|
|
var mod = utils.AddMod();
|
|
|
|
|
var testPex = utils.AddModFile(mod, @"Data\scripts\test.pex", 10);
|
|
|
|
|
|
|
|
|
|
await utils.Configure();
|
|
|
|
|
|
|
|
|
|
await utils.AddModFile(mod, "meta.ini").WriteAllLinesAsync(new[]
|
|
|
|
|
{
|
|
|
|
|
"[General]", "notes= fsdaf WABBAJACK_NOMATCH_INCLUDE fadsfsad",
|
|
|
|
|
});
|
|
|
|
|
await CompileAndInstall(profile);
|
|
|
|
|
|
|
|
|
|
utils.VerifyInstalledFile(mod, @"Data\scripts\test.pex");
|
|
|
|
|
}
|
2020-03-28 02:54:14 +00:00
|
|
|
|
|
2019-09-24 04:20:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|