예제 #1
0
        static void Main(string[] args)
        {
            Log.Info("LobbyServer", "Starting...");
            if (!EasyServer.InitLog("Lobby", "Configs/Logs.conf") || !EasyServer.InitConfig("Configs/Lobby.xml", "Lobby") || !EasyServer.InitConfig("Configs/Database.xml", "Database"))
            {
                return;
            }
            if (!EasyServer.Listen <TcpServer>(EasyServer.GetConfValue <int>("Lobby", "LoginServer", "Port"), "LoginServer"))
            {
                return;
            }
            worldListener = new World.Listener(EasyServer.GetConfValue <string>("Lobby", "WorldListener", "IP"), EasyServer.GetConfValue <int>("Lobby", "WorldListener", "Port"));
            Databases.InitDB();
            Databases.Load(true);
            FileMgr = new FileManager();
            string sVersion = EasyServer.GetConfValue <string>("Lobby", "LoginServer", "GameVersion");

            if (sVersion == "RTW_CB")
            {
                version = GameVersion.RTW_CB;
                Log.Info("Version", "Supported game version: 0.6.0.509927 (RTW closed beta)");
            }
            else if (sVersion == "RTW_DVD")
            {
                version = GameVersion.RTW_DVD;
                Log.Info("Version", "Supported game version: 1.1.0.534979 (RTW DVD release)");
            }
            else if (sVersion == "RTW_LAST")
            {
                version = GameVersion.RTW_LAST;
                Log.Info("Version", "Supported game version: 1.4.1.555239 (last RTW patch)");
            }
            else if (sVersion == "G1_LATEST")
            {
                version = GameVersion.G1_LATEST;
                Log.Info("Version", "Supported game version: 1.19.4.766569 (latest G1 patch)");
            }
            else if (sVersion == "G1_ENGUPD")
            {
                version = GameVersion.G1_ENGUPD;
                Log.Info("Version", "Supported game version: 2.0.0.750394 (G1 engine update)");
            }
            else
            {
                version = GameVersion.INVALID;
                Log.Error("Version", "Invalid game version");
            }

            try
            {
                HttpServer.MapHandlers();
                HttpServer server = new HttpServer();
                server.Start();
            }
            catch
            {
                Log.Error("HTTP", "If you want to use HTTP stuff, start this server with Admin rights");
            }

            Log.Succes("LobbyServer", "Server initialisation complete!");
            clients.Clear();
            worlds.Clear();
            Timer aTimer = new Timer(10000);

            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
            Log.Enter();
            Console.WriteLine("For available console commands, type /commands");
            Log.Enter();
            bool done = false;

            while (!done)
            {
                string command;
                command = Console.ReadLine();
                ProccessCommand(command);
            }
            EasyServer.StartConsole();
        }