- Keep patches stable across Emby upgrades.
- Prefer exact method resolution over heuristic matching.
EMBY_DOCS_DIR: specifies which folder underDocs/is used as the signature source.- Default:
emby_4.9.3.0. - Effective path:
Docs/${EMBY_DOCS_DIR}/.
- Use method signature exports under
Docs/${EMBY_DOCS_DIR}/. - Primary files:
*_methods.txtfor target assemblies.
Patch/: Harmony patch implementations and method resolution logic.Patch/PatchManager.cs: central patch bootstrap, configure, and health tracking entry.ScheduledTask/: operational tasks (export, scan, refresh, diagnostics).Services/: runtime business services used by patches and tasks.Configuration/+Options/: plugin config models and UI wiring.Docs/${EMBY_DOCS_DIR}/: selected versioned method signature exports; the only signature source of truth.Scripts/: helper scripts for pulling dlls/method docs and runtime ops.
- Always use
PatchMethodResolver.Resolve(...)for patch targets. - Set explicit
ParameterTypeswhenever possible. - Set
ReturnTypewhen overload ambiguity is possible. - Avoid
Predicateunless there is no stable type-based signature. - Do not use fallback
FindMethod(...)name-only matching in production paths.
- Locate target type and method in
Docs/${EMBY_DOCS_DIR}/<Assembly>_methods.txt. - Copy exact parameter type order from docs.
- Resolve dependent runtime types by full name (
Assembly.GetType("Namespace.Type")). - Build
MethodSignatureProfilewith exactBindingFlags+ParameterTypes. - If key dependent type is missing, log
PatchLog.InitFailed(...)and return. - Build and verify with
dotnet build MediaInfoKeeper.sln.
- On resolve success/failure, rely on existing
PatchLog.ResolveHit/ResolveFailed. - On missing prerequisite types, provide clear reason in
InitFailed.
- When a method has multiple valid overloads across versions, resolve each exact overload and patch all of them.
- Keep patch prefix/postfix signatures compatible with all patched overloads.
- Don’t rely on parameter count (
p.Length) as primary matching strategy. - Don’t keep dead reflection helpers that are no longer used.
- Don’t silently swallow missing type/signature situations.
- Don’t mix unrelated refactors when updating patch signatures.