static void CommandListener() { //PrintHint(); while (true) { var cmd = Console.ReadLine(); if (cmd == "") { continue; //Skip blank line. } if (cmd.ToLower() == "relogin") { Login(); continue; } var cmdList = Tools00.ResolveCommand(cmd); if (cmdList[0].PackTotal.ToUpper() == "RUNAS") { var tempAuth = ObtainAuth(); cmdList.RemoveAt(0); ServerController.Control(tempAuth, cmdList.ToArray()); } else { ServerController.Control(Auth, cmdList.ToArray()); } //PrintHint(); } }
static void Main(string[] args) { Environment.CurrentDirectory = (new FileInfo(typeof(Program).Assembly.Location)).Directory.FullName; //Force working directory to where the program exists. { var Auth0 = CLUNL.Utilities.RandomTool.GetRandomString(32, CLUNL.Utilities.RandomStringRange.R3); var Auth1 = CLUNL.Utilities.RandomTool.GetRandomString(32, CLUNL.Utilities.RandomStringRange.R3); Auth = OperatorAuthentication.ObtainRTAuth(Auth0, Auth1); OperatorAuthentication.SetLocalHostAuth(Auth); LWMSCoreServer.FirstInit(); } Console.WriteLine("Copyright (C) 2020-2022 Creeper Lv"); Console.WriteLine("This software is licensed under the MIT License"); var _commands = Tools00.ResolveCommand(Environment.CommandLine); bool ignore_Arg = false; _commands.RemoveAt(0);//Remove start command. if (_commands.Count > 0) { if (_commands[0].PackTotal.ToUpper() == "/PREBOOT") { _commands.RemoveAt(0); LWMSCoreServer.LoadCommandsFromManifest(); ServerController.Control(Auth, _commands.ToArray()); ignore_Arg = true; } else if (_commands[0].PackTotal.ToUpper() == "/NOBOOT") { _commands.RemoveAt(0); LWMSCoreServer.LoadCommandsFromManifest(); ServerController.Control(Auth, _commands.ToArray()); return; } else { } } Console.OutputEncoding = Encoding.UTF8; Console.InputEncoding = Encoding.UTF8; LWMSTraceListener.SetProperty(Auth, 0, true); //LWMSTraceListener.BeautifyConsoleOutput = true; Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.Write("This software is in active development and extremely unstable, do not use it in production environment!"); Console.ResetColor(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("LWMS - LightWeight Managed Server"); Console.WriteLine(); Check00(); LWMSCoreServer coreServer = new LWMSCoreServer(); //coreServer.Bind("http://+:8080/"); //string p = Configuration.BasePath; coreServer.Start(8); Console.WriteLine("The server is now running good."); Login(); if (ignore_Arg == false) { if (args.Length > 0) { var cmd = new List <CommandPack>(); foreach (var item in _commands) { cmd.Add(item); } ServerController.Control(Auth, cmd.ToArray()); } } CommandListener(); }