Class AssemblyPatcher
Worker class which is used for loading and patching entire folders of assemblies, or alternatively patching and loading assemblies one at a time.
Syntax
public class AssemblyPatcher : IDisposable
Constructors
Declaration
public AssemblyPatcher(Func<byte[], string, Assembly> assemblyLoader)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Byte[], System.String, System.Reflection.Assembly> |
assemblyLoader |
Properties
The context of this assembly patcher instance that is passed to all patcher plugins.
Declaration
public PatcherContext PatcherContext { get; }
Property Value
Type | Description |
---|---|
PatcherContext |
Methods
Adds all patchers from all managed assemblies specified in a directory.
Declaration
public void AddPatchersFromDirectory(string directory)
Parameters
Type | Name | Description |
---|---|---|
System.String |
directory |
Directory to search patcher DLLs from. |
Performs work to dispose collection objects.
Declaration
public void Dispose()
Adds all assemblies in given directories to be patched and loaded by this patcher instance. Non-managed assemblies are skipped.
Declaration
public void LoadAssemblyDirectories(IEnumerable<string> directories, IEnumerable<string> assemblyExtensions)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> |
directories |
The directory to search. |
System.Collections.Generic.IEnumerable<System.String> |
assemblyExtensions |
The file extensions to attempt to load. |
Adds all .dll assemblies in given directories to be patched and loaded by this patcher instance. Non-managed assemblies are skipped.
Declaration
public void LoadAssemblyDirectories(params string[] directories)
Parameters
Type | Name | Description |
---|---|---|
System.String[] |
directories |
The directories to search. |
Applies patchers to all assemblies loaded into this assembly patcher and then loads patched assemblies into memory.
Declaration
public void PatchAndLoad()
Attempts to load a managed assembly as an
Declaration
public static bool TryLoadAssembly(string path, out AssemblyDefinition assembly)
Parameters
Type | Name | Description |
---|---|---|
System.String |
path |
The path of the assembly. |
AssemblyDefinition |
assembly |
The loaded assembly. Null if not successful in loading. |
Returns
Type | Description |
---|---|
System.Boolean |