コード例 #1
0
        public static GameWorld World;          //Handles Physics simulations, entity AI, ingame interactions etc

        static void Main(string[] args)
        {
            //Fetch the local IPv4 address of the current machine being used to host the server
            string LocalIP = IPAddressGetter.GetLocalIPAddress();

            //Create an instance of Program and use that to start up the whole server application inside it
            Application = new Program();
            if (Application.StartServer(LocalIP))
            {
                Application.RunServer();
                Application.StopServer();
            }

            //Save and close the message output .log file before the application closes completely
            MessageLog.Close();
        }
コード例 #2
0
        //Tries using the command arguments for performing a server shutdown
        private void TryServerShutdown(string[] Input)
        {
            //Log what is happening here
            MessageLog.Print("Server shutting down...");

            //Get a list of all ingame clients who are logged in and playing right now
            List <ClientConnection> ActiveClients = ClientSubsetFinder.GetInGameClients();

            //Loop through all the active players and backup their data
            foreach (ClientConnection ActiveClient in ActiveClients)
            {
                CharactersDatabase.SaveCharacterData(ActiveClient.Character);
            }

            //Close and save the current log file
            MessageLog.Close();

            //Close the application
            Program.ApplicationWindow.Close();
        }