perf(content): add typed prepared asset source

Introduce explicit loaded, missing, and corrupt outcomes over typed pak keys, validate package/DAT identity at open, add zero-I/O TOC probes, preserve cancellation, and route the package path through RuntimeOptions. Production injection follows in the next checkpoint.
This commit is contained in:
Erik 2026-07-24 14:52:12 +02:00
parent 7fb7189de8
commit c42f93b323
7 changed files with 750 additions and 8 deletions

View file

@ -24,6 +24,9 @@ public sealed class RuntimeOptionsTests
var opts = RuntimeOptions.Parse(AnyDatDir, EmptyEnv());
Assert.Equal(AnyDatDir, opts.DatDir);
Assert.Equal(
Path.Combine(AnyDatDir, "acdream.pak"),
opts.PreparedAssetPath);
Assert.False(opts.LiveMode);
Assert.Equal("127.0.0.1", opts.LiveHost);
Assert.Equal(9000, opts.LivePort);
@ -49,6 +52,19 @@ public sealed class RuntimeOptionsTests
Assert.False(opts.HasLiveCredentials);
}
[Fact]
public void PreparedAssetPath_DefaultsBesideDats_AndAllowsOneOverride()
{
Assert.Equal(
Path.Combine(AnyDatDir, "acdream.pak"),
RuntimeOptions.Parse(AnyDatDir, EmptyEnv()).PreparedAssetPath);
var overridden = RuntimeOptions.Parse(
AnyDatDir,
Env(new() { ["ACDREAM_PAK_PATH"] = "D:/prepared/acdream.pak" }));
Assert.Equal("D:/prepared/acdream.pak", overridden.PreparedAssetPath);
}
[Fact]
public void LiveMode_Set_ExactlyByValue1()
{