private void RunServer()
{
if (m_restartLimit < 0)
{
return;
}
m_lastRestart = DateTime.Now;
try
{
bool result = m_serverWrapper.StartServer(m_commandLineArgs.instanceName, m_commandLineArgs.path, !m_commandLineArgs.noConsole);
m_isServerRunning = false;
m_pluginMainLoop.Stop();
m_autosaveTimer.Stop();
m_pluginManager.Shutdown();
Console.WriteLine("Server has stopped running");
/*
* if (!result)
* {
* LogManager.APILog.WriteLineAndConsole("Server crashed, attempting auto-restart ...");
*
* TimeSpan timeSinceLastRestart = DateTime.Now - m_lastRestart;
*
* //Reset the restart limit if the server has been running for more than 5 minutes before the crash
* if (timeSinceLastRestart.TotalMinutes > 5)
* m_restartLimit = 3;
*
* m_restartLimit--;
*
* m_isServerRunning = true;
* SectorObjectManager.Instance.IsShutDown = false;
*
* m_runServerThread = new Thread(new ThreadStart(this.RunServer));
* m_runServerThread.Start();
* }*/
}
catch (Exception ex)
{
LogManager.ErrorLog.WriteLine(ex);
}
}