Esempio n. 1
0
bool CConfig::Init(const char *servername)
{
	if (!CBaseConfig::Init(servername))
		return false;

	SetServerType(ServerEnum::EST_LOG);

	std::string filename = fmt::format("./config/{0}Config.json", servername);
	std::ifstream i(filename);
	if (!i.is_open())
	{
		log_error("加载 %s 失败!", filename.c_str());
		return false;
	}

	nlohmann::json config = nlohmann::json::parse(i);

	if (config["SQL_Log"].is_null())
	{
		log_error("没有找到字段: 'SQL_Log'");
		return false;
	}
	m_SQLLog = config["SQL_Log"];

	return true;
}
Esempio n. 2
0
bool CConfig::Init(const char *servername)
{
	if (!CBaseConfig::Init(servername))
		return false;

	SetServerType(ServerEnum::EST_DB);

	std::string filename = fmt::format("./config/{0}Config.json", servername);
	std::ifstream i(filename);
	if (!i.is_open())
	{
		log_error("加载 %s 失败!", filename.c_str());
		return false;
	}

	nlohmann::json config = nlohmann::json::parse(i);

	m_BeginMapID = config["Begin_MapID"];
	if (m_BeginMapID <= 0)
	{
		log_error("Begin_MapID小于等于0:%d", m_BeginMapID);
		return false;
	}

	m_SQLLog = config["SQL_Log"];

	i.clear();
	i.close();
	config.clear();
	return true;
}
Esempio n. 3
0
	BOOL Init()
	{
		InitConfig( );
		InitDafaultConfig( "./ServerConfig.ini" );
		Printf( m_ddesc[0] );
		Printf( m_ddesc[1] );
		
		SetServerType(AGENT_SERVER);
		LoadServerConfig( "./ServerConfig.ini" );
		Printf( m_desc[0] );
		Printf( m_desc[1] );
		return TRUE;
	}