Пример #1
0
        /// <summary>
        ///     Loads all necessary components and starts the server.
        /// </summary>
        public void Run()
        {
            if (_running)
            {
                throw new Exception("Server is already running.");
            }

            int x, y, width, height;

            Win32.GetWindowPosition(out x, out y, out width, out height);
            Win32.SetWindowPosition(width + 5, height + 5, width, height);

            ConsoleUtil.WriteHeader($"Area Server ({Shared.Util.Version.GetVersion()})", ConsoleColor.DarkGreen);
            ConsoleUtil.LoadingTitle();

            Log.Info("Server startup requested");
            Log.Info($"Server Version {Shared.Util.Version.GetVersion()}");

            NavigateToRoot();

            // Conf
            LoadConf(Config = new AreaConf());

            // Database
            InitDatabase(Database = new AreaDatabase(), Config);

            // Start
            Server = new DefaultServer(Config.Area.Port, false);
            Server.Start();

            var server2 = new DefaultServer(11041, false);

            server2.Start();

            ConsoleUtil.RunningTitle();
            _running = true;

            Log.Info("Registering commands...");

            // Commands
            var commands = new AreaConsoleCommands();

            commands.Wait();

            Log.Info("Finished starting up server!");
        }
Пример #2
0
        /// <summary>
        /// Loads all necessary components and starts the server.
        /// </summary>
        public void Run()
        {
            if (_running)
            {
                throw new Exception("Server is already running.");
            }

            int x, y, width, height;

            GetWindowPosition(out x, out y, out width, out height);
            SetWindowPosition(width + 5, height + 5, width, height);

            ConsoleUtil.WriteHeader("Area Server", ConsoleColor.DarkGreen);
            ConsoleUtil.LoadingTitle();

            NavigateToRoot();

            // Conf
            LoadConf(Config = new AreaConf());

            // Database
            InitDatabase(Database = new AreaDatabase(), Config);

            // Start
            Server = new DefaultServer(Config.Area.Port, false);
            Server.Start();

            var Server2 = new DefaultServer(11041, false);

            Server2.Start();

            ConsoleUtil.RunningTitle();
            _running = true;

            // Commands
            var commands = new AreaConsoleCommands();

            commands.Wait();
        }