LobbyServer.Databases.InitDB C# (CSharp) Method

InitDB() public static method

public static InitDB ( ) : void
return void
        public static void InitDB()
        {
            rebornAPB = new MyDB.Database(EasyServer.GetConfValue<String>("Database", "Database", "IP"), EasyServer.GetConfValue<int>("Database", "Database", "Port"), EasyServer.GetConfValue<String>("Database", "Database", "Username"), EasyServer.GetConfValue<String>("Database", "Database", "Password"), EasyServer.GetConfValue<String>("Database", "Database", "Database"));
            AccountTable = new Table<AccountEntry>(rebornAPB);
            CharacterTable = new Table<CharacterEntry>(rebornAPB);
        }

Usage Example

Beispiel #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);

            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(1000);

            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();
        }
All Usage Examples Of LobbyServer.Databases::InitDB