public bool Init() { string tmpSection = ""; int i = 0; worldListFile = new IniFile("GameServersList.ini"); while (true) { tmpSection = "SERVER_" + i.ToString(); string Name = worldListFile.GetValue(tmpSection, "name"); string IP = worldListFile.GetValue(tmpSection, "adress"); int Port = worldListFile.GetInteger(tmpSection, "port"); int userPort = worldListFile.GetInteger(tmpSection, "userPort"); int BufSize = worldListFile.GetInteger(tmpSection, "bufferSize"); string key = worldListFile.GetValue(tmpSection, "key"); uint sX = worldListFile.GetUInteger(tmpSection, "startX"); uint sY = worldListFile.GetUInteger(tmpSection, "startY"); uint eX = worldListFile.GetUInteger(tmpSection, "endX"); uint eY = worldListFile.GetUInteger(tmpSection, "endY"); if (IP == "") { break; } else { GameServer g = new GameServer(Name, IP, Port, userPort, BufSize); g.StartX = sX; g.StartY = sY; g.EndX = eX; g.EndY = eY; g.Key = key; if (key == "") { g.connection.client.PrivateKey = Program.mainKey; } else { g.connection.client.PrivateKey = Encoding.ASCII.GetBytes(key); } gServerList.Add(g); i++; } } Output.WriteLine("WorldConnectionListener::INIT Loaded " + gServerList.Count.ToString() + " game server data from ini file"); Output.WriteLine("WorldConnectionListener::INIT done"); return(true); }
const string send = "/SEND"; //send test public LoginServer() { IniFile configServerFile = new IniFile("Config.ini"); IniFile worldServerFile = new IniFile("Worlds.ini"); Program.port = configServerFile.GetInteger("INTERNAL", "port", 4444); Program.maxNumberOfConnections = configServerFile.GetInteger("INTERNAL", "maxNumberOfConnections", 1000); Program.bufferSize = configServerFile.GetInteger("INTERNAL", "bufferSize", 100); Program.backlog = configServerFile.GetInteger("INTERNAL", "backlog", 100); Program.useWhiteList = configServerFile.GetBoolean("INTERNAL", "whiteList", false); Program.useBlackList = configServerFile.GetBoolean("INTERNAL", "blackList", true); Program.useTempBlackList = configServerFile.GetBoolean("INTERNAL", "tempBlackList", true); IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, Program.port); socketSettings = new SocketListenerSettings(Program.maxNumberOfConnections, Program.backlog, Program.receivePrefixLength, Program.bufferSize, Program.sendPrefixLength, localEndPoint); Output.WriteLine(ConsoleColor.Green, "LoginServer config. Port: " + Program.port.ToString() + " Max connections: " + Program.maxNumberOfConnections.ToString() + " Buffer size: " + Program.bufferSize.ToString()); worldListener = new WorldConnectionListener(); userListener = new UserConnectionListener(socketSettings); }