public void Run() { if (_running) throw new Exception("Server is already running."); _running = true; CliUtil.WriteHeader("Msgr Server", ConsoleColor.DarkCyan); CliUtil.LoadingTitle(); this.NavigateToRoot(); // Conf this.LoadConf(this.Conf = new MsgrConf()); // Database this.InitDatabase(this.Database = new MsgrDb(), this.Conf); // Start this.Server.Start(this.Conf.Msgr.Port); CliUtil.RunningTitle(); var cmd = new ConsoleCommands(); cmd.Wait(); }
/// <summary> /// Initializes msgr server. /// </summary> private MsgrServer() { this.Database = new MsgrDb(); this.Conf = new MsgrConf(); this.Server = new MsgrServerServer(); this.Server.Handlers = new MsgrServerHandlers(); this.Server.Handlers.AutoLoad(); }