AquaDX/AquaMai/Fix/DisableReboot.cs

87 lines
2.4 KiB
C#
Raw Normal View History

2024-04-28 21:04:46 +08:00
using HarmonyLib;
using Manager.Operation;
2024-07-26 23:24:42 +08:00
namespace AquaMai.Fix
2024-04-28 21:04:46 +08:00
{
public class DisableReboot
{
// IsAutoRebootNeeded
[HarmonyPrefix]
[HarmonyPatch(typeof(MaintenanceTimer), "IsAutoRebootNeeded")]
public static bool IsAutoRebootNeeded(ref bool __result)
{
__result = false;
return false;
}
2024-07-26 23:24:42 +08:00
2024-04-28 21:04:46 +08:00
// IsUnderServerMaintenance
[HarmonyPrefix]
[HarmonyPatch(typeof(MaintenanceTimer), "IsUnderServerMaintenance")]
public static bool IsUnderServerMaintenance(ref bool __result)
{
__result = false;
return false;
}
2024-07-26 23:24:42 +08:00
2024-04-28 21:04:46 +08:00
// RemainingMinutes
2024-04-28 21:13:22 +08:00
// Original: private int RemainingMinutes => (this._secServerMaintenance + 59) / 60;
2024-04-28 21:04:46 +08:00
[HarmonyPrefix]
2024-04-28 21:13:22 +08:00
[HarmonyPatch(typeof(MaintenanceTimer), "RemainingMinutes", MethodType.Getter)]
2024-04-28 21:04:46 +08:00
public static bool RemainingMinutes(ref int __result)
{
__result = 600;
return false;
}
2024-07-26 23:24:42 +08:00
2024-04-28 21:04:46 +08:00
// GetAutoRebootSec
[HarmonyPrefix]
[HarmonyPatch(typeof(MaintenanceTimer), "GetAutoRebootSec")]
public static bool GetAutoRebootSec(ref int __result)
{
__result = 60 * 60 * 10;
return false;
}
2024-07-26 23:24:42 +08:00
2024-04-28 21:04:46 +08:00
// GetServerMaintenanceSec
[HarmonyPrefix]
[HarmonyPatch(typeof(MaintenanceTimer), "GetServerMaintenanceSec")]
public static bool GetServerMaintenanceSec(ref int __result)
{
__result = 60 * 60 * 10;
return false;
}
2024-07-26 23:24:42 +08:00
2024-04-28 21:04:46 +08:00
// Execute
[HarmonyPrefix]
[HarmonyPatch(typeof(MaintenanceTimer), "Execute")]
2024-04-28 21:13:22 +08:00
public static bool Execute(MaintenanceTimer __instance)
{
return false;
}
2024-07-26 23:24:42 +08:00
2024-04-28 21:04:46 +08:00
// UpdateTimes
[HarmonyPrefix]
[HarmonyPatch(typeof(MaintenanceTimer), "UpdateTimes")]
2024-04-28 21:13:22 +08:00
public static bool UpdateTimes(MaintenanceTimer __instance)
{
return false;
}
2024-07-26 23:24:42 +08:00
[HarmonyPrefix]
[HarmonyPatch(typeof(ClosingTimer), "IsShowRemainingMinutes")]
public static bool IsShowRemainingMinutes(ref bool __result)
{
__result = false;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ClosingTimer), "IsClosed")]
public static bool IsClosed(ref bool __result)
{
__result = false;
return false;
}
2024-04-28 21:04:46 +08:00
}
2024-07-26 23:24:42 +08:00
}