Пример #1
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;
}
Пример #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;
    }