private static int RunServer(string[] args) { if (!mutex.WaitOne(TimeSpan.Zero, true)) { Console.WriteLine(AppName + ": already running"); return(-1); } SdmCore.Initialize(AppType.Server); var cfg = new ServerConfig(true); CmdMgr = new CommandManager(); using (Server = new Server(cfg)) { using (var pcs = new PipeConsoleServer(CmdMgr.HandleCommand)) { Server.Connect(cfg.Address, cfg.Port); while (Server.Connected) { Thread.Sleep(cfg.UpdateSleep); Server.Update(); } } } SdmCore.Destroy(); mutex.ReleaseMutex(); return(0); }
private static void Main() { SdmCore.Initialize(AppType.Client); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(AppController.Instance); AppController.Instance.Config.Save(); SdmCore.Destroy(); }