private static void AutoRestart()
 {
     log.Info("Auto-Restarter started...");
     Thread.Sleep(5000);
     ChatManager cm = new ChatManager(manager);
     Thread.Sleep(6900000);
     cm.IngameAnnounce("Server will be auto-restarted in 5 minutes, please exit the game to prevent account in use!");
     Thread.Sleep(60000);
     cm.Announce("Server will be auto-restarted in 4 minutes, please exit the game to prevent account in use!");
     Thread.Sleep(60000);
     cm.Announce("Server will be auto-restarted in 3 minutes, please exit the game to prevent account in use!");
     Thread.Sleep(60000);
     cm.Announce("Server will be auto-restarted in 2 minutes, please exit the game to prevent account in use!");
     Thread.Sleep(60000);
     cm.Announce("Server will be auto-restarted in 1 minute, please exit the game to prevent account in use!");
     Thread.Sleep(50000);
     cm.Announce("Server will be auto-restarted in 10 seconds, please exit the game to prevent account in use!");
     Thread.Sleep(10000);
     System.Diagnostics.Process.Start("wServer.exe");
     Thread.Sleep(1);
     closeserv();
 }
Example #2
0
        private static void AutoBroadcaster()
        {
            var news = File.ReadAllLines("news.txt");

            while (true)
            {
                ChatManager chat = new ChatManager(manager);
                string      text = news[new Random().Next(news.Length)];
                if (text.StartsWith("#"))
                {
                    chat.Announce(text.TrimStart('#'));
                }
                else
                {
                    chat.News(text);
                }
                Thread.Sleep(1 * 60 * 1000);
            }
        }
Example #3
0
        private static void AutoNotify()
        {
            int uptime = 0;

            while (true)
            {
                ChatManager cm = new ChatManager(manager);
                if ((uptime < 55) && (uptime >= 0))
                {
                    uptime += 1;
                    Thread.Sleep(1 * (60 * 1000));
                }
                else if ((uptime >= 55) && (uptime <= 59))
                {
                    cm.Announce("This server going to restart in 5 minutes.");
                    Thread.Sleep(1 * (60 * 1000));
                    uptime += 1;
                }
            }
        }