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> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Web", ConsoleColor.DarkRed); CliUtil.LoadingTitle(); // Conf this.LoadConf(this.Conf = new Conf()); // Database this.InitDatabase(this.Database = new MeliaDb(), this.Conf); // Data this.LoadData(DataToLoad.Servers, true); // Web server this.StartWebServer(); CliUtil.RunningTitle(); // Commands this.ConsoleCommands = new ConsoleCommands(); this.ConsoleCommands.Wait(); }
/// <summary> /// Loads all necessary components and starts the server. /// </summary> public void Run() { if (_running) { throw new Exception("Server is already running."); } CliUtil.WriteHeader("Web Server", ConsoleColor.DarkRed); CliUtil.LoadingTitle(); this.NavigateToRoot(); // Conf this.LoadConf(this.Conf = new WebConf()); // Database this.InitDatabase(this.Database = new AuraDb(), this.Conf); // Localization this.LoadLocalization(this.Conf); // Server this.StartWebServer(); // Scripts (after web server) this.LoadScripts(); CliUtil.RunningTitle(); _running = true; // Commands var commands = new ConsoleCommands(); commands.Wait(); }
/// <summary> /// Loads all necessary components and starts the server. /// </summary> public void Run() { if (_running) { throw new Exception("Server is already running."); } CliUtil.WriteHeader("Channel Server", ConsoleColor.DarkGreen); CliUtil.LoadingTitle(); this.NavigateToRoot(); // Conf this.LoadConf(this.Conf = new ChannelConf()); // Database this.InitDatabase(this.Database = new ChannelDb(), this.Conf); // Data this.LoadData(DataLoad.ChannelServer, false); // Localization this.LoadLocalization(this.Conf); // World this.InitializeWorld(); // Skills this.LoadSkills(); // Scripts this.LoadScripts(); // Weather this.Weather.Initialize(); // Autoban if (this.Conf.Autoban.Enabled) { this.Events.SecurityViolation += (e) => Autoban.Incident(e.Client, e.Level, e.Report, e.StackReport); } // Start this.Server.Start(this.Conf.Channel.ChannelPort); // Inter this.ConnectToLogin(true); this.StartStatusUpdateTimer(); CliUtil.WriteHeader("Channel Server [" + this.Conf.Channel.ChannelName + "]", ConsoleColor.DarkGreen); CliUtil.RunningTitle(); _running = true; // Commands this.ConsoleCommands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Channel", ConsoleColor.DarkGreen); CliUtil.LoadingTitle(); // Conf this.LoadConf(); // Database this.Database = new ChannelDb(); this.InitDatabase(this.Database); // Data this.LoadData(DataToLoad.All, true); // GM Commands this.GmCommands = new GmCommands(); // Packet handlers ChannelPacketHandler.Instance.RegisterMethods(); // World Log.Info("Initializing world..."); this.World.Initialize(); Log.Info(" done loading {0} maps.", this.World.Count); // Script manager this.ScriptManager.Initialize(); this.ScriptManager.Load(); // Get channel data var serverId = 1; var serverData = this.Data.ServerDb.FindChannel(serverId); if (serverData == null) { Log.Error("Server data not found. ({0})", serverId); CliUtil.Exit(1); } // Server this.ConnectionManager = new ConnectionManager <ChannelConnection>(serverData.Port); this.ConnectionManager.Start(); // Ready CliUtil.RunningTitle(); Log.Status("Server ready, listening on {0}.", this.ConnectionManager.Address); // Commands this.ConsoleCommands = new ConsoleCommands(); this.ConsoleCommands.Wait(); }
public static async Task Main(string[] args) { CliUtil.WriteHeader("Game & Stream", ConsoleColor.DarkGreen); CliUtil.LoadingTitle(); Initialization(); if (FileManager.FileExists(FileManager.AppPath + "Config.json")) { Configuration(args); } else { _log.Error($"{FileManager.AppPath}Config.json doesn't exist!"); return; } _log.Info("{0} version {1}", Name, Version); var connection = MySQL.CreateConnection(); if (connection == null) { LogManager.Flush(); return; } connection.Close(); // Check if there are any updates CheckDatabaseUpdates(); var builder = new HostBuilder() .ConfigureAppConfiguration((hostingContext, config) => { config.AddEnvironmentVariables(); if (args != null) { config.AddCommandLine(args); } }) .ConfigureServices((hostContext, services) => { services.AddOptions(); services.AddSingleton <IHostedService, GameService>(); }); await builder.RunConsoleAsync(); }
public void Run() { if (_running) { throw new Exception("Server is already running."); } //标题栏 CliUtil.WriteHeader("Channel Server" + DateTime.Now.ToString(), ConsoleColor.DarkGreen); CliUtil.LoadingTitle(); //配置文件 this.LoadConf(this.Conf = new ChannelConf()); //// Database //this.InitDatabase(this.Database = new ChannelDb(), this.Conf); //// Data //this.LoadData(DataLoad.ChannelServer, false); // Localization //this.LoadLocalization(this.Conf); //// World //this.InitializeWorld(); //// Skills //this.LoadSkills(); //// Scripts //this.LoadScripts(); //// Weather //this.Weather.Initialize(); //// Autoban //if (this.Conf.Autoban.Enabled) // this.Events.SecurityViolation += (e) => Autoban.Incident(e.Client, e.Level, e.Report, e.StackReport); //服务器开启 this.Server.Start(this.Conf.Channel.ChannelPort); //连接登陆服务器 this.ConnectToLogin(true); //this.StartStatusUpdateTimer(); CliUtil.RunningTitle(); _running = true; //GM操作 this.ConsoleCommands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Login", ConsoleColor.Magenta); CliUtil.LoadingTitle(); // Conf this.LoadConf(); // Database this.Database = new LoginDb(); this.InitDatabase(this.Database); // Check if there are any updates this.CheckDatabaseUpdates(); // Data this.LoadData(DataToLoad.Jobs | DataToLoad.Maps | DataToLoad.Barracks | DataToLoad.Servers | DataToLoad.StartingCities, true); // Packet handlers LoginPacketHandler.Instance.RegisterMethods(); // Get server data var serverId = 1; var serverData = this.Data.ServerDb.FindLogin(serverId); if (serverData == null) { Log.Error("Server data not found. ({0})", serverId); CliUtil.Exit(1); } // Server var mgr = new ConnectionManager <LoginConnection>(serverData.Port); mgr.Start(); // Ready CliUtil.RunningTitle(); Log.Status("Server ready, listening on {0}.", mgr.Address); // Commands this.ConsoleCommands = new LoginConsoleCommands(); this.ConsoleCommands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Channel", ConsoleColor.DarkGreen); CliUtil.LoadingTitle(); // Conf this.LoadConf(); // Database this.Database = new ChannelDb(); this.InitDatabase(this.Database); SessionFactory.Init(this.Database._connectionString); // Data this.ClientData = new ClientData(); // GM Commands this.GmCommands = new GmCommands(); // Packet handlers ChannelPacketHandler.Instance.RegisterMethods(); // World Log.Info("Initializing world..."); this.World.Initialize(); Log.Info(" done loading {0} maps.", this.World.Count); // Script manager this.ScriptManager.Initialize(); this.ScriptManager.Load(); // Server this.ConnectionManager = new ConnectionManager <ChannelConnection>(Int32.Parse(Settings.Default.ZoneServerPort)); this.ConnectionManager.Start(); // Ready CliUtil.RunningTitle(); Log.Status("Server ready, listening on {0}.", this.ConnectionManager.Address); // Commands this.ConsoleCommands = new ConsoleCommands(); this.ConsoleCommands.Wait(); }
/// <summary> /// Loads all necessary components and starts the server. /// </summary> public void Run() { if (_running) { throw new Exception("Server is already running."); } CliUtil.WriteHeader("Login Server", ConsoleColor.Magenta); CliUtil.LoadingTitle(); this.NavigateToRoot(); // Conf this.LoadConf(this.Conf = new LoginConf()); // Database this.InitDatabase(this.Database = new LoginDb(), this.Conf); // Check if there are any updates this.CheckDatabaseUpdates(); // Data this.LoadData(DataLoad.LoginServer, false); // Localization this.LoadLocalization(this.Conf); // Web API this.LoadWebApi(); // Scripts this.LoadScripts(); // Start this.Server.Start(this.Conf.Login.Port); CliUtil.RunningTitle(); _running = true; // Commands var commands = new LoginConsoleCommands(); commands.Wait(); }
public void Run() { if (_running) { throw new Exception("服务器正在运行..."); } //标题栏 CliUtil.WriteHeader("Login Server " + DateTime.Now.ToString(), ConsoleColor.Magenta); CliUtil.LoadingTitle(); //配置文件 this.LoadConf(this.Conf = new GateConf()); //// Database //this.InitDatabase(this.Database = new LoginDb(), this.Conf); //// Check if there are any updates //this.CheckDatabaseUpdates(); //// Data //this.LoadData(DataLoad.LoginServer, false); //// Localization //this.LoadLocalization(this.Conf); //// Web API //this.LoadWebApi(); //// Scripts //this.LoadScripts(); // InitGameServer(); //开启服务器 this.Server.Start("127.0.0.1", this.Conf.Gate.Port); CliUtil.RunningTitle(); _running = true; //GM操作 var commands = new GMCommands(); commands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Web", ConsoleColor.DarkRed); CliUtil.LoadingTitle(); // Conf this.LoadConf(); // Web server this.StartWebServer(); CliUtil.RunningTitle(); // Commands this.ConsoleCommands = new ConsoleCommands(); this.ConsoleCommands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Game Server", ConsoleColor.Magenta); CliUtil.LoadingTitle(); Log.Status("Starting Game Server..."); // Conf this.LoadConf(this.Conf = new GameConf()); // Database this.InitDatabase(this.ASDDatabase = new Database.ASD(), this.Conf); // Redis server this.Redis = new Redis(this.Conf.RedisHost, this.Conf.RedisPort, this.Conf.RedisPassword); // Load game data files this.LoadData(); // Packet handlers GamePacketHandler.Instance.RegisterMethods(); Log.Info("Initializing game world..."); this.World.Initialize(); Log.Info("Game world initialized with {0} maps.", this.World.Count); // Server var mgr = new ConnectionManager <GameConnection>(this.Conf.Host, this.Conf.Port); mgr.Start(); // Ready CliUtil.RunningTitle(); Log.Status("Game Server is ready, listening on {0}.", mgr.Address); // Commands this.ConsoleCommands = new GameConsoleCommands(); this.ConsoleCommands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Login", ConsoleColor.Magenta); CliUtil.LoadingTitle(); // Conf this.LoadConf(); // Database this.Database = new LoginDb(); this.InitDatabase(this.Database); SessionFactory.Init(this.Database._connectionString); // Check if there are any updates this.CheckDatabaseUpdates(); // Data this.ClientData = new ClientData(); // Packet handlers LoginPacketHandler.Instance.RegisterMethods(); // Server var mgr = new ConnectionManager <LoginConnection>(Int32.Parse(Settings.Default.LoginServerPort)); mgr.Start(); // Ready CliUtil.RunningTitle(); Log.Status("Server ready, listening on {0}.", mgr.Address); // Commands this.ConsoleCommands = new LoginConsoleCommands(); this.ConsoleCommands.Wait(); }
/// <summary> /// Starts the server. /// </summary> public override void Run() { base.Run(); CliUtil.WriteHeader("Login Server", ConsoleColor.Magenta); CliUtil.LoadingTitle(); Log.Status("Starting Login Server..."); // Conf this.LoadConf(this.Conf = new LoginConf()); // ASD Database this.InitDatabase(this.ASDDatabase = new ASD(), this.Conf); // Redis server this.Redis = new Redis(this.Conf.RedisHost, this.Conf.RedisPort, this.Conf.RedisPassword); // Remove previously logged in accounts this.Redis.ResetLoggedInAccountList(); // Packet handlers LoginPacketHandler.Instance.RegisterMethods(); // Server var mgr = new ConnectionManager <LoginConnection>(this.Conf.Host, this.Conf.Port); mgr.Start(); // Ready CliUtil.RunningTitle(); Log.Status("Login Server is ready, listening on {0}.", mgr.Address); // Commands this.ConsoleCommands = new LoginConsoleCommands(); this.ConsoleCommands.Wait(); }