예제 #1
0
        /// <summary>
        /// Disconnect the client from the server
        /// </summary>
        public void Disconnect()
        {
            foreach (ChatBot bot in bots)
            {
                bot.OnDisconnect(ChatBot.DisconnectReason.ConnectionLost, "Disconnected");
            }

            botsOnHold.Clear();
            botsOnHold.AddRange(bots);

            if (handler != null)
            {
                handler.Disconnect();
                handler.Dispose();
            }

            if (cmdprompt != null)
            {
                cmdprompt.Abort();
            }

            if (timeoutdetector != null)
            {
                timeoutdetector.Abort();
                timeoutdetector = null;
            }

            Thread.Sleep(1000);

            if (client != null)
            {
                client.Close();
            }
        }
예제 #2
0
        /// <summary>
        /// Disconnect the client from the server
        /// </summary>

        public void Disconnect()
        {
            foreach (ChatBot bot in bots)
            {
                if (bot is ChatBots.Script)
                {
                    scripts_on_hold.Add((ChatBots.Script)bot);
                }
            }

            if (handler != null)
            {
                handler.Disconnect();
                handler.Dispose();
            }

            if (cmdprompt != null)
            {
                cmdprompt.Abort();
            }

            Thread.Sleep(1000);

            if (client != null)
            {
                client.Close();
            }
        }
        /// <summary>
        /// Disconnect the client from the server
        /// </summary>
        public void Disconnect()
        {
            botsOnHold.Clear();
            botsOnHold.AddRange(bots);

            if (handler != null)
            {
                handler.Disconnect();
                handler.Dispose();
            }

            if (cmdprompt != null)
            {
                cmdprompt.Abort();
            }

            if (timeoutdetector != null)
            {
                timeoutdetector.Abort();
            }

            Thread.Sleep(1000);

            if (client != null)
            {
                client.Close();
            }
        }