static void Main(string[] args) { CultureInfo info = CultureInfo.CreateSpecificCulture("en-US"); Thread.CurrentThread.CurrentCulture = info; if (args.Length == 0) { PrintUsage(); return; } if (args.Length == 2) { m_configDir = args[1]; if (!(m_configDir.EndsWith("\\") || m_configDir.EndsWith("/"))) { m_configDir += "/"; } DirectoryInfo dir; try { dir = new DirectoryInfo(m_configDir); } catch (FormatException) { Console.WriteLine("'" + m_configDir + "' is not a valid directory."); return; } if (dir.Exists == false) { try { dir.Create(); } catch (IOException e) { Console.WriteLine(e.Message); return; } } } if (args[0].StartsWith("-l")) { if (!StartLoginServer()) { return; } while (true) { string str = Console.ReadLine(); if (str == "quit" || str == "shutdown") { break; } else if (str == "clients") { Console.WriteLine("LoginServer clients: " + LoginServer.CurrentUsers); } else if (str == "reload loginscripts") { LoginServer.ReloadScripts(); } else if (str == "reload worldscripts") { if (localWorldServerStarted) { WorldServer.ReloadScripts(); } } } StopLoginServer(); } else if (args[0].StartsWith("-r")) { if (!StartRealmListServer()) { Console.WriteLine("Failed to start realm list server."); return; } while (true) { string str = Console.ReadLine(); if (str == "quit" || str == "shutdown") { break; } } RealmListServer.Instance.Stop(); } else if (args[0].StartsWith("-w")) { if (StartWorldServer() == false) { Console.WriteLine("Failed to start worldserver."); return; } while (true) { string str = Console.ReadLine(); if (str == "quit" || str == "shutdown") { break; } else if (str == "reload worldscripts") { WorldServer.ReloadScripts(); } else if (str == "restart") { if (WorldServer.ServerRunning) { Console.WriteLine("Worldserver is still running."); continue; } if (StartWorldServer() == false) { Console.WriteLine("Failed to start worldserver."); } } } WorldServer.Stop(); } else { PrintUsage(); } }
private void reloadLoginMENU_Click(object sender, System.EventArgs e) { MessageBox.Show("LoginServer Scripts Reloaded"); LoginServer.ReloadScripts(); }
static void Main(string[] args) { Console.WriteLine("iWoW by TheBlackMage and FearTheMurloc Development Team."); Console.WriteLine("This project is released under the GPL."); // Console.SetOut(new StreamWriter("console.log")); CultureInfo info = CultureInfo.CreateSpecificCulture("en-US"); Thread.CurrentThread.CurrentCulture = info; if (args.Length == 0) { PrintUsage(); return; } if (args.Length == 2) { m_configDir = args[1]; if (!(m_configDir.EndsWith("\\") || m_configDir.EndsWith("/"))) { m_configDir += "/"; } DirectoryInfo dir; try { dir = new DirectoryInfo(m_configDir); } catch (FormatException) { Console.WriteLine("'" + m_configDir + "' is not a valid directory."); return; } if (dir.Exists == false) { try { dir.Create(); } catch (IOException e) { Console.WriteLine(e.Message); return; } } } if (args[0].StartsWith("-l")) { if (args[0] == "-lr") { Console.WriteLine("Waiting for other server to close before we start a new one!"); Thread.Sleep(5000); } if (!StartLoginServer()) { return; } m_restartthread = new Thread(new ThreadStart(RestartLoop)); m_restartthread.Start(); while (true) { string str = Console.ReadLine(); if (str.ToLower() == "quit" || str.ToLower() == "shutdown") { break; } else if (str == "clients") { Console.WriteLine("LoginServer clients: " + LoginServer.CurrentUsers); } else if (str.ToLower() == "reload loginscripts" || str.ToLower() == "rl") { Console.WriteLine("Reloading Loginscripts..."); LoginServer.ReloadScripts(); } else if (str.ToLower() == "reload worldscripts" || str.ToLower() == "rw") { Console.WriteLine("Reloading Worldscripts..."); if (localWorldServerStarted) { WorldServer.ReloadScripts(); } } else if (str.ToLower() == "restart") { LoginServer.RestartServer = true; } } m_restartthread.Abort(); m_restartthread = null; StopLoginServer(); } else if (args[0].StartsWith("-r")) { if (!StartRealmListServer()) { Console.WriteLine("Failed to start realm list server."); return; } while (true) { string str = Console.ReadLine(); if (str == "quit" || str == "shutdown") { break; } } RealmListServer.Instance.Stop(); } else if (args[0].StartsWith("-w")) { if (StartWorldServer() == false) { Console.WriteLine("Failed to start worldserver."); return; } while (true) { string str = Console.ReadLine(); if (str == "quit" || str == "shutdown") { break; } else if (str == "reload worldscripts") { WorldServer.ReloadScripts(); } else if (str == "restart") { if (WorldServer.ServerRunning) { Console.WriteLine("Worldserver is still running."); continue; } if (StartWorldServer() == false) { Console.WriteLine("Failed to start worldserver."); } } } WorldServer.Stop(); } else { PrintUsage(); } }