public static void Run()
{
InitializeLogging ();
if (!File.Exists (ConfigPath)) {
log.WarnFormat ("Config file '{0}' was not found, using defaults", ConfigPath);
}
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
#if LINUX || MACOSX
UnixSignal.RegisterHandler (Signum.SIGTERM, OnSignal);
UnixSignal.RegisterHandler (Signum.SIGINT, OnSignal);
UnixSignal.Start ();
#else
Application.EnableVisualStyles ();
Application.SetCompatibleTextRenderingDefault (false);
#endif
server = new Server (Name);
server.UserLogin += OnUserLogin;
server.UserLogout += OnUserLogout;
server.Port = Port;
server.IsPublished = IsPublished;
server.Collision += OnCollision;
db = new Database (Name);
server.AddDatabase (db);
server.MaxUsers = MaxUsers;
server.TrackRequested += OnTrackRequested;
log.Info ("Server name: " + Name);
PluginManager.LoadPlugins (PluginNames);
#if LINUX
if (Inotify.Enabled) {
Inotify.Start ();
}
#endif
AddUsers ();
try {
lock (server) {
server.Commit ();
server.Start ();
}
} catch (Exception e) {
LogError ("Failed to start server", e);
Shutdown ();
}
RunLoop ();
Shutdown ();
}