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();
        }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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();
            }
        }
Exemple #4
0
        public static void Reset()
        {
            instance = null;

            Toolkit.client = Instance;
        }
Exemple #5
0
 public void Reconnect()
 {
     ToolkitIRC.Reset();
 }
Exemple #6
0
 public void Reconnect()
 {
     ToolkitIRC.NewInstance();
 }