public PatchProcessor(HarmonyInstance instance, Type type, HarmonyMethod attributes) { this.instance = instance; container = type; containerAttributes = attributes ?? new HarmonyMethod(null); prefix = containerAttributes.Clone(); postfix = containerAttributes.Clone(); transpiler = containerAttributes.Clone(); PrepareType(); patchProcessors = new List <HarmonyLib.PatchProcessor>(); foreach (var method in originals) { patchProcessors.Add(new HarmonyLib.PatchProcessor(instance.instance, method)); } if (prefix?.method != null) { patchProcessors.Do(p => p.AddPrefix(prefix.ToHarmony20())); } if (postfix?.method != null) { patchProcessors.Do(p => p.AddPostfix(postfix.ToHarmony20())); } if (transpiler?.method != null) { patchProcessors.Do(p => p.AddTranspiler(transpiler.ToHarmony20())); } }
public PatchProcessor(HarmonyInstance instance, Type type, HarmonyMethod attributes) { this.instance = instance; container = type; containerAttributes = attributes ?? new HarmonyMethod(null); prefix = containerAttributes.Clone(); postfix = containerAttributes.Clone(); transpiler = containerAttributes.Clone(); PrepareType(); }