CWX-mods/Live/CWX_DeSharpener/DeSharpenerPatch.cs

34 lines
726 B
C#
Raw Normal View History

2022-05-14 19:53:00 +01:00
using System;
using System.Reflection;
using Aki.Reflection.Patching;
using Aki.Reflection.Utils;
using System.Linq;
namespace CWX_DeSharpener
2022-05-14 19:53:00 +01:00
{
public class DeSharpenerPatch : ModulePatch
2022-05-14 19:53:00 +01:00
{
private static Type _targetType;
public DeSharpenerPatch()
2022-05-14 19:53:00 +01:00
{
_targetType = PatchConstants.EftTypes.Single(IsTargetType);
}
private bool IsTargetType(Type type)
{
return type.GetMethod("UpdateAmount") != null && type.GetMethod("ChangeDefaultSharpenValue") != null;
}
protected override MethodBase GetTargetMethod()
{
return _targetType.GetMethod("UpdateAmount");
}
[PatchPrefix]
private static bool PatchPrefix()
{
return false;
}
}
}