####AssemblyPatcher
PatcherBase, SelectorBase
- Allows creation of custom patchers. (
MethodPatcher,PropertyPatcher,FieldPatcher) - Use
PatcherBaseas a starting point. - Create a marker interface to make
AddPatchtype-safe. - Create a Selector using
SelectorBaseto allow custom member selection.
IPatch, PatchBase
- Allows creation of custom patches for the Patchers. (
LogMethodNamePatch,LogMethodParametersPatch). - Use
PatchBaseas a starting point.
Custom IPatch Example
- Declaration
public interface IMethodPatch : IPatch { }
public class LogMethodNamePatch : PatchBase, IMethodPatch { }
public class LogMethodParametersPatch : PatchBase, IMethodPatch { }
- Usage
var methodPatcher = new MethodPatcher(typeof(Calculator).Module);
methodPatcher.AddPatch(new LogMethodNamePatch());
methodPatcher.AddPatch(new LogMethodParametersPatch());
methodPatcher.AppliesTo(typeof(Calculator)).AppliesTo("Add", "Sub");
methodPatcher.ApplyPatches();