Exemplo n.º 1
0
 protected override void OnStop()
 {
     PluginManager.Stop();
     WebServer.Stop();
     ServerManager.Stop();
     WorldManager.Stop();
     VersionManager.Stop();
     UpdateManager.Stop();
     PortManager.Stop();
     FirewallManager.RemoveFirewallExecutableException("MainService");
     UserMessageManager.SaveConfiguration();
     CurrentSettings.SaveConfiguration();
     if (exitCode == 0)
     {
         Logger.FinishLog();
     }
     else
     {
         Environment.Exit(exitCode);
     }
 }
Exemplo n.º 2
0
        private void StartLogDeletionTimer()
        {
            SaveManagementTimer          = new Timer();
            SaveManagementTimer.Interval = 15 * 60 * 1000;
            SaveManagementTimer.Elapsed += (x, y) => {
                ServerManager.SaveConfigurations();
                WorldManager.SaveConfigurations();
                UserMessageManager.SaveConfiguration();

                if (CurrentSettings.LogDeletionTimespan == default)
                {
                    return;
                }
                foreach (LogFileInformation info in GetAllLogFiles())
                {
                    if (info.CreationDate + CurrentSettings.LogDeletionTimespan < DateTime.Now)
                    {
                        DeleteLogFile(info);
                    }
                }
            };
            SaveManagementTimer.Start();
        }