Exemplo n.º 1
0
int KGIniListCtrl::BandDate(vector<CString> vecStrIniProperty, CString strIniDateType)
{
    int nResult  = false;
    int nRetCode = false;

    m_strIniDateType = strIniDateType;
    m_pIniDateType   = g_OpenIniFile(strIniDateType);
    KG_PROCESS_ERROR(m_pIniDateType);

    for (int i = 0; i < (int)vecStrIniProperty.size(); i++)
    {
        IIniFile* pIniFile = NULL;
        if (::PathFileExists(vecStrIniProperty[i]))
            pIniFile = g_OpenIniFile(vecStrIniProperty[i], false, true);
        else
            Build(&pIniFile);
        if (pIniFile)
        {
            _InIInfo* pIniInfo = new _InIInfo;
            pIniInfo->strPath  = vecStrIniProperty[i];
            pIniInfo->pIniFile = pIniFile;
            m_vecIniProperty.push_back(pIniInfo);
        }
    }

    nResult = true;
Exit0:
    return nResult;
}
Exemplo n.º 2
0
    bool KFilePathMgr::Init()
    {
        bool bResult = false;
        char szPath[MAX_PATH];
        char szKey[128];
        IIniFile *pIni = NULL;

#ifdef KG_PUBLISH
		pIni = g_OpenIniFileInPak("\\ui\\configfilepath.ini");
		if (!pIni)
			pIni = g_OpenIniFile("\\ui\\configfilepath.ini");
		KGLOG_PROCESS_ERROR(pIni && "open ini file ui\\configfilepath.ini failed!\n");
#else
		pIni = g_OpenIniFile("\\ui\\configfilepath.ini");
		KGLOG_PROCESS_ERROR(pIni && "open ini file ui\\configfilepath.ini failed!\n");
#endif

        szKey[0] = '\0';
    	while (pIni->GetNextKey("FILE_PATH", szKey, szKey))
        {
            pIni->GetString("FILE_PATH", szKey, "", szPath, _countof(szPath));
            FormatFilePath(szPath);

            m_KeyToPath[szKey] = szPath;
        }

        bResult = true;
Exit0:
        SAFE_RELEASE(pIni);
        return bResult;
    }
Exemplo n.º 3
0
Arquivo: main.cpp Projeto: viticm/pap2
int LoadConfig(BOOL *pnIsClient, char *pszDir, unsigned uSize)
{
    int nResult = false;
    int nRetCode = false;
    const char CONFIGFILE[] = "KG_BoneChecker.ini";
    IIniFile *piFile = NULL;

    *pnIsClient = false;

    piFile = g_OpenIniFile(CONFIGFILE);
    KGLOG_PROCESS_ERROR(piFile);
    
    nRetCode = piFile->GetString("BoneChecker", "SO3ClientDir", "", pszDir, uSize);
    KGLOG_PROCESS_ERROR(nRetCode);

    if (strcmp(pszDir, ""))
    {
        *pnIsClient = true;
        KG_PROCESS_SUCCESS(true);
    }

    nRetCode = piFile->GetString("BoneChecker", "bipdir", "", pszDir, uSize);
    KGLOG_PROCESS_ERROR(nRetCode);

Exit1:
    nResult = true;
Exit0:
    if (!nResult)
        puts("!!!Read Config File Failed.");
    KG_COM_RELEASE(piFile);
    return nResult;
}
Exemplo n.º 4
0
HRESULT KG3DScenePvsEditor::UnInit()
{
    IIniFile* pIniFile = g_OpenIniFile("data\\public\\PvsEditorSetting.ini", false, true);

    if (pIniFile)
    {
        GetEnvironment().SaveMapSetting(pIniFile);
        pIniFile->Save("data\\public\\PvsEditorSetting.ini");
    }

    if (m_lpPointLightRender)
        m_lpPointLightRender->UnInit();
    SAFE_DELETE(m_lpPointLightRender);

    SAFE_RELEASE(pIniFile);


    KG3DSceneSelectionTool& selTool = this->GetSelectionTool();
    selTool.ClearSelection();

	SAFE_DELETE(m_lpLightMapBaker);

    SAFE_RELEASE(m_pGroundGridVertexs);
    SAFE_RELEASE(m_pPvs);
    SAFE_RELEASE(m_pHandObj);
    SAFE_DELETE(m_pHandPtl);
    SAFE_DELETE(m_pRunder);


	KG3DSceneEditorBase::UnInit();

    return S_OK;
}
Exemplo n.º 5
0
BOOL KGameServer::_LoadMiniServerScene()
{
	IIniFile* pIniFile = g_OpenIniFile(KDF_SERVER_CFG);
	QCONFIRM_RET_FALSE(pIniFile);

	INT nSceneCount = 0;
	pIniFile->GetInteger("PreloadScene", "Count", 0, &nSceneCount);

	if (nSceneCount > 0)
	{
		INT* pSceneTemplateIds = new INT[nSceneCount];
		INT nActualCount = pIniFile->GetMultiInteger("PreloadScene", "Scenes", pSceneTemplateIds, nSceneCount);
		QCONFIRM(nActualCount == nSceneCount);
		nSceneCount = nActualCount;

		for (INT j = 0; j < nSceneCount; j++)
		{
			INT nSceneId = pSceneTemplateIds[j];
			if (nSceneId > 0)
				g_pSceneMgr->LoadScene((DWORD)nSceneId, 0);
		}
	}

	return TRUE;
}
Exemplo n.º 6
0
BOOL KAIManager::Init()
{
    BOOL        bResult     = false;
    BOOL        bRetCode    = false;
    IIniFile*   piIniFile   = NULL;

    RegisterActionFunctions();

    KGLogPrintf(KGLOG_INFO, "[AI] loading ... ...");

    bRetCode = LoadAITabFile();
    KGLOG_PROCESS_ERROR(bRetCode);

    KGLogPrintf(KGLOG_INFO, "[AI] %u AI loaded !", m_AITable.size());

    memset(m_ActionRunTimeStatisticsArray, 0, sizeof(m_ActionRunTimeStatisticsArray));
    m_NpcAIRunTimeStatisticsMap.clear();

    m_bLogAIRuntimeStat = 0;

    piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetInteger("AI", "LogAIRuntimeStat", 0, &m_bLogAIRuntimeStat);
    //KGLOG_PROCESS_ERROR(bRetCode);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return bResult;
}
Exemplo n.º 7
0
BOOL KLogClient::Init()
{
    BOOL               bResult          = false;
    BOOL               bRetCode         = false;
    IIniFile*	       piIniFile        = NULL;

    piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString(LOG_SERVER_SECTION_GAMESERVER, "IP", "127.0.0.1", m_szLogServerAddr, sizeof(m_szLogServerAddr));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger(LOG_SERVER_SECTION_GAMESERVER, "Port", 5004, &m_nRelayPort);
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger(LOG_SERVER_SECTION_GAMESERVER, "PingCycle", 20, &m_nPingCycle);
    KGLOG_PROCESS_ERROR(bRetCode);

    m_bRunFlag = true;

    bRetCode = m_WorkThread.Create(WorkThreadFunction, this);
    KGLOG_PROCESS_ERROR(bRetCode);

    bResult = true;
Exit0:
    if (!bResult)
    {
        KG_COM_RELEASE(m_piSocketStream);
    }

    KG_COM_RELEASE(piIniFile);
    return bResult;
}
Exemplo n.º 8
0
int KGSFXModelViewPage::FillTreeFromFileMap()
{
	int nResult  = false;
	int nRetCode = false;

	char szSection[32] = TEXT("");
	char szKeyName[32] = TEXT("");
	char szKeyData[32] = TEXT("");
	char szKeyType[32] = TEXT("");

	TCHAR szMapFileName[MAX_PATH];
	sprintf(szMapFileName, "%s%s", g_szDefWorkDirectory, TEXT("\\sfx_editor_file_map.ini"));

	m_tree.DeleteAllItems();
	IIniFile* pMapFile = NULL;
	pMapFile = g_OpenIniFile(szMapFileName);

	KG_PROCESS_ERROR(pMapFile);

	while (pMapFile->GetNextKey(TEXT("Main"), szKeyName, szKeyName))
	{
		pMapFile->GetString(TEXT("Main"), szKeyName, TEXT(""), szKeyData, sizeof(szKeyData));
		pMapFile->GetString(TEXT("Type"), szKeyData, TEXT(""), szKeyType, sizeof(szKeyType));
		_FillTreeFromFileMap(&m_tree, NULL, pMapFile, szKeyData, GetImageIndex(szKeyType));
	}

	nResult = true;
Exit0:
	SAFE_RELEASE(pMapFile);
	return nResult;
}
Exemplo n.º 9
0
BOOL KSndaAgency::LoadConfig()
{
	BOOL        bResult     = false;
	BOOL        bRetCode    = false;
	IIniFile*   piIniFile   = NULL;

	piIniFile = g_OpenIniFile(GATEWAY_CONFIG_FILE);
	LOG_PROCESS_ERROR(piIniFile);

	m_bOpen = true;
	bRetCode = piIniFile->IsSectionExist("SDOA");
	if (!bRetCode)
	{
		m_bOpen = false;
		goto EXIT1;
	}

	bRetCode = piIniFile->GetString("SDOA", "AdultIDCard", "not configed", m_szAdultIDCard, sizeof(m_szAdultIDCard)); 
	LOG_PROCESS_ERROR(bRetCode);

EXIT1:
	bResult = true;
EXIT0:
	SAFE_RELEASE(piIniFile);
	return bResult;
}
Exemplo n.º 10
0
BOOL KLogClient::Init()
{
    BOOL               bResult          = false;
    BOOL               bRetCode         = false;
    IIniFile*	       piIniFile        = NULL;
    int                nPort            = 0;
    char               szIP[16];

    piIniFile = g_OpenIniFile(GS_SETTINGS_FILENAME);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString("LogServer", "IP", "127.0.0.1", szIP, sizeof(szIP));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger("LogServer", "Port", 5005, &nPort);
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetInteger("LogServer", "PingCycle", 30, &m_nPingCycle);
    KGLOG_PROCESS_ERROR(bRetCode);
    KGLOG_PROCESS_ERROR(m_nPingCycle > 0);

    bRetCode = piIniFile->GetString("LogServer", "Identity", "", m_szIdentity, sizeof(m_szIdentity));
    KGLOG_PROCESS_ERROR(bRetCode);
    m_szIdentity[sizeof(m_szIdentity) - 1] = '\0';

    // 无论连上与否,均视为成功
    LoginServer(szIP, nPort, m_szIdentity);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return bResult;
}
Exemplo n.º 11
0
void KSceneEditorDialogAutoGrass::LoadTextureSettings()
{
	CString strTextureName;
	TCHAR strIniFileName[MAX_PATH];
	int nCurSel = m_ComboxBoxTexture.GetCurSel();
	IIniFile* pInIFile = NULL;
	int nReturnCode = 0;

	KG_PROCESS_ERROR(nCurSel != CB_ERR);

	m_ComboxBoxTexture.GetLBText(nCurSel, strTextureName);
	sprintf(strIniFileName, "%s%s.ini", m_GrassTexturePath, strTextureName);
	
	////把文件的只读属性去掉////////////////////////////////////by huangjinshou
	DWORD dwFileAttribute = ::GetFileAttributes(strIniFileName);
	dwFileAttribute &=~FILE_ATTRIBUTE_READONLY; 
	::SetFileAttributes(strIniFileName,dwFileAttribute);
	///////////////////////////////////////////////////////////
	pInIFile = g_OpenIniFile(strIniFileName, false, true);
	KG_PROCESS_ERROR(pInIFile);

	pInIFile->GetInteger("Texture", "StrideX", 1, &m_nWidhtCount);
	pInIFile->GetInteger("Texture", "StrideY", 1, &m_nHeightCount);

	UpdateData(FALSE);
Exit0:
	SAFE_RELEASE(pInIFile);
	return;
}
Exemplo n.º 12
0
HRESULT KG3DScenePvsEditor::Init()
{
    HRESULT hrResult  = E_FAIL;
    HRESULT hrRetCode = E_FAIL;
	int nPointLightRenderInitFlag = false;

    if (SUCCEEDED(g_GetObjectTable().Get1NewResource((KG3DRepresentObject**)&m_pRunder, REPRESENTOBJECT_NPC, 0)))
    {
        m_pRunder->SetModel(0, "data\\public\\scenerunner\\scenerunner.Mesh", NULL, "data\\public\\scenerunner\\scenerunner.ani", FALSE);
        m_pRunder->SetNpcFrontDir(D3DXVECTOR3(0.0f,0.0f, -1.0f));
        m_pRunder->SetNpcType(NPC_TYPE_PROTAGONIST);
        //m_pRunder->BandScene(this);
    }

    if (m_lpSceneOutDoorSpaceMgr)
    {
        extern TKG3DResourcePool<KG3DSceneZone> g_cSceneZonePool;
        KG3DSceneZone* pNewZone = g_cSceneZonePool.RequestResource();
        pNewZone->Init(0, 0);
        m_lpSceneOutDoorSpaceMgr->InputNewZone(pNewZone);
    }
	
	hrRetCode = KG3DSceneEditorBase::Init();
    KGLOG_COM_PROCESS_ERROR(hrRetCode);

    
    {
        IIniFile* pIniFile = g_OpenIniFile("data\\public\\PvsEditorSetting.ini");
        
        if (!pIniFile)
            GetEnvironment().LoadMapSetting(NULL, NULL);
        else
            GetEnvironment().LoadMapSetting(pIniFile, NULL);

        SAFE_RELEASE(pIniFile);

    }
	
    m_lpPointLightRender = new KG3DScenePointLightRender;
    KGLOG_PROCESS_ERROR(m_lpPointLightRender);

    hrRetCode = m_lpPointLightRender->Init();
    KGLOG_COM_PROCESS_ERROR(hrRetCode);
    nPointLightRenderInitFlag = true;

    hrResult = S_OK;
Exit0:
    if (FAILED(hrResult))
    {
	    if (nPointLightRenderInitFlag)
	    {
            m_lpPointLightRender->UnInit();
            nPointLightRenderInitFlag = false;
	    }
        SAFE_DELETE(m_lpPointLightRender);
    }
	return hrResult;
}
Exemplo n.º 13
0
    int KUiFontManage::ReInitIni()
    {
        if (m_pFontIni)
            return true;
        char szPath[MAX_PATH] = "";
        g_GetRootPath(szPath);
        strcat(szPath, "\\UI\\Scheme\\Elem\\Font.ini");
        strcpy(m_szFontFileName, szPath);
        m_pFontIni = g_OpenIniFile(m_szFontFileName);

        return true;
    }
Exemplo n.º 14
0
void KG3DAnimationSoundTagInfo::Init()
{
	int nHeight = 0;
	ITabFile *pTabFile = NULL;
    IIniFile *pIniFile = NULL;
    pTabFile = g_OpenTabFile(s_strConfigTabFile);
	KG_PROCESS_ERROR(pTabFile);
	m_SoundType.clear();
	m_AnimationSoundTagInfo.clear();
	for (size_t i = 0 ; i < sizeof(s_strSoundType) / sizeof(TCHAR *) ; i ++)
	{
		std::string strFirst = s_strSoundType[i];
		m_SoundType[strFirst] = i;
	}
	nHeight = pTabFile->GetHeight();
	for (int i = 2 ; i <= nHeight ; i ++)
	{
		AnimationSoundTagInfo Info;
		TCHAR strSoundType[MAX_PATH];
		std::string SoundTypetemp;
		iter it = m_SoundType.begin();
		int nSoundType = 0;
		pTabFile->GetString(i,COL_SOUNDTYPE,"",strSoundType,MAX_PATH);
		pTabFile->GetString(i,COL_FILENAME,"",Info.strFileName,MAX_PATH);
		pTabFile->GetFloat(i,COL_RATE,0.0f,&Info.fRate);
		_strlwr_s(strSoundType,MAX_PATH);
		SoundTypetemp = strSoundType;
		KG_PROCESS_ERROR(m_SoundType.find(SoundTypetemp) != m_SoundType.end());
		Info.soundType = static_cast<SoundType>(m_SoundType[SoundTypetemp]);
		nSoundType = m_SoundType[SoundTypetemp];
		if(m_AnimationSoundTagInfo.find(nSoundType) 
			!= m_AnimationSoundTagInfo.end())
		{
			m_AnimationSoundTagInfo[nSoundType].push_back(Info);
		}
		else
		{
			std::vector<AnimationSoundTagInfo> vec;
			vec.push_back(Info);
			m_AnimationSoundTagInfo[nSoundType] = vec;
		}
	}
	Adjust();
    pIniFile = g_OpenIniFile(s_strConfigIniFile);
    KG_PROCESS_ERROR(pIniFile);
    pIniFile->GetInteger("ROOT","SaveVersion3Data",0,&m_nSaveVersion3Data);
	m_bInit = TRUE;
Exit0:
    SAFE_RELEASE(pTabFile);
    SAFE_RELEASE(pIniFile);
	;
}
Exemplo n.º 15
0
BOOL KGameServer::_InitEnv()
{
	// Get GameCenter Ip/Port
	IIniFile* pIniFile = g_OpenIniFile(KDF_SERVER_CFG);
	QCONFIRM_RET_FALSE(pIniFile);

	//pIniFile->GetInteger("GameCenter", "Port", 5135, &m_nGameCenterPort);
	//pIniFile->GetString("GameCenter", "Ip", "", m_szGameCenterIp, countof(m_szGameCenterIp));

	pIniFile->GetInteger("GameServer", "ServerId", 0, &g_cOrpgWorld.m_nServerId);
	pIniFile->GetInteger("GameServer", "ServerMode", 0, &g_cOrpgWorld.m_nServerMode);
	return TRUE;
}
Exemplo n.º 16
0
int KG_Jx3DBChecker::_LoadSettings()
{
    int nResult = false;
    int nRetCode = false;

    IIniFile*   piIniFile   = NULL;

    piIniFile = g_OpenIniFile(DBCHECKER_CONFIG_FILE);
    KGLOG_PROCESS_ERROR(piIniFile);

    nRetCode = piIniFile->GetString("SrcDatabaseServer1", "Server", "", m_mySqlConnectParan[0].szServer, sizeof(m_mySqlConnectParan[0].szServer));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer1", "UserName", "", m_mySqlConnectParan[0].szUserName, sizeof(m_mySqlConnectParan[0].szUserName));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer1", "Password", "", m_mySqlConnectParan[0].szPassword, sizeof(m_mySqlConnectParan[0].szPassword));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer1", "DBName", "", m_mySqlConnectParan[0].szDBName, sizeof(m_mySqlConnectParan[0].szDBName));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer2", "Server", "", m_mySqlConnectParan[1].szServer, sizeof(m_mySqlConnectParan[1].szServer));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer2", "UserName", "", m_mySqlConnectParan[1].szUserName, sizeof(m_mySqlConnectParan[1].szUserName));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer2", "Password", "", m_mySqlConnectParan[1].szPassword, sizeof(m_mySqlConnectParan[1].szPassword));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("SrcDatabaseServer2", "DBName", "", m_mySqlConnectParan[1].szDBName, sizeof(m_mySqlConnectParan[1].szDBName));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("DstDatabaseServer", "Server", "", m_mySqlConnectParan[2].szServer, sizeof(m_mySqlConnectParan[2].szServer));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("DstDatabaseServer", "UserName", "", m_mySqlConnectParan[2].szUserName, sizeof(m_mySqlConnectParan[2].szUserName));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("DstDatabaseServer", "Password", "", m_mySqlConnectParan[2].szPassword, sizeof(m_mySqlConnectParan[2].szPassword));
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = piIniFile->GetString("DstDatabaseServer", "DBName", "", m_mySqlConnectParan[2].szDBName, sizeof(m_mySqlConnectParan[2].szDBName));
    KGLOG_PROCESS_ERROR(nRetCode);

    nResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return nResult;
}
Exemplo n.º 17
0
int KG_LoadMySQLDatabaseParameter(const char cszConfigFileName[], KG_MYSQL_PARAM *pRetParam)
{
	int nResult  = false;
	int nRetCode = false;
    IIniFile *piIniFile = NULL;
    char szPassword[64];

    KGLOG_PROCESS_ERROR(cszConfigFileName);
    KGLOG_PROCESS_ERROR(cszConfigFileName[0]);
    KGLOG_PROCESS_ERROR(pRetParam);

    piIniFile = g_OpenIniFile(cszConfigFileName);
    KGLOG_PROCESS_ERROR(piIniFile && "g_OpenIniFile()");

    nRetCode = piIniFile->GetString(
        "DatabaseServer", "Server", NULL, pRetParam->szServer, sizeof(pRetParam->szServer)
    );
    KGLOG_PROCESS_ERROR(nRetCode && "Unable load \"[DatabaseServer]:Server\"");

    nRetCode = piIniFile->GetString(
        "DatabaseServer", "Database", NULL, pRetParam->szDatabase, sizeof(pRetParam->szDatabase)
    );
    KGLOG_PROCESS_ERROR(nRetCode && "Unable load \"[DatabaseServer]:Database\"");

    nRetCode = piIniFile->GetString(
        "DatabaseServer", "UserName", NULL, pRetParam->szUserName, sizeof(pRetParam->szUserName)
    );
    KGLOG_PROCESS_ERROR(nRetCode && "Unable load \"[DatabaseServer]:UserName\"");

    nRetCode = piIniFile->GetString("DatabaseServer", "Password", NULL, szPassword, sizeof(szPassword));
    KGLOG_PROCESS_ERROR(nRetCode && "Unable load \"[DatabaseServer]:Password\"");

#ifdef _DEBUG
    strncpy(pRetParam->szPassword, szPassword, sizeof(pRetParam->szPassword));
    KGLOG_PROCESS_ERROR(pRetParam->szPassword[sizeof(pRetParam->szPassword) -1] == '\0');
#else
    nRetCode = (int)strlen(szPassword);
    KGLOG_PROCESS_ERROR((nRetCode == PG_RESULTLENSTD) && "Password error");
    nRetCode = SimplyDecryptPassword(pRetParam->szPassword, szPassword);
    KGLOG_PROCESS_ERROR(nRetCode && "Password error");
#endif

	nResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    if (!nResult && cszConfigFileName)
        KGLogPrintf(KGLOG_DEBUG, "Failed to load parameter from the file : %s", cszConfigFileName);
	return nResult;
}
Exemplo n.º 18
0
int KGTestMapDisuseResource::FindResInModelset(const char cszResourceName[], set<string>& vecResList)
{
	//参照KG3DRepresentObjectSet::LoadFromIniFile
	int nRetCode = false;
	int nResult  = false;
	IIniFile* pIniFile = NULL;
	char szSourcePathName[MAX_PATH] = {0};

	KG_ASSERT_EXIT(cszResourceName);
	KGLOG_PROCESS_ERROR(cszResourceName[0] != '\0');

	nRetCode = _snprintf_s(szSourcePathName,
		sizeof(szSourcePathName),
		sizeof(szSourcePathName) - 1,
		"%s%s",
		m_szClientPath,
		cszResourceName);
	KGLOG_PROCESS_ERROR(nRetCode > 0);

	pIniFile = g_OpenIniFile(szSourcePathName);
	KGLOG_PROCESS_ERROR(pIniFile);

	int nCount = 0;
	pIniFile->GetInteger("MAIN", "Count", 0, &nCount);

	for (int i = 0; i < nCount; i++)
	{
		char szSecName[MAX_PATH]  = {0};
		char szMeshName[MAX_PATH] = {0};
		char szMtlName[MAX_PATH]  = {0};

		nRetCode = _snprintf_s(szSecName, sizeof(szSecName), sizeof(szSecName) - 1, "Model%d", i);
		KGLOG_PROCESS_ERROR(nRetCode> 0);
		pIniFile->GetString(szSecName, "MeshName", "", szMeshName, sizeof(szMeshName));
		FindResource(szMeshName, vecResList);
		pIniFile->GetString(szSecName, "MtlName", "", szMtlName, sizeof(szMtlName));
		FindResource(szMtlName, vecResList);
	}

	nResult = true;
Exit0:
	if (pIniFile)
	{	
		pIniFile->Release();
		pIniFile = NULL;
	}
	return nResult;
}
Exemplo n.º 19
0
HRESULT KG3DTerrainRepresentInfo::InitDis()
{
    HRESULT hResult = E_FAIL;
    IIniFile* pFile = NULL;

    pFile = g_OpenIniFile(s_strGroundEffectConfigFile);
    KG_PROCESS_ERROR(pFile);
    
    pFile->GetFloat("ROOT","GroundEffectDis",500.0,&m_fDis);
    pFile->GetFloat("ROOT","GroundEffectWaterDis",500.0,&m_fwaterDis);

    hResult = S_OK;
Exit0:
    SAFE_RELEASE(pFile);
    return hResult;
}
Exemplo n.º 20
0
LRESULT KGSFXGlobPage::OnColorBkDialogClose(WPARAM w, LPARAM l)
{
    GET_SFX_EDITOR_RET(0);

    TCHAR szIniPath[MAX_PATH];
    g_GetFullPath(szIniPath, TEXT("config.ini"));
    IIniFile* pIniFile = g_OpenIniFile(szIniPath, true, true);

    if (pIniFile)
    {
        pIniFile->WriteStruct(TEXT("SfxEditor"), TEXT("bkcolor"), pScene->GetBkColorPtr(), sizeof(DWORD));
        pIniFile->Save(szIniPath);
        pIniFile->Release();
    }

    return 1;
}
Exemplo n.º 21
0
void KG3DSelector::UnInit()
{
	IIniFile *pConfig = g_OpenIniFile(g_szConfigFilePath, false, true);
	int nResult = 0;
	KG_PROCESS_ERROR(pConfig);

	nResult = pConfig->WriteInteger("KG3DENGINE", "SelectorScale", static_cast<int>(m_nScale));
	KG_PROCESS_ERROR(nResult);

	pConfig->Save(g_szConfigFilePath);

Exit0:
	SAFE_RELEASE(pConfig);
	SAFE_RELEASE(m_pStencilRT);
	SAFE_RELEASE(m_pStencilDepth);
	SAFE_RELEASE(m_pRT);
	SAFE_RELEASE(m_pResult);
}
Exemplo n.º 22
0
BOOL KSO3Gateway::LoadConfig()
{
    BOOL        bResult     = false;
    BOOL        bRetCode    = false;
    IIniFile*   piIniFile   = NULL;

    piIniFile = g_OpenIniFile(GATEWAY_CONFIG_FILE);
    KGLOG_PROCESS_ERROR(piIniFile);

    bRetCode = piIniFile->GetString("Global", "Locale", "", m_szLocale, sizeof(m_szLocale));
    KGLOG_PROCESS_ERROR(bRetCode);

    bRetCode = piIniFile->GetBool("Global", "SD", &m_bSndaAgent);
    KGLOG_PROCESS_ERROR(bRetCode);

    bResult = true;
Exit0:
    KG_COM_RELEASE(piIniFile);
    return bResult;
}
Exemplo n.º 23
0
HRESULT KG3DTerrainRepresentInfo::InitDefaultSfx()
{
    HRESULT hResult = E_FAIL;
    HRESULT hRetCode = E_FAIL;
    IIniFile *pFile = NULL;
    pFile = g_OpenIniFile(s_strGroundEffectConfigFile);
    KG_PROCESS_ERROR(pFile);

    pFile->GetString("ROOT","DefaultSfx1","",m_DefaultSfx.str_DefaultSfx[0],MAX_PATH);
    pFile->GetString("ROOT","DefaultSfx2","",m_DefaultSfx.str_DefaultSfx[1],MAX_PATH);
    pFile->GetString("ROOT","DefaultSfx3","",m_DefaultSfx.str_DefaultSfx[2],MAX_PATH);
    pFile->GetString("ROOT","DefaultSfx4","",m_DefaultSfx.str_DefaultSfx[3],MAX_PATH);
    pFile->GetString("ROOT","DefaultSfxTerrain","",m_DefaultSfx.str_DefaultSfxTerrain,MAX_PATH);
    pFile->GetFloat("ROOT","DefaultSfxTerrainPlayRate",0.0,&m_DefaultSfx.fPlayRate);

    hResult = S_OK;
Exit0:
    SAFE_RELEASE(pFile);
    return hResult;
}
Exemplo n.º 24
0
BOOL KSOEditor::Init()
{
    BOOL        bResult             = false;
    int         nRetCode            = 0;
    BOOL        bNetWorkInitFlag    = false;
    IIniFile*   piFile              = NULL;
    int         nPort               = 0;
    int         nMaxConnection      = 0;
    char        szLocalIP[32];

    g_SetRootPath(NULL);

    piFile = g_OpenIniFile("KSOEditorServer.ini");
    KGLOG_PROCESS_ERROR(piFile);

    piFile->GetString("Server", "IP", "127.0.0.1", szLocalIP, sizeof(szLocalIP));
    piFile->GetInteger("Server", "Port", 0, &nPort);
    piFile->GetInteger("Server", "MaxConnection", 100, &nMaxConnection);

    m_pNetworkMgr = new KNetworkMgr;
    KGLOG_PROCESS_ERROR(m_pNetworkMgr);
    
    nRetCode = m_pNetworkMgr->Init(szLocalIP, nPort, nMaxConnection);
    KGLOG_PROCESS_ERROR(nRetCode);
    bNetWorkInitFlag = true;

    bResult = true;
Exit0:
    if (!bResult)
    {
        if (bNetWorkInitFlag)
        {
            m_pNetworkMgr->UnInit();
            bNetWorkInitFlag = false;
        }
        SAFE_DELETE(m_pNetworkMgr);
    }

    KG_COM_RELEASE(piFile);
    return bResult;
}
Exemplo n.º 25
0
    void KUiFontManage::OnFontManage(HWND hParent, BOOL bManage)
    {

        m_nCurrentItemNum = 0;
        m_hWnd = NULL;
        m_hListWnd = NULL;
        m_szFont[0] = 0;
        m_pFontIni = NULL;
        m_bSel = FALSE;
        m_bManage = bManage;

        char szPath[MAX_PATH] = "";
        g_GetRootPath(szPath);
        strcat(szPath, "\\UI\\Scheme\\Elem\\Font.ini");
        strcpy(m_szFontFileName, szPath);
        m_pFontIni = g_OpenIniFile(m_szFontFileName);

        KG_PROCESS_ERROR(hParent);
        ::DialogBox((HINSTANCE)g_hPluginInstance, MAKEINTRESOURCE(IDD_WndFontManage), hParent, (DLGPROC)DlgProc);

    Exit0:
        return;
    }
Exemplo n.º 26
0
void KSceneEditorDialogAutoGrass::SaveTextureSettings()
{
	CString strTextureName;
	TCHAR strIniFileName[MAX_PATH];
	IIniFile* pInIFile = NULL;
	int nReturnCode = 0;

	KG_PROCESS_ERROR(m_nLastSel != -1);

	m_ComboxBoxTexture.GetLBText(m_nLastSel, strTextureName);
	sprintf(strIniFileName, "%s%s.ini", m_GrassTexturePath, strTextureName);

	pInIFile = g_OpenIniFile(strIniFileName, false, true);
	KG_PROCESS_ERROR(pInIFile);

	pInIFile->WriteInteger("Texture", "StrideX", m_nWidhtCount);
	pInIFile->WriteInteger("Texture", "StrideY", m_nHeightCount);

	pInIFile->Save(strIniFileName);
Exit0:
	SAFE_RELEASE(pInIFile);
	return;
}
Exemplo n.º 27
0
int  KGObjectPropertyEditDlg::ShowPropertyTable(
	CString szNamePlate, CString szTemplate, CString szIniFile
)
{
	m_listProperty.DeleteAllItems();
	m_arrayPropertyListItem.RemoveAll();

	m_szCurIniFileName = szIniFile;
	SetWindowText(m_szWindowTextt + " 正在编辑 : " + m_szCurIniFileName);

	SAFE_RELEASE(m_pIniFile);
	m_pIniFile          = g_OpenIniFile(szTemplate.GetBuffer());
	IIniFile* pIniFile  = g_OpenIniFile(szIniFile);
	IIniFile* pNameFile = g_OpenIniFile(szNamePlate.GetBuffer());

	if (!pNameFile)  return FALSE;
	if (!m_pIniFile) return FALSE;
	if (!pIniFile)   return FALSE;

	char szSection[256] = "";
	char szKey[256]     = "";
	char szPlate[256]   = "";
	char szValue[512]   = "";
	char szType[256]    = "";

	UINT uIndex = 0;

	while (m_pIniFile->GetNextSection(szSection, szSection))
	{
		PropertyListItem item(szSection, szSection);
		m_arrayPropertyListItem.Add(item);
		pNameFile->GetString(
			szSection, "Title", "未知标题", szPlate, sizeof(szPlate)
		);
		m_listProperty.InsertItem (uIndex, NULL);
		m_listProperty.SetItemText(uIndex, 0, szPlate);
		//m_listProperty.SetItemData(uIndex, VALUE_TITLE);
		uIndex++;

		*szKey = '\0';
		while (m_pIniFile->GetNextKey(szSection, szKey, szKey))
		{
			pNameFile->GetString(
				"Globe", szKey, "未知键名", szPlate, sizeof(szPlate)
			);
			if (CString(szPlate) == "未知键名")
			{
				pNameFile->GetString(
					szSection, szKey, "未知键名", szPlate, sizeof(szPlate)
				);
			}

			CString szKeyType = CString(szKey) + CString("Type");

			pNameFile->GetString(
				"Globe", szKeyType.GetBuffer(), "VALUE_UNKNOW",
				szType, sizeof(szType)
			);
			if (CString(szType) == "VALUE_UNKNOW")
			{
				pNameFile->GetString(
					szSection, szKeyType.GetBuffer(), "STRING",
					szType, sizeof(szType)
				);
			}

			m_pIniFile->GetString(
				szSection, szKey, "未知键值", szValue, sizeof(szValue)
			);
			pIniFile->GetString(
				szSection, szKey, szValue, szValue, sizeof(szValue)
			);
			m_pIniFile->WriteString(szSection, szKey, szValue);

			PropertyListItem item(szSection, szKey);
			m_arrayPropertyListItem.Add(item);

			m_listProperty.InsertItem (uIndex, NULL);
			m_listProperty.SetItemText(uIndex, 0, szPlate);
			m_listProperty.SetItemText(uIndex, 1, szValue);
			m_listProperty.SetItemData(uIndex, GetKeyType(CString(szType)));
			uIndex++;
		}
	}

	pIniFile->Release();
	pNameFile->Release();

	return TRUE;
}
Exemplo n.º 28
0
int TestLoadAllBSP()
{
    int nResult                         = false;
    int nRetCode                        = false;
    HRESULT hrRetCode                   = E_FAIL;
    unsigned uTotalCount                = 0;
    unsigned uFailedCount               = 0;
    unsigned uFailedCountSave           = 0;   
    BYTE *pbyTestFileData   = NULL;
    BYTE *pbySourceFileData = NULL;
    IIniFile *pFile                     = NULL;
    IFile *piTestFile                   = NULL;
    IKG3DModel *piModel                 = NULL;
    IKG3DResourceManager *piModelTable  = NULL;
    char szMessage[MAX_PATH]            = "";
    char szDirPath[MAX_PATH]            = "";
     TCHAR strBSPPathName[MAX_PATH]     = "";
    //vector<string> vecModelList;
    //vector<string> vecMeshList;   
    MSG msg;

    nRetCode = GetCurrentDirectory(MAX_PATH, szDirPath);
    KG_PROCESS_ERROR(nRetCode > 0 && nRetCode < MAX_PATH + 1);
    strcat(szDirPath, "\\data\\source\\*.*");
    szDirPath[MAX_PATH - 1] = '\0';
    //strcpy(szDirPath, "D:\\Kingsoft\\Game\\sword3-products\\trunk\\client\\data\\source\\NPC_source\\*.*");

    piModelTable = g_cEngineManager.Get3DModelTable();
    KGLOG_PROCESS_ERROR(piModelTable);

    pFile = g_OpenIniFile(g_cszErrorFileName[EXT_MESH],false,true);
    KGLOG_PROCESS_ERROR(pFile);

    nRetCode = GetFileList(szDirPath, &g_vecSourceList/*vecMeshList*/, EXT_MESH);
    KGLOG_PROCESS_ERROR(nRetCode);
    //g_vecSourceList.push_back("D:\\Kingsoft\\Game\\trunk\\data\\source\\maps_source\\亭塔\\T_erg风车塔001A.Mesh");
    uTotalCount = (unsigned)/*vecMeshList*/g_vecSourceList.size();

    for (unsigned i = 0; i < uTotalCount; ++i)
    {
        char szKeyName[32] = "";
        snprintf(
            szMessage, sizeof(szMessage), 
            "Mesh模型的BSP文件检查:%s", 
            /*vecMeshList*/g_vecSourceList[i].c_str()
            );
        szMessage[sizeof(szMessage) - 1] = '\0';
        SetWindowText(g_hWnd, szMessage);




        TCHAR strDriver[MAX_PATH];
        TCHAR strPath[MAX_PATH];
        TCHAR strFile[MAX_PATH];


        _splitpath_s(g_vecSourceList[i].c_str(), 
            strDriver,
            MAX_PATH,
            strPath,
            MAX_PATH,
            strFile,
            MAX_PATH,
            NULL,
            0);

        //sprintf_s(strBSPPathName,
        //    MAX_PATH,
        //    "%s%s%s.bsp",
        //    strDriver,
        //    strPath,
        //    strFile);

        //nRetCode = g_IsFileExist(strBSPPathName);

        //if (!nRetCode)
        //{
        //    /*itoa(uFailedCount, szKeyName, 10);
        //    pFile->WriteString("BSP_NotExited",szKeyName, g_vecSourceList[i].c_str());
        //    ++uFailedCount;*/
        //    continue;
        //}

        try
        {
            g_bForceGenerateBspForMesh = /*FALSE*/TRUE;
            hrRetCode = piModelTable->LoadResourceFromFile(/*vecMeshList*/g_vecSourceList[i].c_str(), 0, 0, (IKG3DResourceBase**)&piModel);
            if (FAILED(hrRetCode))
            {
                itoa(uFailedCount, szKeyName, 10);
                pFile->WriteString("ErrorMesh",szKeyName, /*vecMeshList*/g_vecSourceList[i].c_str());
                ++uFailedCount;
            }
            KG_COM_RELEASE(piModel);
            g_cEngineManager.FrameMove();
            g_bForceGenerateBspForMesh = FALSE;
            if (FAILED(hrRetCode))
            {
                continue;
            }

            //cmp
            unsigned uTestFileDataSize      = 0;
            unsigned uSourceFileDataSize    = 0;
            unsigned uSizeRead              = 0;
            

            sprintf_s(strBSPPathName,
                MAX_PATH,
                "%s%s%s.bsp",
                strDriver,
                strPath,
                strFile);

            nRetCode = g_IsFileExist(strBSPPathName);
            if (!nRetCode)
            {
                sprintf_s(strBSPPathName,
                    MAX_PATH,
                    "%s%s%s_test.bsp",
                    strDriver,
                    strPath,
                    strFile);
                nRetCode = g_IsFileExist(strBSPPathName);
                if (nRetCode)
                {
                    itoa(uFailedCount, szKeyName, 10);
                    pFile->WriteString("BSP_NotGenerate",szKeyName, g_vecSourceList[i].c_str());
                    ++uFailedCount;
                    DeleteFile(strBSPPathName);
                }
                continue;
            }

            piTestFile = g_OpenFile(strBSPPathName);
            KGLOG_PROCESS_ERROR(piTestFile);
            uSourceFileDataSize = piTestFile->Size();
            KGLOG_PROCESS_ERROR(uSourceFileDataSize > sizeof(DWORD));
            pbySourceFileData = new BYTE[uSourceFileDataSize];
            KGLOG_PROCESS_ERROR(pbySourceFileData);
            uSizeRead = piTestFile->Read(pbySourceFileData, uSourceFileDataSize);
            KGLOG_PROCESS_ERROR(uSizeRead == uSourceFileDataSize);

            KG_COM_RELEASE(piTestFile);


            sprintf_s(strBSPPathName,
                MAX_PATH,
                "%s%s%s_test.bsp",
                strDriver,
                strPath,
                strFile);

            piTestFile = g_OpenFile(strBSPPathName);
            if (!piTestFile)
            {
                itoa(uFailedCount, szKeyName, 10);
                pFile->WriteString("BSP_Don't Exited",szKeyName, g_vecSourceList[i].c_str());
                ++uFailedCount;
                SAFE_DELETE_ARRAY(pbySourceFileData);
                continue;
            }

            uTestFileDataSize = piTestFile->Size();
            KGLOG_PROCESS_ERROR(uTestFileDataSize > sizeof(DWORD));
            pbyTestFileData = new BYTE[uTestFileDataSize];
            KGLOG_PROCESS_ERROR(pbyTestFileData);
            uSizeRead = piTestFile->Read(pbyTestFileData, uTestFileDataSize);
            KGLOG_PROCESS_ERROR(uSizeRead == uTestFileDataSize);

            KG_COM_RELEASE(piTestFile);

            if (uTestFileDataSize != uSourceFileDataSize)
            {
                itoa(uFailedCount, szKeyName, 10);
                pFile->WriteString("BSP_NotMatchedSize",szKeyName, g_vecSourceList[i].c_str());
                ++uFailedCount;
                DeleteFile(strBSPPathName);
                SAFE_DELETE_ARRAY(pbyTestFileData);
                SAFE_DELETE_ARRAY(pbySourceFileData);
                continue;
            }

            nRetCode = memcmp(pbyTestFileData, pbySourceFileData, uSourceFileDataSize);
            if (nRetCode)
            {
                itoa(uFailedCount, szKeyName, 10);
                pFile->WriteString("BSP_NotMatched",szKeyName, g_vecSourceList[i].c_str());
                ++uFailedCount;
                DeleteFile(strBSPPathName);
                SAFE_DELETE_ARRAY(pbyTestFileData);
                SAFE_DELETE_ARRAY(pbySourceFileData);
                continue;
            }

            DeleteFile(strBSPPathName);
            SAFE_DELETE_ARRAY(pbyTestFileData);
            SAFE_DELETE_ARRAY(pbySourceFileData);


        }
        catch (...)
        {
            itoa(uFailedCount, szKeyName, 10);
            pFile->WriteString("Mesh_Exception",szKeyName, /*vecMeshList*/g_vecSourceList[i].c_str());
            ++uFailedCount;
        }

        while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            switch (msg.message)
            { 
            case WM_QUIT:
                break;
            default:
                TranslateMessage(&msg);
                DispatchMessage(&msg);     
            }   
        }
        if (msg.message == WM_QUIT)
            break;
    }

    //uFailedCount += uFailedCountSave;
    //uTotalCount = (unsigned)(vecModelList.size() + vecMeshList.size());
    // snprintf(
    //    szMessage, sizeof(szMessage), 
    //    "模型加载检查完成:共检查模型 %u 个 已发现错误 %u 个,请检查文件%s", 
    //    uTotalCount, uFailedCount, g_cszErrorFileName[TYPE_MDL]
    //);
    //szMessage[sizeof(szMessage) - 1] = '\0';
    //::MessageBox(g_hWnd, szMessage, "检查报告", MB_OK);

    nResult = true;
Exit0:
    if (pFile)
    {
        pFile->WriteInteger("ErrorMesh", "ErrorNum", uFailedCount);
        pFile->Save(g_cszErrorFileName[EXT_MESH]);
    }
    SAFE_DELETE_ARRAY(pbyTestFileData);
    SAFE_DELETE_ARRAY(pbySourceFileData);
    if (strstr(strBSPPathName, "_test.bsp"))
    {
        DeleteFile(strBSPPathName);
    }


    KG_COM_RELEASE(piModel);
    KG_COM_RELEASE(pFile);
    KG_COM_RELEASE(piTestFile);
    g_bForceGenerateBspForMesh = FALSE;
    g_vecSourceList.clear();
    return nResult;
}
Exemplo n.º 29
0
int KGObjectPropertyEditDlg::LoadConfig(const TCHAR pcszAbsName[])
{
	int nResult  = false;
	int nRetCode = false;

	TCHAR     szValue[MAX_PATH] = {0};
	CString   szSection;
	IIniFile* pIniFile = NULL;

	CString szPath      = /*g_Work_Directory +*/ CString("\\");
	CString szNamePlate = szPath + "nameplate.ini";
	CString szTemplate  = szPath + "template.ini";

	ASSERT(pcszAbsName);
	KG_PROCESS_ERROR(pcszAbsName);

	pIniFile = g_OpenIniFile(pcszAbsName);
	KG_PROCESS_ERROR(pIniFile);

	switch (m_eEditType)
	{
	case PROPERTY_EDIT_TYPE_EQUIP :
		szSection = "EQUIP";
		break;
	case PROPERTY_EDIT_TYPE_NPC_ANI :
		szSection = "NPC_ANI";
		break;
	case PROPERTY_EDIT_TYPE_PLAYER_ANI :
		szSection = "PLAYER_ANI";
		break;
	default:
		KG_PROCESS_ERROR(false);
		break;
	}

	pIniFile->GetString(
		szSection.GetBuffer(), "Directory", szPath.GetBuffer(),
		szValue, sizeof(szValue)
	);
	m_szDirectory = CString(szValue);

	pIniFile->GetString(
		szSection.GetBuffer(), "Nameplate", szNamePlate.GetBuffer(),
		szValue, sizeof(szValue)
	);
	m_szNamePlate = CString(szValue);

	pIniFile->GetString(
		szSection.GetBuffer(), "Template", szTemplate.GetBuffer(),
		szValue, sizeof(szValue)
	);

	m_szTemplate = CString(szValue);

	nResult = true;
Exit0:
	if (pIniFile)
	{
		pIniFile->Release();
	}
	return nResult;
}
Exemplo n.º 30
0
int TestLoadAllDetail()
{
    
    int nResult                         = false;
    int nRetCode                        = false;
    HRESULT hrRetCode                   = E_FAIL;
    unsigned uTotalCount                = 0;
    unsigned uFailedCount               = 0;
    unsigned uFailedCountSave           = 0;    
    IIniFile *pFile                     = NULL;
    IKG3DModel *piModel                 = NULL;
    IKG3DResourceManager *piModelTable  = NULL;
    char szMessage[MAX_PATH]            = "";
    char szDirPath[MAX_PATH]            = "";
    //vector<string> vecModelList;
    //vector<string> vecMeshList;   
    MSG msg;

    nRetCode = GetCurrentDirectory(MAX_PATH, szDirPath);
    KG_PROCESS_ERROR(nRetCode > 0 && nRetCode < MAX_PATH + 1);
    strcat(szDirPath, "\\data\\source\\NPC_source\\*.*");
    szDirPath[MAX_PATH - 1] = '\0';
    //strcpy(szDirPath, "D:\\Kingsoft\\Game\\sword3-products\\trunk\\client\\data\\source\\NPC_source\\*.*");

    piModelTable = g_cEngineManager.Get3DModelTable();
    KGLOG_PROCESS_ERROR(piModelTable);

    pFile = g_OpenIniFile(g_cszErrorFileName[EXT_MESH],false,true);
    KGLOG_PROCESS_ERROR(pFile);

    nRetCode = GetFileList(szDirPath, &g_vecSourceList/*vecMeshList*/, EXT_MESH);
    KGLOG_PROCESS_ERROR(nRetCode);
    uTotalCount = (unsigned)/*vecMeshList*/g_vecSourceList.size();
    /*uFailedCountSave = uFailedCount;*/
    for (unsigned i = 0; i < uTotalCount; ++i)
    {
        char szKeyName[32] = "";
        snprintf(
            szMessage, sizeof(szMessage), 
            "Mesh模型加载检查文件:%s", 
            /*vecMeshList*/g_vecSourceList[i].c_str()
            );
        szMessage[sizeof(szMessage) - 1] = '\0';
        SetWindowText(g_hWnd, szMessage);

        try
        {
            hrRetCode = piModelTable->LoadResourceFromFile(/*vecMeshList*/g_vecSourceList[i].c_str(), 0, 0, (IKG3DResourceBase**)&piModel);
            if (SUCCEEDED(hrRetCode))
            {
                KG3DModel *pModel = (KG3DModel*)piModel;
                if(pModel->GetDetail() == NULL)
                {
                    itoa(uFailedCount, szKeyName, 10);
                    pFile->WriteString("ErrorDetail",szKeyName, /*vecMeshList*/g_vecSourceList[i].c_str());
                    ++uFailedCount;
                    KGLogPrintf(KGLOG_ERR, "%s", g_vecSourceList[i].c_str());
                }
            }
            KG_COM_RELEASE(piModel);
            g_cEngineManager.FrameMove();
        }
        catch (...)
        {
            itoa(uFailedCount, szKeyName, 10);
            pFile->WriteString("Detail_Exception",szKeyName, /*vecMeshList*/g_vecSourceList[i].c_str());
            ++uFailedCount;
        }

        while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            switch (msg.message)
            {
            case WM_QUIT:
                break;
            default:
                TranslateMessage(&msg);
                DispatchMessage(&msg);     
            }   
        }
        if (msg.message == WM_QUIT)
            break;
    }
    pFile->WriteInteger("ErrorDetail", "ErrorNum", uFailedCount);
    pFile->Save(g_cszErrorFileName[EXT_MESH]);

    //uFailedCount += uFailedCountSave;
    //uTotalCount = (unsigned)(vecModelList.size() + vecMeshList.size());
    // snprintf(
    //    szMessage, sizeof(szMessage), 
    //    "模型加载检查完成:共检查模型 %u 个 已发现错误 %u 个,请检查文件%s", 
    //    uTotalCount, uFailedCount, g_cszErrorFileName[TYPE_MDL]
    //);
    //szMessage[sizeof(szMessage) - 1] = '\0';
    //::MessageBox(g_hWnd, szMessage, "检查报告", MB_OK);

    nResult = true;
Exit0:
    KG_COM_RELEASE(piModel);
    KG_COM_RELEASE(pFile);
    g_vecSourceList.clear();
    return nResult;
    
}