Skip to content

Commit f513a3f

Browse files
committed
refactor(Patches): improve code clarity with comments in transpiler patches
- Added comments in `RunHistoryMissingModelDbGetByIdTranspilerPatch.cs` and `HarmonyIlRewriter.cs` to clarify the purpose of specific code sections, enhancing maintainability and readability. - Removed unused namespace reference in `ModPatcher.cs`, streamlining the codebase.
1 parent 350d452 commit f513a3f

3 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lifecycle/Patches/RunHistoryMissingModelDbGetByIdTranspilerPatch.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructio
6666
{
6767
if (IsModelDbGetByIdFor(called, typeof(CharacterModel)))
6868
return CharacterFallback;
69+
// ReSharper disable once ConvertIfStatementToReturnStatement
6970
if (IsModelDbGetByIdFor(called, typeof(ActModel)))
7071
return ActFallback;
7172
return null;

Patching/Core/ModPatcher.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Text;
33
using HarmonyLib;
44
using MegaCrit.Sts2.Core.Logging;
5-
using STS2RitsuLib;
65
using STS2RitsuLib.Patching.Models;
76

87
namespace STS2RitsuLib.Patching.Core

Utils/HarmonyIl/HarmonyIlRewriter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ public HarmonyIlRewriteReport RedirectCalls(
365365
var before = _code.Count;
366366
var matches = 0;
367367
var applied = 0;
368+
// ReSharper disable once ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
368369
foreach (var instruction in _code)
369370
{
370371
if (instruction.opcode != OpCodes.Call && instruction.opcode != OpCodes.Callvirt)

0 commit comments

Comments
 (0)