public static void Deploy()
 {
     if (_deployed)
     {
         return;
     }
     _state = RedirectionHelper.RedirectCalls(MethodInfo, DetourInfo);
     _deployed = true;
 }
 public static void Deploy()
 {
     if (_deployed)
     {
         return;
     }
     _state = RedirectionHelper.RedirectCalls(Original, Detour);
     _deployed = true;
 }
        public static void Deploy()
        {
            if (!deployed)
            {
                _BuildingManager_CreateBuilding_original = typeof(BuildingManager).GetMethod("CreateBuilding", BindingFlags.Instance | BindingFlags.Public);
                _BuildingManager_CreateBuilding_detour = typeof(BuildingManagerDetour).GetMethod("CreateBuilding", BindingFlags.Instance | BindingFlags.Public);
                _BuildingManager_CreateBuilding_state = RedirectionHelper.RedirectCalls(_BuildingManager_CreateBuilding_original, _BuildingManager_CreateBuilding_detour);

                deployed = true;

                Debug.Log("LargerFootprints: BuildingManager Methods detoured!");
            }
        }
        public static void Deploy()
        {
            if (!deployed)
            {
                _BuildingDecoration_LoadDecorations_original = typeof(BuildingDecoration).GetMethod("LoadDecorations", BindingFlags.Static | BindingFlags.Public);
                _BuildingDecoration_LoadDecorations_detour = typeof(BuildingDecorationDetour).GetMethod("LoadDecorations", BindingFlags.Static | BindingFlags.Public);
                _BuildingDecoration_LoadDecorations_state = RedirectionHelper.RedirectCalls(_BuildingDecoration_LoadDecorations_original, _BuildingDecoration_LoadDecorations_detour);

                _BuildingDecoration_SaveDecorations_original = typeof(BuildingDecoration).GetMethod("SaveDecorations", BindingFlags.Static | BindingFlags.Public);
                _BuildingDecoration_SaveDecorations_detour = typeof(BuildingDecorationDetour).GetMethod("SaveDecorations", BindingFlags.Static | BindingFlags.Public);
                _BuildingDecoration_SaveDecorations_state = RedirectionHelper.RedirectCalls(_BuildingDecoration_SaveDecorations_original, _BuildingDecoration_SaveDecorations_detour);

                deployed = true;

                Debug.Log("LargerFootprints: BuildingDecoration Methods detoured!");
            }
        }
			public Detour(MethodInfo originalMethod, MethodInfo customMethod) {
				this.OriginalMethod = originalMethod;
				this.CustomMethod = customMethod;
				this.Redirect = RedirectionHelper.RedirectCalls(originalMethod, customMethod);
			}
Ejemplo n.º 6
0
 public Detour(MethodInfo originalMethod, MethodInfo customMethod)
 {
     this.OriginalMethod = originalMethod;
     this.CustomMethod   = customMethod;
     this.Redirect       = RedirectionHelper.RedirectCalls(originalMethod, customMethod);
 }
Ejemplo n.º 7
0
        /*private static MethodInfo createNode_prefix = typeof(NetToolPatch).GetMethod("CreateNode_prefix", BindingFlags.NonPublic);
         * private static MethodInfo createNode_postfix = typeof(NetToolPatch).GetMethod("CreateNode_postfix", BindingFlags.NonPublic);
         * private static MethodInfo createNode_patch = typeof(NetToolPatch).GetMethod("CreateNode_postfix", BindingFlags.NonPublic);
         *
         * public static void Patch(HarmonyInstance _harmony)
         * {
         *  _harmony.Patch(createNode_original, new HarmonyMethod(createNode_prefix), new HarmonyMethod(createNode_postfix));
         * }
         *
         * public static void Unpatch(HarmonyInstance _harmony)
         * {
         *  _harmony.Unpatch(createNode_original, createNode_prefix);
         *  _harmony.Unpatch(createNode_original, createNode_postfix);
         * }*/

        public static void Patch()
        {
            state = RedirectionHelper.RedirectCalls(createNode_original, patch);
        }