private void HandleTimerMemory(object sender, ElapsedEventArgs e) { if (ShutdownConfig.MaxMemory == 0) { return; } int ircnetwork = IRCConfig.List.Count > 1 ? 40 * IRCConfig.List.Count : 0; if ((MemorySizeInMB >= ShutdownConfig.MaxMemory && IRCConfig.List.IsNull()) || MemorySizeInMB >= ShutdownConfig.MaxMemory + ircnetwork) { Log.Warning("Runtime", sLConsole.GetString("The program, more than {0} MB consumed!"), ShutdownConfig.MaxMemory + ircnetwork); Log.Warning("Runtime", sLConsole.GetString("Program shutting down!")); if (!IRCConfig.List.IsNull()) { SchumixBase.Quit(); foreach (var nw in INetwork.WriterList) { if (!nw.Value.IsNull()) { nw.Value.WriteLine("QUIT :Memory over-consumption."); } } Thread.Sleep(1000); } Exit(); } }
/// <summary> /// Indulási függvény. /// </summary> public SchumixBot() { try { Log.Notice("SchumixBot", sLConsole.GetString("Successfully started SchumixBot.")); Log.Debug("SchumixBot", sLConsole.GetString("Network starting...")); string eserver = sIrcBase.FirstStart(); sSchumixBase = new SchumixBase(); sIrcBase.Start(eserver); Log.Debug("SchumixBot", sLConsole.GetString("Console starting...")); new ScriptManager(ScriptsConfig.Directory); new Console.Console(eserver); } catch(Exception e) { Log.Error("SchumixBot", sLConsole.GetString("Failure details: {0}"), e.Message); } }