示例#1
0
        private bool LoadGameIMGConfig()
        {
            try
            {
                LogCharacter = new Dictionary<int, int>();
                center = new CenterServer();
                var reader = new ConfigReader(Program.GameIMGPath);

                port = reader.getUShort("", "port");
                gameWorldId = reader.getInt("", "gameWorldId");

                foreach (string s in reader.GetBlocks("logaccount", true))
                {
                    LogCharacter.Add(int.Parse(s), reader.getInt("logcharacter", s));
                }

                center.ip = reader.getString("center", "ip");
                center.port = reader.getUShort("center", "port");
                center.Name = reader.getString("center", "worldName");
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
示例#2
0
        public bool LoadCenterIMGConfig()
        {
            try
            {
                ConfigReader reader = new ConfigReader(Program.CenterIMGPath);
                port = reader.getUShort("", "port");
                adminPort = reader.getUShort("", "adminPort");
                gameWorldId = reader.getUInt("", "gameWorldId");
                gameWorldName = reader.getString("", "gameWorldName");

                dbCatalogGlobalAccount = reader.getString("", "dbCatalogGlobalAccount");
                dbCatalogGameWorld = reader.getString("", "dbCatalogGameWorld");
                dbCatalogCoupon = reader.getString("", "dbCatalogCoupon");

                userLimitITC = reader.getUInt("", "userLimitITC");

                IEnumerable<string> gameServerTypeList = reader.getBlocksFromBlock("", 1);
                GameServerType gameServerType;
                foreach (string s in gameServerTypeList)
                {
                    switch (s)
                    {
                        case "login": gameServerType = GameServerType.Login; break;
                        case "game": gameServerType = GameServerType.Game; break;
                        case "shop": gameServerType = GameServerType.Shop; break;
                        case "mapgen": gameServerType = GameServerType.MapGen; break;
                        case "claim": gameServerType = GameServerType.Claim; break;
                        case "itc": gameServerType = GameServerType.ITC; break;
                        default: gameServerType = GameServerType.UNK; break;
                    }
                    if (gameServerType == GameServerType.UNK)
                    {
                        Logger.Warn("Unknown GameServerType: " + s);
                        continue;
                    }
                    if (gameServerType == GameServerType.Claim)
                    {
                        GameServer server = new GameServer();
                        server.Name = s;
                        server.PublicIP = reader.getString(s, "PublicIP");
                        server.PrivateIP = reader.getString(s, "PrivateIP");
                        server.port = reader.getUShort(s, "port");
                        server.ServerType = gameServerType;
                        server.ID = GetNextAvailableGameServerId();
                        gameServers.Add(s, server);
                    }
                    else
                    {
                        foreach (string node in reader.GetBlocks(s, true))
                        {
                            GameServer server = new GameServer();
                            server.Name = node;
                            server.PublicIP = reader.getString(node, "PublicIP");
                            server.PrivateIP = reader.getString(node, "PrivateIP");
                            server.port = reader.getUShort(node, "port");
                            server.ServerType = gameServerType;
                            server.ID = server.ServerType == GameServerType.Login ? 0xFF : GetNextAvailableGameServerId();
                            gameServers.Add(node, server);
                        }
                    }
                }
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
示例#3
0
 private bool LoadDBIMGConfig()
 {
     try
     {
         ConfigReader reader = new ConfigReader(Program.DBIMGPath);
         dbUsername = reader.getString("", "dbUsername");
         dbPassword = reader.getString("", "dbPassword");
         dbDatabase = reader.getString("", "dbDatabase");
         dbHost = reader.getString("", "dbHost");
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
示例#4
0
        public bool LoadGameIMGConfig()
        {
            try
            {
                LogAccounts = new Dictionary<int, int>();
                centerServers = new Dictionary<string, CenterServer>();
                ConfigReader reader = new ConfigReader(Program.GameIMGPath);

                port = reader.getUShort("", "port");
                adminPort = reader.getUShort("", "adminPort");

                dbCatalogGlobalAccount = reader.getString("", "dbCatalogGlobalAccount");
                dbCatalogGameWorld = reader.getString("", "dbCatalogGameWorld");

                foreach (string s in reader.GetBlocks("logaccount", true))
                {
                    LogAccounts.Add(int.Parse(s), reader.getInt("logaccount", s));
                }

                foreach (string s in reader.GetBlocks("center", true))
                {
                    CenterServer centerServ = new CenterServer();
                    centerServ.ip = reader.getString(s, "ip");
                    centerServ.port = reader.getUShort(s, "port");
                    centerServ.world = reader.getInt(s, "world");
                    centerServ.channelNo = reader.getInt(s, "channelNo");
                    centerServers.Add(s, centerServ);
                }
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }