PatcherPlugin.cs 1011 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using Mono.Cecil;
  4. namespace BepInEx.Preloader.Patching
  5. {
  6. /// <summary>
  7. /// A single assembly patcher.
  8. /// </summary>
  9. internal class PatcherPlugin
  10. {
  11. public TypeDefinition Type { get; set; }
  12. /// <summary>
  13. /// Target assemblies to patch.
  14. /// </summary>
  15. public Func<IEnumerable<string>> TargetDLLs { get; set; } = null;
  16. /// <summary>
  17. /// Initializer method that is run before any patching occurs.
  18. /// </summary>
  19. public Action Initializer { get; set; } = null;
  20. /// <summary>
  21. /// Finalizer method that is run after all patching is done.
  22. /// </summary>
  23. public Action Finalizer { get; set; } = null;
  24. /// <summary>
  25. /// The main patcher method that is called on every DLL defined in <see cref="TargetDLLs" />.
  26. /// </summary>
  27. public AssemblyPatcherDelegate Patcher { get; set; } = null;
  28. /// <summary>
  29. /// Name of the patcher.
  30. /// </summary>
  31. public string Name { get; set; } = string.Empty;
  32. }
  33. }