Пример #1
1
 static void Main(string[] args)
 {
     Log.Info("WorldServer", "Starting...");
     if (!EasyServer.InitLog("World", "Configs/WorldLog.conf") || !EasyServer.InitConfig("Configs/World.xml", "World")) return;
     Port = EasyServer.GetConfValue<int>("World", "Address", "Port");
     IP1 = EasyServer.GetConfValue<Byte>("World", "Address", "IP1");
     IP2 = EasyServer.GetConfValue<Byte>("World", "Address", "IP2");
     IP3 = EasyServer.GetConfValue<Byte>("World", "Address", "IP3");
     IP4 = EasyServer.GetConfValue<Byte>("World", "Address", "IP4");
     if (!EasyServer.Listen<TcpServer>(Port, "ClientServer")) return;
     Database.Connection.connectionString = EasyServer.GetConfValue<String>("World", "Database", "ConnectionString");
     FileMgr = new FileManager();
     Password = EasyServer.GetConfValue<string>("World", "Lobby", "Password");
     WorldName = EasyServer.GetConfValue<string>("World", "ClientServer", "Name");
     ID = EasyServer.GetConfValue<Byte>("World", "ClientServer", "Id");
     Lobby = new Lobby.Client(EasyServer.GetConfValue<String>("World", "Lobby", "Ip"), EasyServer.GetConfValue<int>("World", "Lobby", "Port"));
     districtsListener = new Districts.Listener(EasyServer.GetConfValue<String>("World", "Districts", "Ip"), EasyServer.GetConfValue<int>("World", "Districts", "Port"));
     clients.Clear();
     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();
 }
Пример #2
0
 static void Main(string[] args)
 {
     Log.Info("WorldServer", "Starting...");
     if (!EasyServer.InitLog("World", "Configs/Logs.conf") || !EasyServer.InitConfig("Configs/World.xml", "World") || !EasyServer.InitConfig("Configs/Database.xml", "Database")) return;
     Port = EasyServer.GetConfValue<int>("World", "WorldServer", "Port");
     IP1 = EasyServer.GetConfValue<Byte>("World", "WorldServer", "IP1");
     IP2 = EasyServer.GetConfValue<Byte>("World", "WorldServer", "IP2");
     IP3 = EasyServer.GetConfValue<Byte>("World", "WorldServer", "IP3");
     IP4 = EasyServer.GetConfValue<Byte>("World", "WorldServer", "IP4");
     if (!EasyServer.Listen<TcpServer>(Port, "WorldInfo")) return;
     Databases.InitDB();
     Databases.Load(false);
     FileMgr = new FileManager();
     Password = EasyServer.GetConfValue<string>("World", "LobbyCommunication", "Password");
     WorldName = EasyServer.GetConfValue<string>("World", "WorldInfo", "Name");
     ID = EasyServer.GetConfValue<Byte>("World", "WorldInfo", "Id");
     Lobby = new Lobby.Client(EasyServer.GetConfValue<String>("World", "LobbyCommunication", "Ip"), EasyServer.GetConfValue<int>("World", "LobbyCommunication", "Port"));
     districtsListener = new Districts.Listener(EasyServer.GetConfValue<String>("World", "DistrictListener", "Ip"), EasyServer.GetConfValue<int>("World", "DistrictListener", "Port"));
     clients.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();
 }