public static void NewInstance() { if (!Helper.ModActive || Current.Game == null) { return; } if (instance != null) { Helper.Log("Previous instance exists, trying to destroy"); instance.Disconnect(); instance = null; } Instance = new ToolkitIRC(); }
public override void GameComponentTick() { if (!Helper.ModActive) { return; } if (!openedInstall && ToolkitSettings.FirstTimeInstallation) { openedInstall = true; Window_Install window = new Window_Install(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } if (!autoReconnect || Find.TickManager.TicksGame % reconnectTime != 0) { return; } reconnectTime = 2500; if (ToolkitSettings.AutoConnect && Toolkit.client == null) { ToolkitIRC.Reset(); } else if (Toolkit.client != null && !Toolkit.client.Connected) { Helper.Log("Disconnect detected, attempting reconnect"); ToolkitIRC.Reset(); } else if (Ticker.LastIRCPong != 0 && TimeHelper.SecondsElapsed(DateTime.FromFileTime(Ticker.LastIRCPong)) > reconnectInterval) { Helper.Log($"Has been over {reconnectInterval} seconds since last message from server, reconnecting"); ToolkitIRC.Reset(); } }
public override void GameComponentTick() { if (!autoReconnect || Find.TickManager.TicksGame % reconnectTime != 0) { return; } reconnectTime = 2500; if (ToolkitSettings.AutoConnect && Toolkit.client == null) { ToolkitIRC.NewInstance(); } else if (Toolkit.client != null && !Toolkit.client.Connected) { Helper.Log("Disconnect detected, attempting reconnect"); ToolkitIRC.NewInstance(); } else if (Ticker.LastIRCPong != 0 && TimeHelper.SecondsElapsed(DateTime.FromFileTime(Ticker.LastIRCPong)) > reconnectInterval) { Helper.Log($"Has been over {reconnectInterval} seconds since last message from server, reconnecting"); ToolkitIRC.NewInstance(); } }
public static void Reset() { instance = null; Toolkit.client = Instance; }
public void Reconnect() { ToolkitIRC.Reset(); }
public void Reconnect() { ToolkitIRC.NewInstance(); }