Ejemplo n.º 1
0
        public static void DevLog(this ManualLogSource log, Harmony harmony)
        {
            foreach (MethodBase method in harmony.GetPatchedMethods())
            {
                Patches patches = Harmony.GetPatchInfo(method);
                log.DevLog(string.Format("{0}::{1} patchers:", method.DeclaringType.FullName, method.Name));

                log.DevLog(string.Join(" ", patches.Owners.ToArray()));
                LogPatchSegment(log, method, patches.Prefixes, "Prefixes:");
                LogPatchSegment(log, method, patches.Transpilers, "Transpilers:");
                LogPatchSegment(log, method, patches.Postfixes, "Postfixes:");
                LogPatchSegment(log, method, patches.Finalizers, "Postfixes:");
            }
        }
Ejemplo n.º 2
0
        static void LogPatchSegment(ManualLogSource log, MethodBase original, ReadOnlyCollection <Patch> patches, string header)
        {
            if (patches.Count == 0)
            {
                return;
            }

            log.LogInfo(header);
            for (int i = 0; i < patches.Count; ++i)
            {
                Patch patch = patches[i];

                log.DevLog(patch.GetMethod(original).FullDescription());
                log.DevLog(string.Format("[{0}] {1} {2}", patch.owner, patch.index.ToString(), patch.priority.ToString()));
            }
        }