예제 #1
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ APB-Lobby", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            Log.Info("LobbyServer", "Starting ...");

            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <LobbyServerConfig>();

            if (!Log.InitLog(Config.LogLevel, "LobbyServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            FileServerClient = new RpcClient("LobbyServer-File", Config.FileServerRpc.RpcLocalIp, 1);
            if (!FileServerClient.Start(Config.FileServerRpc.RpcServerIp, Config.FileServerRpc.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharacterServerClient = new RpcClient("LobbyServer-Char", Config.CharacterServerRpc.RpcLocalIp, 0);
            if (!CharacterServerClient.Start(Config.CharacterServerRpc.RpcServerIp, Config.CharacterServerRpc.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            if (!TCPManager.Listen <TcpServer>(Config.ClientServerPort, "Lobby"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharMgr = CharacterServerClient.GetServerObject <CharacterMgr>();
            FileMgr = FileServerClient.GetServerObject <FileManager>();

            DBAccount Acct = CharMgr.GetAccount(1);

            string[] sVersion = Config.ClientVersion.Split('.');
            Build = Config.ClientBuild;

            Version = new byte[sVersion.Length];

            for (int i = 0; i < Version.Length; ++i)
            {
                Version[i] = byte.Parse(sVersion[i]);
            }

            Log.Info("LobbyServer", "Version = " + Version[0] + "." + Version[1] + "." + Version[2] + " : Build = " + Build);


            Log.Success("LobbyServer", "Server loaded.");

            ConsoleMgr.Start();
        }