예제 #1
0
파일: Server.cs 프로젝트: thomotron/Phinix
        /// <summary>
        /// Handles save events.
        /// Used by <see cref="saveTimer"/> to save each module state periodically.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void saveHandler(object sender, ElapsedEventArgs e)
        {
            Logger.Log(Verbosity.INFO, "Saving module states...");

            // Save module states
            Authenticator.Save(Config.CredentialDatabasePath);
            UserManager.Save(Config.UserDatabasePath);
            Chat.Save(Config.ChatHistoryPath);
            Trading.Save(Config.TradeDatabasePath);

            // Save config too
            Config.Save(CONFIG_FILE);

            Logger.Log(Verbosity.INFO, "Saved module states");
        }
예제 #2
0
파일: Server.cs 프로젝트: Maatss/Phinix
        /// <summary>
        /// Handles server shutdown events.
        /// Used to safely save and shut down modules before closing.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void shutdownHandler(object sender = null, EventArgs e = null)
        {
            Logger.Log(Verbosity.INFO, "Server shutting down");

            // Log everyone out
            UserManager.LogOutAll();

            // Close all connections
            Connections.Stop();

            // Save module states
            Authenticator.Save(Config.CredentialDatabasePath);
            UserManager.Save(Config.UserDatabasePath);
            Chat.Save(Config.ChatHistoryPath);
            Trading.Save(Config.TradeDatabasePath);

            // Save the config
            Config.Save(CONFIG_FILE);

            // Exit the main run loop
            exiting = true;
        }