Skip to content

Commit

Permalink
Update documentation [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike-bot committed Aug 27, 2023
1 parent 4c9a3d1 commit 5c42611
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/articles/patching-auxilary.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h3 id="targetmethod">TargetMethod</h3>
[HarmonyTargetMethod]
static MethodBase CalculateMethod(...)
</code></pre>
<p>That method, if it exists, is expected to return a <code>MethodBase</code> of the method to be patched.</p>
<p>That method, if it exists, is expected to return a <code>MethodBase</code> of the method to be patched. The return cannot be null. If you want to conditionally skip patching, use a <code>Prepare()</code> method.</p>
<h3 id="targetmethods">TargetMethods</h3>
<p>If you want to patch multiple methods with the same patch, you can use <code>TargetMethods</code>. It has the same behaviour as <code>TargetMethod</code> except that it returns an enumeration of <code>MethodBase</code> instead of a single <code>MethodBase</code>:</p>
<pre><code class="lang-csharp">static IEnumerable&lt;MethodBase&gt; TargetMethods(...)
Expand All @@ -135,7 +135,9 @@ <h3 id="targetmethods">TargetMethods</h3>

// you could also iterate using reflections over many methods
}
</code></pre><h3 id="cleanup">Cleanup</h3>
</code></pre>
<p>Similar to <code>TargetMethod</code>, the implementation cannot return zero results. If you want to conditionally skip patching, use a <code>Prepare()</code> method.</p>
<h3 id="cleanup">Cleanup</h3>
<p>After patching, Harmony gives you a chance to clean up your state. For this, Harmony searches for a method called</p>
<pre><code class="lang-csharp">static void Cleanup(...)
static void Cleanup(MethodBase original, ...)
Expand Down
2 changes: 1 addition & 1 deletion docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@
"output": {
".html": {
"relative_path": "articles/patching-auxilary.html",
"hash": "z8/WHg+8eVGJXkfGb5TotDQ8rYv0KaI03W1iJ6pF+G0="
"hash": "IkXRuKgA9NqU9Mp6eE61AHsONLiO0nPvT+T79s+dvN8="
}
},
"is_incremental": false,
Expand Down

0 comments on commit 5c42611

Please sign in to comment.