예제 #1
0
        // The recursive variant.
        static void PatchAllRecursiveInternal(this Harmony harmony, Type type)
        {
            foreach (Type child in type.GetNestedTypes())
            {
                harmony.PatchAllRecursiveInternal(child);
            }

            harmony.PatchAll(type);
        }
예제 #2
0
        /// <summary>
        /// Recursively goes through a type and its children to apply patches. Useful for structured patch definitions.
        /// </summary>
        /// <param name="harmony">The patching instance</param>
        /// <param name="type">The toplevel type</param>
        public static void PatchAllRecursive(this Harmony harmony, Type type)
        {
            harmony.PatchAllRecursiveInternal(type);

            using (ManualLogSource log = Logger.CreateLogSource(nameof(HarmonyExtensions)))
            {
                log.DevLog(harmony);
            }
        }