private void DebugCheck() { if (!MelonDebug.IsEnabled()) { return; } PatchInfo patchInfo = Original.GetPatchInfo(); Patch basePatch = ((patchInfo.prefixes.Count() > 0) ? patchInfo.prefixes.First() : ((patchInfo.postfixes.Count() > 0) ? patchInfo.postfixes.First() : ((patchInfo.transpilers.Count() > 0) ? patchInfo.transpilers.First() : ((patchInfo.finalizers.Count() > 0) ? patchInfo.finalizers.First() : null)))); string melonName = FindMelon(melon => ((basePatch != null) && melon.HarmonyInstance.Id.Equals(basePatch.owner))); if ((melonName == null) && (basePatch != null)) { // Patching using a custom Harmony instance; try to infer the melon assembly from the container type, prefix, postfix, or transpiler. Assembly melonAssembly = basePatch.PatchMethod.DeclaringType?.Assembly; if (melonAssembly != null) { melonName = FindMelon(melon => melon.Assembly == melonAssembly); } } WarnIfHasTranspiler(patchInfo, melonName); WarnIfOriginalMethodIsInlined(melonName); }
public static bool IsDebugMode() => MelonDebug.IsEnabled();