public void TestFileExistsByPathId() { using var archive = new PackfileReader(Path.Combine(GameDataPath, GameRootArchive)); Assert.IsTrue(Packfile.GetHashForPath(Packfile.SanitizePath("prefetch/fullgame.prefetch")) == 0x2FFF5AF65CD64C0A); Assert.IsTrue(archive.ContainsFile(0x2FFF5AF65CD64C0A)); Assert.ThrowsException <FileNotFoundException>(() => archive.ExtractFile(0xDEADC0DEDEADBEEF, new MemoryStream())); }
public void TestFileExists() { using var archive = new PackfileReader(Path.Combine(GameDataPath, GameRootArchive)); Assert.IsTrue(archive.ContainsFile("prefetch/fullgame.prefetch.core")); Assert.IsTrue(archive.ContainsFile(Packfile.SanitizePath("prefetch/fullgame.prefetch"))); Assert.IsTrue(archive.ContainsFile(Packfile.SanitizePath("prefetch\\fullgame.prefetch.core"))); #if false Assert.IsTrue(archive.ContainsFile("models/weapons/heavy_machinegun/model/model.core.stream"));// Need to find files present in Initial.bin Assert.IsTrue(archive.ContainsFile("sounds/effects/world/weather/habitats/fields/weather_fields.soundbank.core.stream")); #endif Assert.IsFalse(archive.ContainsFile("PREFETCH/fullgame.prefetch.core")); Assert.IsFalse(archive.ContainsFile("prefetch\\FULLGAME.prefetch.core")); Assert.IsFalse(archive.ContainsFile("some/made/up/path/here.core")); }