private static Exception SaveGameMenu_UpdateFinalizer(SaveGameMenu __instance, Exception __exception) { if (__exception != null) { SaveGamePatch.Monitor.Log($"Failed during SaveGameMenu.update method :\n{__exception.InnerException ?? __exception}", LogLevel.Error); __instance.complete(); Game1.addHUDMessage(new HUDMessage("An error occurs during save the game.Check the error log for details.", HUDMessage.error_type)); } return(null); }
private static bool SaveGameMenu_UpdatePrefix(SaveGameMenu __instance, GameTime time, MethodInfo __originalMethod) { const string key = nameof(SaveGamePatch.SaveGameMenu_UpdatePrefix); if (!PatchHelper.StartIntercept(key)) { return(true); } try { __originalMethod.Invoke(__instance, new object[] { time }); } catch (Exception ex) { SaveGamePatch.Monitor.Log($"Failed during SaveGameMenu.update method :\n{ex.InnerException ?? ex}", LogLevel.Error); __instance.complete(); Game1.addHUDMessage(new HUDMessage("An error occurs during save the game.Check the error log for details.", HUDMessage.error_type)); } finally { PatchHelper.StopIntercept(key); } return(false); }