示例#1
0
        private void IsConnect()
        {
            try
            {
                if (!Connection.Ping())
                {
                    Connection.Open();
                }

                if (Connection.State == ConnectionState.Broken || Connection.State == ConnectionState.Closed)
                {
                    _crash = true;
                    Log.Error("MySql", sLConsole.GetString("Sql connection crash."));
                    Log.Warning("MySql", sLConsole.GetString("Program shutting down!"));
                    SchumixBase.Quit(false);

                    foreach (var nw in INetwork.WriterList)
                    {
                        if (!nw.Value.IsNull())
                        {
                            nw.Value.WriteLine("QUIT :Sql connection crash.");
                        }
                    }

                    Thread.Sleep(1000);
                    sRuntime.Exit();
                }
            }
            catch (MySqlException m)
            {
                Crash(m, true, true);
            }
        }
示例#2
0
        /// <summary>
        ///     Quit parancs függvénye.
        /// </summary>
        protected void HandleQuit(ConsoleMessage sConsoleMessage)
        {
            var text = sLManager.GetConsoleCommandTexts("quit");

            if (text.Length < 2)
            {
                Log.Error("Console", sLConsole.Translations("NoFound2"));
                return;
            }

            Log.Notice("Console", text[0]);
            SchumixBase.Quit();
            sIrcBase.Shutdown(text[1]);
        }
示例#3
0
        protected void HandleQuit(IRCMessage sIRCMessage)
        {
            if (!IsAdmin(sIRCMessage.Nick, sIRCMessage.Host, AdminFlag.Administrator))
            {
                return;
            }

            var text = sLManager.GetCommandTexts("quit", sIRCMessage.Channel, sIRCMessage.ServerName);

            if (text.Length < 2)
            {
                sSendMessage.SendChatMessage(sIRCMessage, sLConsole.Translations("NoFound2", sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)));
                return;
            }

            sSendMessage.SendChatMessage(sIRCMessage, text[0]);
            SchumixBase.Quit();
            sIrcBase.Shutdown(string.Format(text[1], sIRCMessage.Nick));
        }
        private void CloseHandler(SchumixPacket pck, string hst)
        {
            if (SchumixBase.ExitStatus)
            {
                return;
            }

            Log.Warning("CloseHandler", sLConsole.GetString("Connection closed!"));
            Log.Warning("CloseHandler", sLConsole.GetString("Program shutting down!"));
            SchumixBase.Quit();

            foreach (var nw in INetwork.WriterList)
            {
                if (!nw.Value.IsNull())
                {
                    nw.Value.WriteLine("QUIT :Server killed.");
                }
            }

            Thread.Sleep(1000);
            sRuntime.Exit();
        }
示例#5
0
        public static void Shutdown(string Message, bool Crash = false)
        {
            System.Console.CursorVisible = true;

            if (!SchumixBot.sSchumixBase.IsNull())
            {
                bool e = false;
                foreach (var nw in sIrcBase.Networks)
                {
                    if (!sIrcBase.Networks[nw.Key].IsNull() && sIrcBase.Networks[nw.Key].Online)
                    {
                        e = true;
                    }
                }

                if (e)
                {
                    SchumixBase.Quit();
                }
                else
                {
                    sRuntime.Exit();
                }
            }
            else
            {
                sRuntime.Exit();
            }

            if (Crash && SchumixBase.ExitStatus)
            {
                return;
            }

            sIrcBase.Shutdown(Message);
        }
示例#6
0
        private void Crash(SQLiteException s, bool logerror, bool c = false)
        {
            if (c)
            {
                _crash = true;
                Log.Error("SQLite", sLConsole.GetString("Query error: {0}"), s.Message);
                Log.Warning("SQLite", sLConsole.GetString("Program shutting down!"));
                SchumixBase.Quit(false);

                foreach (var nw in INetwork.WriterList)
                {
                    if (!nw.Value.IsNull())
                    {
                        nw.Value.WriteLine("QUIT :Sql connection crash.");
                    }
                }

                Thread.Sleep(1000);
                sRuntime.Exit();
            }

            if (s.Message.Contains("Fatal error encountered during command execution."))
            {
                _crash = true;
                Log.Error("SQLite", sLConsole.GetString("Query error: {0}"), s.Message);
                Log.Warning("SQLite", sLConsole.GetString("Program shutting down!"));
                SchumixBase.Quit(false);

                foreach (var nw in INetwork.WriterList)
                {
                    if (!nw.Value.IsNull())
                    {
                        nw.Value.WriteLine("QUIT :Sql connection crash.");
                    }
                }

                Thread.Sleep(1000);
                sRuntime.Exit();
            }

            if (s.Message.Contains("Timeout expired."))
            {
                _crash = true;
                Log.Error("SQLite", sLConsole.GetString("Query error: {0}"), s.Message);
                Log.Warning("SQLite", sLConsole.GetString("Program shutting down!"));
                SchumixBase.Quit(false);

                foreach (var nw in INetwork.WriterList)
                {
                    if (!nw.Value.IsNull())
                    {
                        nw.Value.WriteLine("QUIT :Sql connection timeout.");
                    }
                }

                Thread.Sleep(1000);
                sRuntime.Exit();
            }

            if (logerror)
            {
                Log.Error("SQLite", sLConsole.GetString("Query error: {0}"), s.Message);
            }
        }