Skip to content

AssemblyPatcher Class

Worker class which is used for loading and patching entire folders of assemblies, or alternatively patching and loading assemblies one at a time.

C#
public class AssemblyPatcher : IDisposable

Inheritance object

Implements IDisposable

AssemblyPatcher(Func<byte[], string, Assembly>)

Section titled “AssemblyPatcher(Func<byte[], string, Assembly>)”
C#
public AssemblyPatcher(Func<byte[], string, Assembly> assemblyLoader)

assemblyLoader Func<byte[], string, Assembly>

The context of this assembly patcher instance that is passed to all patcher plugins.

C#
public PatcherContext PatcherContext { get; }

Performs work to dispose collection objects.

C#
public void Dispose()

Adds all patchers from all managed assemblies specified in a directory.

C#
public void AddPatchersFromDirectory(string directory)

directory string
Directory to search patcher DLLs from.

Adds all .dll assemblies in given directories to be patched and loaded by this patcher instance. Non-managed assemblies are skipped.

C#
public void LoadAssemblyDirectories(params string[] directories)

directories string[]
The directories to search.

LoadAssemblyDirectories(IEnumerable, IEnumerable)

Section titled “LoadAssemblyDirectories(IEnumerable, IEnumerable)”

Adds all assemblies in given directories to be patched and loaded by this patcher instance. Non-managed assemblies are skipped.

C#
public void LoadAssemblyDirectories(IEnumerable<string> directories, IEnumerable<string> assemblyExtensions)

directories IEnumerable<string>
The directory to search.

assemblyExtensions IEnumerable<string>
The file extensions to attempt to load.

TryLoadAssembly(string, out AssemblyDefinition)

Section titled “TryLoadAssembly(string, out AssemblyDefinition)”

Attempts to load a managed assembly as an AssemblyDefinition. Returns true if successful.

C#
public static bool TryLoadAssembly(string path, out AssemblyDefinition assembly)

path string
The path of the assembly.

assembly AssemblyDefinition
The loaded assembly. Null if not successful in loading.

bool

Applies patchers to all assemblies loaded into this assembly patcher and then loads patched assemblies into memory.

C#
public void PatchAndLoad()