public static void MonitorTimerCb(object sender, EventArgs args) { try { if (!IsConnected) { return; } if (TreeRoot.StatusText != _lastStatus && !string.IsNullOrEmpty(TreeRoot.StatusText)) { HBRelogApi.SetProfileStatusText(TreeRoot.StatusText); _lastStatus = TreeRoot.StatusText; } if (HeartbeatTimer.IsFinished) { HBRelogRemoteApi.Heartbeat(HbProcId); HeartbeatTimer.Reset(); } CheckWowHealth(); if (GameStats.IsMeasuring) { UpdateTooltip(); } } catch (Exception ex) { if (ex is CommunicationObjectFaultedException) { return; } if (ex is EndpointNotFoundException) { Log("Unable to connect to HBRelog"); } Logging.WriteException(ex); } }
private static void CheckWowHealth() { var wowProblem = FindWowProblem(); if (wowProblem == WowProblem.None) { return; } switch (wowProblem) { case WowProblem.Disconnected: HBRelogApi.ProfileLog("WoW has disconnected.. So lets restart WoW"); HBRelogApi.SetProfileStatusText("WoW has DCed. restarting"); break; case WowProblem.LoggedOutForTooLong: HBRelogApi.ProfileLog("Restarting wow because it was logged out for more than 40 seconds"); HBRelogApi.SetProfileStatusText("WoW was logged out for too long. restarting"); break; } TreeRoot.Shutdown(HonorbuddyExitCode.Default, true); }