namespace EvilEngine.Mounts.Tests.Support; public sealed class SyntheticGame(string game, Func? plan = null) : IGameAdapter { public static readonly Platform Pc = new("pc", ByteOrder.Little, CaseRule.Insensitive); public VirtualPath VersionFile => $"{Game}.ver"; public IReadOnlyList Declares { get; init; } = []; public Func? PlanWith { get; init; } public Externals? LastExternals { get; private set; } public string Game { get; } = game; public IReadOnlyList Platforms { get; } = [Pc]; public MountProbe? Probe(IFileSource tree) { return tree.Exists(VersionFile) ? new MountProbe(new MountId(Game, Pc.Id, tree.ReadAllText(VersionFile).Trim()), ProbeStatus.Known, tree) { Externals = Declares } : null; } public MountPlan Open(MountProbe probe, Externals externals) { LastExternals = externals; return PlanWith?.Invoke(probe.Tree, externals) ?? plan?.Invoke(probe.Tree) ?? new MountPlan(CaseRule.Insensitive) { Layers = [new LayerPlan("base", "base", new LayerSource.Tree(probe.Tree))], Parts = [new PartPlan("content", [VersionFile])], BuildFiles = [VersionFile] }; } }