/// <summary>
        /// Checks the merged harmonyMethod info whether the original method is already patched with the given patch type.
        /// </summary>
        private static bool IsPatchedWithType(HarmonyMethod harmonyMethod, Type withType)
        {
            MethodInfo originalMethod = AccessTools.Method(harmonyMethod.originalType, harmonyMethod.methodName, harmonyMethod.parameter);

            Harmony.Patches patches = PatchProcessor.IsPatched(originalMethod);
            if (patches == null)
            {
                return(false);
            }

            bool DeclaredInType(Patch p) => p.patch.DeclaringType == withType;

            if (patches.Prefixes.Any(DeclaredInType) || patches.Postfixes.Any(DeclaredInType) || patches.Transpilers.Any(DeclaredInType))
            {
                return(true);
            }

            return(false);
        }