Skip to content
Geoffrey Horsington edited this page Jan 4, 2018 · 4 revisions

Cecil.Inject Wiki

Mono.Cecil.Inject (hereafter just Cecil.Inject) is an extension library to Mono.Cecil that provides additional methods to search and manipulate methods, fields and classes. The method signatures and class hierarchy was made to mimic that of both Mono.Cecil and System.Reflection to provide a familiar and a robust API.

You can find documentation here:

In addition, if you know how to use ReiPatcherPlus, you can read the migration guide to grasp the added functionality of Cecil.Inject

Features

The methods and functionality provided by Cecil.Inject can be summarised as follows

Method/Field searching

  • Ability to search methods by name
  • Ability to search for all overloads with the specified name
  • Methods to search for a specific overload by parameter types
  • Method to find member fields by name

Injection

  • Simple API that allows to search for a fitting hook method based on the injection target and the specified search criteria
  • Ability to specify what methods to inject, how to inject and where to inject
  • Different injection ways: a simple method call; method redirection or manual IL code insertion with Mono.Cecil
  • Possibility to modify the return value of any method
  • Safe injection: Cecil.Inject makes sure the injection is possible nor produces any "impossible" IL instructions Moreover, Cecil.Inject takes in account possible instruction jumps so that branching isn't affected

Miscellaneous

  • Assembly loading
  • Quickly make a member field public or a readonly value assignable
  • Extended logging capabilities (only in DEV version)