ModRecord
A class in TavernLib, TavernLib.Backend.Mods.
A mod folder's record (manifest.json or manifest.disabled.json): the manifest it was installed from plus what's installed per target. Written in the same bytes as the launcher's Python installer writes it.
- Listed in TavernLib.Backend.Mods
- Documented in Installed mods
Constructors
| Member | What it is |
|---|---|
ModRecord() | Created by TavernLib; mods don't make one. |
Fields
2 private and internal fields
Properties
| Member | What it is |
|---|---|
JArray Artifacts { get; set; } | The builds as raw manifest JSON. |
Dictionary<string, string> Dependencies { get; set; } | Mod id to minimum version. |
string Id { get; set; } | The mod id. Must match the folder name for the record to count as ours. |
Dictionary<string, InstalledTarget> Installed { get; set; } | What's installed, by target. |
string Name { get; set; } | The display name. |
bool ParityRequired { get; set; } | True if joining players need this exact version. |
List<string> Scenes { get; set; } | Scenes it works in, or null for every scene. |
string SourceRepo { get; set; } | The source it was installed from. |
string Version { get; set; } | The installed version. |
Methods
| Member | What it is |
|---|---|
SortedDictionary<string, string> ArtifactTargets() | Each known target with a usable build, to its SHA-256. |
static JObject Build(ModManifest mod, IDictionary<string, JToken> installed) | Makes a record's JSON from a manifest and the installed entries by target. |
static JObject InstalledEntry(ModArtifact artifact, Dictionary<string, string> files) | Makes one target's installed entry from a build and its file hashes. |
InstalledTarget InstalledFor(string target) | The installed entry for a target, or null. |
IEnumerable<LibraryDependency> InstalledLibraries(string target) (iterator) | The library dependencies installed for a target, as the build describes them. |
bool Lists(string target) | True if anything is installed for the target. |
static ModRecord Read(string gameDir, string modId, out bool enabled) | One mod's record and whether it's enabled, or null if the folder isn't ours or can't be read. |
6 private and internal methods
| Member | What it is |
|---|---|
internal static string Format(JToken token) | Internal: the JSON text as Python's json.dumps(indent=2) writes it, with CRLF and non-ASCII escaped. |
private IEnumerable<ModArtifact> ParsedArtifacts() (iterator) | Yields the record's artifacts that parse, skipping the ones that don't. |
internal static JObject ParseObject(string path) | Internal: reads a JSON object file as strict UTF-8 with no BOM. null if missing or unparseable; throws on a read error. |
internal static JObject ReadOwned(string gameDir, string modId, out string path) | Internal: the record's raw JSON and path, if the folder is ours: the id matches and parity_required is a boolean. |
private static JObject SortedObject<T>(IEnumerable<KeyValuePair<string, T>> pairs) | Builds a JSON object from key and value pairs ordered by key. |
internal static void WriteFile(string path, JToken token) | Internal: writes the JSON through a temp file and swaps it in. |
Used in
Members of other types that take, return or hold a ModRecord: