本文整理汇总了C++中CIniFile类的典型用法代码示例。如果您正苦于以下问题:C++ CIniFile类的具体用法?C++ CIniFile怎么用?C++ CIniFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIniFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAniKeyFrameCfg
CIniFile* CAniKeyFrameCfg::GetAniKeyFrameCfg(const TCHAR* szName)
{
MapAniKeyFrameCfg::iterator it = ms_mapAniKeyFrameCfg.find(szName);
if (it == ms_mapAniKeyFrameCfg.end())
{
MapNpcName2AniFileName::iterator it = m_mapNpcName2AniFileName.find(szName);
if (it != m_mapNpcName2AniFileName.end())
{
string strAniFileName = (*it).first;
string strAniFile = "server/keyframeinfo/" + (*it).second + ".fky";
CIniFile* pIniFile = new CIniFile;
if (pIniFile->Open(GAME_PATH_ALIAS_RES.c_str(), utf8_to_utf16(strAniFile).c_str()))
{
ms_mapAniKeyFrameCfg.insert(make_pair(strAniFileName, pIniFile));
return pIniFile;
}
else
{
SafeDelete(pIniFile);
return NULL;
}
}
else
{
return NULL;
}
}
return it->second;
}
示例2: RomIniFile
CGameStatusPage::CGameStatusPage (HWND hParent, const RECT & rcDispay )
{
if (!Create(hParent,rcDispay))
{
return;
}
CIniFile RomIniFile (g_Settings->LoadString(SupportFile_RomDatabase).c_str());
strlist Keys;
RomIniFile.GetKeyList("Rom Status",Keys);
stdstr Status = g_Settings->LoadString(Rdb_Status);
CModifiedComboBoxTxt * ComboBox;
ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE),Rdb_Status);
if (ComboBox)
{
for (strlist::iterator item = Keys.begin(); item != Keys.end(); item++ )
{
if (strstr(item->c_str(),".Sel") != NULL) { continue; }
if (strstr(item->c_str(),".Auto") != NULL) { continue; }
ComboBox->AddItem(item->c_str(), item->c_str());
}
ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT));
}
CModifiedEditBox * TxtBox;
TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_CORE),Rdb_NotesCore,true);
TxtBox->SetTextField(GetDlgItem(IDC_NOTES_CORE_TEXT));
TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_PLUGIN),Rdb_NotesPlugin,true);
TxtBox->SetTextField(GetDlgItem(IDC_NOTES_PLUGIN_TEXT));
UpdatePageSettings();
}
示例3: SetTabFile
bool CAniKeyFrameCfg::LoadAniKeyFrameConfig(const string& szFileName)
{
using namespace CfgChk;
CTxtTableFile TabFile;
if (!TabFile.Load(PATH_ALIAS_CFG.c_str(), szFileName.c_str()))
return false;
SetTabFile(TabFile, "¶¯×÷¹Ø¼üÖ¡±í");
ClearMap(ms_mapAniKeyFrameCfg);
for( int32 i = 1; i < TabFile.GetHeight(); ++i )
{
SetLineNo(i);
string strAniFileName;
ReadItem(strAniFileName, szNT_Name);
string strAniFile = "server/keyframeinfo/" + strAniFileName;
CIniFile* pIniFile = new CIniFile;
if (pIniFile->Open(GAME_PATH_ALIAS_RES.c_str(), utf8_to_utf16(strAniFile).c_str()))
{
ms_mapAniKeyFrameCfg.insert(make_pair(strAniFileName, pIniFile));
}
else
{
SafeDelete(pIniFile);
}
}
return true;
}
示例4: _T
/*************************************************
Function: SetPathSave
Description: 设置在ini文件中的存储路径值
Table Accessed:
Table Updated:
Input:
在ini文件中的存储路径值
Output:
Return:
Others:
History:
<Date> <Version> <Author> <Modification>
1.2015/11/05 1.0.0 ZCQ 创建
****************************************************/
void CSysCfg::SetPathSave(CString strPath)
{
CString strFilePath = m_strInstancePath + _T("SysCfg.ini");
CIniFile fileCfg;
fileCfg.SetFileName(strFilePath);
fileCfg.SaveValue(_T("SysCfg"),_T("Path"),strPath);
}
示例5: LoadIni
void CGuide::LoadIni()
{
// 从单独文件中读取需要展示的图片数,方便新版特性时CGuide类不需要改变,图片命名格式固定
// 可以根据需要自行更改
CIniFile tmpIni;
tmpIni.SetPathName(m_strApp + _T("\\bin\\guide.ini"));
m_nCount = tmpIni.GetInt(_T("GUIDE"), _T("count"), 0);
}
示例6: sprintf
BOOL CNWNXResources::OnCreate(const char* LogDir){
//Max path
char log[MAX_PATH];
//Set logfile
sprintf (log, "%s\\nwnx_resources.txt", LogDir);
//Call the base class to make the log
if (!CNWNXBase::OnCreate(log))
return false;
Log( 0, "NWNX Resources v0.1 (Written by Terra_777)\n\n" );
idLookup=NULL;
extLookup=NULL;
ResTable=NULL;
ResTLen=NULL;
WIN32_FIND_DATA fileData;
HANDLE hSearch = FindFirstFile( "nwnx_resman.dll", &fileData );
if (hSearch != INVALID_HANDLE_VALUE){
Log( 0, "This plugin isnt compatible with nwnx_resman.dll!\n" );
FindClose( hSearch );
return false;
}
FindClose( hSearch );
//open the inifile
CIniFile iniFile ("nwnx.ini");
iniFile.ReadString( "RESOURCEMANAGER", "SourcePath", ResFolder, 260, "\0" );
priority = iniFile.ReadInteger( "RESOURCEMANAGER", "LogLevel", 1 );
BaseRes = iniFile.ReadBool( "RESOURCEMANAGER", "BaseOnly", true );
Behavior = iniFile.ReadInteger( "RESOURCEMANAGER", "Behavior", 0 );
//Set our nwnx memory funcs
nwnx_malloc = (void *(__cdecl *)(size_t))0x0040D550;
//nwns free routine
nwnx_free = (void (__cdecl *)(void *))0x0040D560;
extSubFldr=NULL;
ExtLen=0;
//Call the function to hook what we want
HookCNWRES( );
SetPathRepository( &iniFile );
return true;
}
示例7: OstTraceFunctionEntry0
CIniFile* CIniFile::NewL(const TDesC& aName)
/**
* Factory function for CIniFile.
*
* @param aName The name of the ini file to be used, e.g. "GPRSBTT.INI".
*/
{
OstTraceFunctionEntry0( CINIFILE_NEWL_TDESC_ENTRY );
CIniFile* self = new(ELeave) CIniFile;
CleanupStack::PushL(self);
self->ConstructL(aName, KDefaultIniFileDir);
CleanupStack::Pop(self);
OstTraceFunctionExit0( CINIFILE_NEWL_TDESC_EXIT );
return self;
}
示例8: GetProcessTime
bool CAniKeyFrameCfg::CheckNpcMapAniKeyFrameCfg()
{
uint64 uBeginTime = GetProcessTime();
map<string, string> mAniLostMap; //map<骨骼名,错误信息>
MapAniKeyFrameCfg::iterator iter = ms_mapAniKeyFrameCfg.begin();
for (; iter != ms_mapAniKeyFrameCfg.end(); iter++)
{
string sName = (*iter).first;
const CNpcFightBaseData* pFighterData = CNpcFightBaseDataMgr::GetInst()->GetEntity(sName);
if (!pFighterData || pFighterData->m_fAttackScope >= 3.0f) //攻击距离大于3表明是远程的,这里只检查近程怪物
continue;
MapNpcName2AniFileName::iterator iter2 = m_mapNpcName2AniFileName.find(sName); //目前只检测Npc的
if (iter2 != m_mapNpcName2AniFileName.end() && NpcInfoMgr::BeFightNpc(sName.c_str()))
{
string sAniName = (*iter2).second;
CIniFile* pIniFile = (*iter).second;
string sAniLostInfo = "";
if (pIniFile->GetValue("attack01", "k", 0) == 0)
{
sAniLostInfo = "缺少攻击关键帧信息!";
}
if (pIniFile->GetValue("attack01", "e", 0) == 0)
{
sAniLostInfo = sAniLostInfo + "缺少攻击全帧信息!";
}
map<string, string>::iterator iter3 = mAniLostMap.find(sAniName);
if (sAniLostInfo != "" && iter3 == mAniLostMap.end() )
{
mAniLostMap[sAniName] = sAniLostInfo;
}
}
}
//输出错误信息到美术的错误log里面去
map<string, string>::iterator iter3 = mAniLostMap.begin();
//cout<<"总共有:【"<<mAniLostMap.size()<<"】个错误"<<endl;
for (; iter3 != mAniLostMap.end(); iter3++)
{
string sErrorInfo = "keyframeinfo: 【" + (*iter3).first + "】 " + (*iter3).second;
//ArtErr(sErrorInfo.c_str());
}
uint64 uEndTime = GetProcessTime();
cout << "关联检测Npc模型边和美术关建帧信息完毕!耗时:" << (uEndTime - uBeginTime) << " 毫秒!\n";
return true;
}
示例9: SaveMileage
BOOL CTerminalConfig::SaveMileage(DWORD dwMileage)
{
if( GetFileAttributes(PATH_CONFIG_INI) == 0xFFFFFFFF )
return FALSE;
CIniFile IniFile;
//加载文件失败
if( !IniFile.Load( PATH_CONFIG_INI ) )
return FALSE;
IniFile.SetInt(_T("TerminalParam"), _T("VEHICLE_ODOMETER"), dwMileage);
IniFile.Flush();
// IniFile.Release();
return TRUE;
}
示例10: sprintf
BOOL CNWNXFuncs::OnCreate(const char* LogDir) {
// call the base class function
char __log[MAX_PATH];
sprintf (__log, "%s\\nwnx_funcs.txt", LogDir);
if (!CNWNXBase::OnCreate(__log))
return false;
CIniFile iniFile ("nwnx.ini");
int debugLevel = iniFile.ReadInteger("FUNCS", "DebugLevel", 0);
LogFile::SetDebugLevel(debugLevel);
nSkill = iniFile.ReadInteger("FUNCS", "Number_of_Skills", 28);
bHookCreateGeometry = iniFile.ReadInteger("FUNCS", "HOOK_CustomTrapGeometry", 0);
bOverrideMaximumDexMod = iniFile.ReadInteger("FUNCS", "HOOK_OverrideMaximumDexMod", 0);
if ((bHookRemovePCFromWorld = iniFile.ReadInteger("FUNCS", "HOOK_OnPlayerLeaving", 0))) {
iniFile.ReadString("FUNCS", "OnPlayerLeavingScript", OnPlayerLeavingScript, 17, "onplayerleaving");
}
if ((bHookTimeOfDayChange = iniFile.ReadInteger("FUNCS", "HOOK_TimeOfDayChange", 0))) {
iniFile.ReadString("FUNCS", "OnTimeOfDayChangeScript", OnTimeOfDayChangeScript, 17, "mod_timechanged");
}
WriteLogHeader(debugLevel);
FunctionHooks = new CHookFunctions();
NssLocalVariables = new CNssLocalVariables;
NssAreas = new CNssAreas;
NssUtility = new CNssUtility;
NssItems = new CNssItems;
NssEffects = new CNssEffects;
NssCreatureStats = new CNssCreatureStats(nSkill);
Visibility = new CVisibility;
NssCustomTrigger = new CNssCustomTrigger;
NssCreature = new CNssCreature;
NssFeats = new CNssFeats;
NssSpells = new CNssSpells;
NssObject = new CNssObject;
NssLock = new CNssLock;
NssPlayer = new CNssPlayer;
NssServer = new CNssServer;
NssTransition = new CNssTransition;
NssItemProperty = new CNssItemProperty;
NssModule = new CNssModule;
MainLookup = NssLocalVariables;
return true;
}
示例11: SendConfig
void AxisSettings::SendConfig(MyDevice* d)
{
//Send acceleration
CIniFile ini;
unsigned char buffer[64] = {0};
buffer[0] = 1;
buffer[1] = RECEIVER_CONFIG;
buffer[2] = CONFIG_REC_AXIS;
buffer[3] = CONFIG_AXIS_ACCELERATION;
*((float*)(buffer + 4)) = StringToFloat(ini.GetValue("maxLinearAcceleration", "axis", iniFile));
d->SendRawData(buffer, sizeof(buffer));
//Send update period
buffer[3] = CONFIG_AXIS_UPDATE_PERIOD;
*((uint32_t*)(buffer + 4)) = StringToInt(ini.GetValue("updatePeriod", "axis", iniFile));
d->SendRawData(buffer, sizeof(buffer));
//Send jerk
buffer[3] = CONFIG_AXIS_JERK;
*((float*)(buffer + 4)) = StringToFloat(ini.GetValue("maxLinearJerk", "axis", iniFile));
d->SendRawData(buffer, sizeof(buffer));
}
示例12: LoadBuyPriority
// load the buy priority configuration file
void CCSBuyManager::LoadBuyPriority()
{
// load the ini file
CIniFile ini;
// try to load the map specific buy configuration file
ini.Load(g_General.BuildFileName(va("buy_cs(%s).ini", g_pServer->GetMapName())));
// if the map specific buy configuration file doesn't exist,
// load the general buy configuration file.
if (!ini.Valid())
ini.Load(g_General.BuildFileName("buy_cs.ini"));
#define PARSE_PRIORITY(szString, vecTable) \
{ \
char *pszStart = (char *)szString; \
\
while (pszStart && *pszStart) { \
char *pszEnd = strchr(pszStart, ','); \
vecTable.push_back(atoi(pszStart)); \
\
if (pszEnd == NULL) \
break; \
\
pszStart = pszEnd + 1; \
} \
}
// parse each line in the file...
PARSE_PRIORITY(ini.Get("CT", "Aggressive"), aggressive_ct);
PARSE_PRIORITY(ini.Get("CT", "Normal"), normal_ct);
PARSE_PRIORITY(ini.Get("CT", "Defensive"), defensive_ct);
PARSE_PRIORITY(ini.Get("T", "Aggressive"), aggressive_t);
PARSE_PRIORITY(ini.Get("T", "Normal"), normal_t);
PARSE_PRIORITY(ini.Get("T", "Defensive"), defensive_t);
}
示例13: wxPanel
PreviewWindow::PreviewWindow(wxWindow *parent, int x, int y, int w, int h, long style, const wxString &name):
wxPanel(parent, x, y, w, h, style, name), wheelPosition(0), zoomFactor(0.2f), drawTrajectory(true)
{
Connect(this->GetId(), wxEVT_PAINT, wxPaintEventHandler(PreviewWindow::OnPaint));
Connect(this->GetId(), wxEVT_MOTION, wxMouseEventHandler(PreviewWindow::OnMouseMove));
Connect(this->GetId(), wxEVT_MOUSEWHEEL, wxMouseEventHandler(PreviewWindow::OnWheelMoved));
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
CIniFile ini;
originSize = StringToFloat(ini.GetValue("originSize", "UI", iniFile));
zoomFactor = StringToFloat(ini.GetValue("zoomCoefficient", "UI", iniFile));
lineWidth = StringToFloat(ini.GetValue("lineWidth", "UI", iniFile));
rapidColour = ParseColour(ini.GetValue("rapidColour", "UI", iniFile));
normalColour = ParseColour(ini.GetValue("normalColour", "UI", iniFile));
cCWColour = ParseColour(ini.GetValue("CWColour", "UI", iniFile));
cCCWColour = ParseColour(ini.GetValue("CCWColour", "UI", iniFile));
trajectoryColour = ParseColour(ini.GetValue("trajectoryColour", "UI", iniFile));
backgroundColour = ParseColour(ini.GetValue("backgroundColour", "UI", iniFile));
}
示例14: process_ini_file
void HCVTreatment_TwoDrug::process_ini_file(CIniFile& INIFile)
{
const string Directories_Name = "Directories";
const string InputDir_Name = "InputDir";
const string HCVTreatment_TwoDrugs_Name = "HCVTreatment_TwoDrugs";
const string rate_mort_Tx_Name = "rate_mort_Tx";
const string rate_quit_Tx_Name = "rate_quit_Tx";
const string Effectiveness_Name = "Effectiveness";
const string cost_Tx_wk_Name = "cost_Tx_wk";
const string cost_Tx_sideeffects_Name = "cost_Tx_sideeffects";
const string qol_Tx_decrement_wk_Name = "qol_Tx_decrement_wk";
rate_mort_Tx = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, rate_mort_Tx_Name);
rate_quit_Tx = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, rate_quit_Tx_Name);
cost_Tx_wk = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, cost_Tx_wk_Name);
cost_Tx_sideeffects = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, cost_Tx_sideeffects_Name);
qol_Tx_decrement_wk = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, qol_Tx_decrement_wk_Name);
string InputDir = INIFile.GetValue(Directories_Name, InputDir_Name);
string Effectiveness_File = INIFile.GetValue(HCVTreatment_TwoDrugs_Name, Effectiveness_Name);
string effectiveness_path(InputDir);
effectiveness_path.append(Effectiveness_File);
ifstream effectiveness_data;
effectiveness_data.open(effectiveness_path.c_str() );
if (!effectiveness_data) { // Check that the file was opened
cerr << "Unable to open file " << effectiveness_path << endl;
exit(1); // call system to stop
}
EffectivenessTable.loadData(effectiveness_data);
effectiveness_data.close();
}
示例15: LoadSettings
static void LoadSettings()
{
CIniFile ini;
ini.OpenDefault();
Settings.lVersion = 0;
// general section
CIniSection* sctn = ini.GetSection( g_szGeneralSection );
Settings.dwSnapshot = sctn->GetValueInt( g_szSnapshot, ED_MINI_DUMP );
LPCTSTR str = sctn->GetValueString( g_szDumpPath, _T("") );
_tcsncpy( Settings.szDumpPath, str, _countof(Settings.szDumpPath) );
Settings.szDumpPath[_countof(Settings.szDumpPath) - 1] = 0;
// crash section
sctn = ini.GetSection( g_szCrashSection );
Settings.dwFirstChance = sctn->GetValueInt( g_szFirstChance, ED_DONT_DUMP );
Settings.dwSecondChance = sctn->GetValueInt(g_szSecondChance, ED_MINI_DUMP);
Settings.bAutoDelete = sctn->GetValueBool( g_szAutoDelete, true );
// user exception list
sctn = ini.GetSection( g_szUserExceptionSection );
size_t pos = sctn->GetFirstKeyPosition();
while( pos != 0xffffffff )
{
CIniKey* key = sctn->GetNextKey( pos );
CExceptionInfo ei;
ei.bUser = true;
ei.bFiltered = false;
ei.dwCode = _tcstoul( key->GetName(), NULL, 0 );
_tcsncpy( ei.szName, key->GetValueString(), _countof(ei.szName) );
ei.szName[_countof(ei.szName) - 1] = 0;
g_aException.Add( ei );
}
// filter section
sctn = ini.GetSection( g_szFilterSection );
pos = sctn->GetFirstKeyPosition();
while( pos != 0xffffffff )
{
CIniKey* key = sctn->GetNextKey( pos );
DWORD code = _tcstoul( key->GetName(), NULL, 0 );
CExceptionInfo* pei = GetExceptionInfoByCode( code );
if( pei != NULL )
pei->bFiltered = key->GetValueBool();
}
}