mirror of
https://github.com/hykilpikonna/AquaDX.git
synced 2026-08-09 20:51:29 -05:00
[+] Hook force offline in DisableReboot
This commit is contained in:
parent
59839fdfa6
commit
a9c552e1d9
|
|
@ -1,12 +1,25 @@
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using AquaMai.Config.Attributes;
|
||||
using AquaMai.Core.Attributes;
|
||||
using HarmonyLib;
|
||||
using Manager.Operation;
|
||||
using MelonLoader;
|
||||
|
||||
namespace AquaMai.Mods.Fix;
|
||||
|
||||
[ConfigSection(exampleHidden: true, defaultOn: true)]
|
||||
public class DisableReboot
|
||||
{
|
||||
private static bool forceOfflineTimerExists = false;
|
||||
|
||||
public static void OnBeforePatch()
|
||||
{
|
||||
forceOfflineTimerExists = typeof(MaintenanceTimer).GetProperty(
|
||||
"ForceOfflineRemainingMinutes",
|
||||
BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) != null;
|
||||
}
|
||||
|
||||
// IsAutoRebootNeeded
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MaintenanceTimer), "IsAutoRebootNeeded")]
|
||||
|
|
@ -84,4 +97,13 @@ public class DisableReboot
|
|||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
[EnableIf(nameof(forceOfflineTimerExists))]
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MaintenanceTimer), "ForceOfflineRemainingMinutes", MethodType.Getter)]
|
||||
public static bool ForceOfflineRemainingMinutes(ref int __result)
|
||||
{
|
||||
__result = 600;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user