Skip to main content

ModReconciler.Pass

A private class in TavernLib, TavernLib.Backend.Mods. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.

Private: one reconcile pass, with its deadline, the fetched index and per-pass verify results.

Constructors​

MemberWhat it is
Pass(string gameDir, NativeHttp http, List<string> repos, string scene)Sets up a pass over the given game folder, repos and scene.

Fields​

7 private and internal fields
MemberWhat it is
private readonly ModRepoClient _clientThe repo client used for index and manifest fetches, bounded by the same deadline.
private readonly DateTime _deadlineWhen the pass runs out of time.
private ModIndex _indexThe merged repo index, fetched the first time it is needed.
private Dictionary<string, InstalledModInfo> _installedThe installed mods found at the start of the pass, by id, updated as installs happen.
private readonly Dictionary<string, bool?> _libVerifiedPer-pass cache of whether each library file still matches its record.
private readonly Dictionary<string, bool?> _modVerifiedPer-pass cache of whether each mod's files still match what was installed.
private readonly Dictionary<string, string> _skippedMod ids that were listed but left out, with the reason, for the disable step to log.

Properties​

2 private and internal properties
MemberWhat it is
private ModIndex Index { get; }The repo index, fetched on first use.
private string SceneReason { get; }Text saying a mod doesn't work in the scene this server runs.

Methods​

MemberWhat it is
void Run(ModsList modsList)Reconciles each entry, re-enables what's kept and disables every other enabled server mod. Entries not reached in time keep what's installed.
12 private and internal methods
MemberWhat it is
private void AddInstalledClosure(string modId, HashSet<string> into)Adds a mod and its installed dependencies to a set, reading only the local records.
private ModIndex FetchIndex()Fetches the repo indexes; returns an empty index and warns if that fails.
private string FindDamage(string rootId)Returns a message for the first damaged mod or library in a mod's installed closure, or null if none.
private void InstallClosure(ModManifest target, List<ModManifest> deps, List<LibraryDependency> libs)Installs missing dependencies and libraries, then the root mod last, and refreshes the cached state afterwards.
private HashSet<string> InstalledClosure(string rootId)Returns a mod and its installed dependencies as a set.
private bool Intact(ModManifest m)Returns whether a mod is installed at the manifest's version with files that still verify.
private static bool? Memo(Dictionary<string, bool?> memo, string key, Func<bool?> verify)Runs a check once per key and reuses the answer.
private string PreferredRepo(ValueTuple<string, string> entry)Returns the repo the index lists for the entry, favouring the highest version.
private HashSet<string> ReconcileOne(ValueTuple<string, string> listed)Resolves, installs or keeps one modlist entry; returns the mod ids it accounts for, and on failure keeps what is installed.
private ValueTuple<string, string> Replace(ValueTuple<string, string> entry)Swaps a modlist entry for its replacement mod at latest version when its source has replaced it.
private bool RunsHere(string id)Returns whether the mod is installed with a build for the server target.
private ValueTuple<string, string> Unwithdraw(ValueTuple<string, string> entry)Swaps a pin on a withdrawn version for the latest version in the same major (or the mod's latest if the pin isn't a readable version), and logs a warning with the reason.