Class HarmonyCensus
The Harmony patches applied in the game, read from ValheimCLI's optional valheim.observe/harmony command. On the Valheim 1.0.16 Windows dedicated server (BepInEx 5.4.23.5, HarmonyX 2.9.0) a patch whose
target method is missing leaves an accesstools-not-found warning in BepInEx's log, and PatchAll throws, which
only Unity's log records; the teardown log scan fails on both, but only after the run. A half-patched mod stays loaded
and passes every test that does not ask; Check(string, IEnumerable<DeclaredPatch>) asks, by name, while the run goes on. The census is
read-only and may be re-read.
public sealed class HarmonyCensus
- Inheritance
-
objectHarmonyCensus
Fields
Source
public const string Source = "harmony-patches"
Field Value
- string
Properties
Methods
Every method the census lists, including one whose patches have all been removed.
public IReadOnlyList<string> Methods { get; }
Property Value
- IReadOnlyList<string>
Patches
public IReadOnlyList<AppliedPatch> Patches { get; }
Property Value
- IReadOnlyList<AppliedPatch>
Methods
Check(string, IEnumerable<DeclaredPatch>)
Compares owner's applied patches with the ones the mod declares: which declared patch is missing,
which applied one the list does not declare, and which patches of other owners sit on the same methods.
public HarmonyPatchCheck Check(string owner, IEnumerable<DeclaredPatch> declared)
Parameters
ownerstringdeclaredIEnumerable<DeclaredPatch>
Returns
OthersChanged(HarmonyCensus, HarmonyCensus, string)
How other owners' patches differ between two censuses, ignoring owner's: for example before and
after that owner's extension or plugin reloads, which must leave everybody else's patches in place. Empty when
nothing changed; otherwise one line per removed or added patch.
public static IReadOnlyList<string> OthersChanged(HarmonyCensus before, HarmonyCensus after, string owner)
Parameters
beforeHarmonyCensusafterHarmonyCensusownerstring
Returns
- IReadOnlyList<string>
Parse(JsonElement)
Parses census data; anything malformed or incomplete throws rather than reading as "no patches".
public static HarmonyCensus Parse(JsonElement data)
Parameters
dataJsonElement
Returns
Read(GameActor, string, string?)
Reads a complete census through capabilityPath (for example valheim.observe/harmony). With
owner the adapter lists only the methods that Harmony ID patches, with every owner's patches on
them: enough for Check(string, IEnumerable<DeclaredPatch>) and smaller than a whole mod list's census.
public static HarmonyCensus Read(GameActor actor, string capabilityPath, string? owner = null)
Parameters
actorGameActorcapabilityPathstringownerstring