Exemple #1
0
        private static bool DoDetour(Type rimworld, Type mod, string method)
        {
            MethodInfo RimWorld_A = rimworld.GetMethod(method, UniversalBindingFlags);
            MethodInfo ModTest_A  = mod.GetMethod(method, UniversalBindingFlags);

            if (!Detours.TryDetourFromTo(RimWorld_A, ModTest_A))
            {
                return(false);
            }
            return(true);
        }
Exemple #2
0
        private static bool DoInject()
        {
            String targetMethod  = "DoConfigInterface";
            String replaceMethod = "DoConfigInterface";

            MethodInfo RimWorld_Bill_Production_Draw = typeof(RimWorld.Bill_Production).GetMethod(targetMethod, UniversalBindingFlags); // new [] { typeof(Rect), typeof(Color) }
            MethodInfo ModTest_Bill_Production_Draw  = typeof(Bill_ProductionMod).GetMethod(replaceMethod, UniversalBindingFlags);

            if (RimWorld_Bill_Production_Draw == null)
            {
                Log.Error("F**k");
            }

            if (!Detours.TryDetourFromTo(RimWorld_Bill_Production_Draw, ModTest_Bill_Production_Draw))
            {
                return(false);
            }

            return(true);
        }