private void ButtonStop_Click(object sender, EventArgs e) { worldServer.Dispose(); ButtonStop.Enabled = false; ButtonStart.Enabled = true; Log("World server stopped."); }
// Clean up all active socket before closing the server static bool ConsoleEventCallback(int eventType) { if (eventType == 2) { WorldServer.Dispose(); } return(false); }
static void Main(string[] args) { m_Handler = new ConsoleEventDelegate(ConsoleEventCallback); SetConsoleCtrlHandler(m_Handler, true); WorldServer = new WorldServer(); Console.ReadLine(); WorldServer.Dispose(); }