static void Main(string[] args) { ProcessCommandLine(args); // Start console logging. Log.Start(ManagerConfig.LogLevel, new LogFile(ManagerConfig.LogDirectory, ManagerConfig.LogConsoleFile)); Helper.PrintHeader(serverName); using (var consolePipeServer = new IPCServer(ManagerConfig.ServiceConsoleName)) { consolePipeServer.Listen(); // Register pipe message handlers. IPCPacketManager.DefineMessageHandler(); // Register console commands. ConsoleCommandManager.InitializeCommands(); Log.Message(LogTypes.Info, $"{serverName} successfully started."); // Listen for console commands. ConsoleCommandManager.StartCommandHandler(); } }
static void Main(string[] args) { ProcessCommandLine(args); // Start console logging. Log.Start(StsConfig.LogLevel, new LogFile(StsConfig.LogDirectory, StsConfig.LogConsoleFile)); using (ConsoleService = new ConsoleServicePipeClient(StsConfig.ServiceConsoleServer, StsConfig.ServiceConsolServerPipe)) { IPCPacketManager.DefineMessageHandler(); // Start listening for incoming ipc packets. ConsoleService.Process(); // Register console to ServerManager. ConsoleService.Send(new RegisterConsole { Alias = Alias.Value }).GetAwaiter().GetResult(); Database.Auth.Initialize(new ConnectorSettings { ApiHost = $"http://{StsConfig.ApiHost}:{StsConfig.ApiPort}/api/Auth", ConnectionMode = ConnectionMode.Api, DatabaseType = DatabaseType.MySql, // Assign JSON serialize/deserialize functions (Newtonsoft.Json). ApiSerializeFunction = JsonConvert.SerializeObject, ApiDeserializeFunction = JsonConvert.DeserializeObject <object[][]> }); ConsoleCommandManager.InitializeCommands(); // Successfully started. ConsoleService.Send(new ProcessStateInfo { State = PipeProcessState.Started, Alias = Alias.Value }).GetAwaiter().GetResult(); // Listen for console commands. ConsoleCommandManager.StartCommandHandler(); } }