예제 #1
0
 internal static void Destroy()
 {
     CyberEnvironment.isLive = false;
     Logging.WriteLine("Destroying CyberEnvironment...", ConsoleColor.Gray);
     if (CyberEnvironment.GetGame() != null)
     {
         CyberEnvironment.GetGame().Destroy();
         CyberEnvironment.GetGame().GetPixelManager().Destroy();
         CyberEnvironment.Game = null;
     }
     if (CyberEnvironment.GetConnectionManager() != null)
     {
         Logging.WriteLine("Destroying ConnectionManager...", ConsoleColor.Gray);
         CyberEnvironment.GetConnectionManager().Destroy();
     }
     if (CyberEnvironment.manager != null)
     {
         try
         {
             Logging.WriteLine("Destroying DatabaseManager...", ConsoleColor.Gray);
             CyberEnvironment.manager.Destroy();
         }
         catch
         {
         }
     }
     Logging.WriteLine("Closing...", ConsoleColor.Gray);
     Thread.Sleep(500);
     Environment.Exit(1);
 }
예제 #2
0
        internal static void PerformShutDown(bool Restart)
        {
            DateTime now = DateTime.Now;

            CyberEnvironment.ShutdownInitiated = true;
            ServerMessage serverMessage = new ServerMessage(Outgoing.SuperNotificationMessageComposer);

            serverMessage.AppendString("disconnection");
            serverMessage.AppendInt32(2);
            serverMessage.AppendString("title");
            serverMessage.AppendString("HEY EVERYONE!");
            serverMessage.AppendString("message");
            if (Restart)
            {
                serverMessage.AppendString("<b>The hotel is shutting down for a break.</b>\nYou may come back later.\r\n<b>So long!</b>");
            }
            else
            {
                serverMessage.AppendString("<b>The hotel is shutting down for a break.</b><br />You may come back soon. Don't worry, everything's going to be saved..<br /><b>So long!</b>\r\n~ This session was powered by Cyber Emulator");
            }
            CyberEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(serverMessage);
            Thread.Sleep(6000);
            CyberEnvironment.Game.StopGameLoop();
            DateTime arg_93_0 = DateTime.Now;

            Logging.WriteLine("Shutting down...", ConsoleColor.Yellow);
            Console.Title = "Cyber Emulator | Shutting down...";
            DateTime arg_AF_0 = DateTime.Now;

            CyberEnvironment.GetGame().GetClientManager().CloseAll();
            DateTime arg_C4_0 = DateTime.Now;

            CyberEnvironment.Game.GetRoomManager().RemoveAllRooms();
            foreach (Guild Group in Game.GetGroupManager().Groups.Values)
            {
                Group.UpdateForum();
            }

            CyberEnvironment.GetConnectionManager().Destroy();
            DateTime arg_E3_0 = DateTime.Now;

            using (IQueryAdapter queryreactor = CyberEnvironment.manager.getQueryReactor())
            {
                queryreactor.runFastQuery("UPDATE users SET online = '0'");
                queryreactor.runFastQuery("UPDATE rooms SET users_now = 0");
                queryreactor.runFastQuery("TRUNCATE TABLE user_roomvisits");
            }
            DateTime arg_121_0 = DateTime.Now;

            CyberEnvironment.ConnectionManager.Destroy();
            DateTime arg_131_0 = DateTime.Now;

            CyberEnvironment.Game.Destroy();
            DateTime arg_141_0 = DateTime.Now;

            try
            {
                Console.WriteLine("Destroying database manager...");
                CyberEnvironment.manager.Destroy();
            }
            catch
            {
            }
            TimeSpan span = DateTime.Now - now;

            Console.WriteLine("Cyber Emulator took " + CyberEnvironment.TimeSpanToString(span) + " in shutdown process.");
            Console.WriteLine("Cyber Emulator has shut down succesfully.");
            CyberEnvironment.isLive = false;
            if (Restart)
            {
                Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\Cyber Emulator.exe");
            }
            Console.WriteLine("Closing...");
            Environment.Exit(0);
        }