BOOL EGSnow::Init() { EGCIniFile Ini("ini/scene.ini"); int snow_num= Ini.ReadInt("snow", "snownum"); m_width = Ini.ReadInt("snow", "width"); m_height = Ini.ReadInt("snow", "height"); m_depth = Ini.ReadInt("snow", "depth"); top_of_camera = Ini.ReadInt("snow", "top_of_camera"); char * texFile = Ini.ReadText("snow", "texFile"); isBlend = Ini.ReadInt("snow","isBlend"); if(EGParticle::Init(snow_num)) { for(int loop = 0 ; loop < m_iMaxNum ; ++loop) { ResetPaticle(&pList_particle[loop]); } if(snow_texture.InitTexture(texFile , TRUE)) return TRUE; else return FALSE; } else return FALSE; }
int main() { int u, v, l, sum; while(scanf("%s",st) != EOF) { Ini(); sum = 0; u = st[0] - 'a'; l = strlen(st); sum += l; v = st[l-1] - 'a'; Link[u][v] = Link[v][u] = l; F[u] ++; F[v] ++; while(1) { scanf("%s",st); if(!strcmp(st, "deadend")) break; u = st[0] - 'a'; l = strlen(st); v = st[l-1] - 'a'; Link[u][v] = Link[v][u] = l; sum += l; F[u] ++; F[v] ++; } Cal(sum); for(int i = 0; i<30; i++) F[i] = 0; } return 0; }
// 从文件读取原始列表 BOOL CSkillList::LoadSkillList(const char* stepfilename, const char* dir_name) { Release(); // 读取技能名称对应的CommandID char *index="SkillStep"; CIni Ini("data/SkillStep.ini"); int num=Ini.GetContinueDataNum(index); for(int i=0; i<num; i++) { int nCommandID; char *tmp=Ini.ReadCaption(index, i); nCommandID=atoi(tmp); //获得指令Id SAFE_DELETE(tmp); tmp=Ini.ReadText(index, i); m_mapStepNameID[tmp]=nCommandID; SAFE_DELETE(tmp); } // 读取目录中的所有技能文件 list<string> listFileName; FindFile(dir_name, ".skill", &listFileName); for(list<string>::iterator it=listFileName.begin(); it!=listFileName.end(); it++) { const char* filename = it->c_str(); LoadOneSkill(filename); } return true; }
bool OUMapTableImg::LoadFromIni(const char *path) { OUIniFile Ini(path); m_nWidth = Ini.GetInt("main", "width"); m_nHeight = Ini.GetInt("main", "height"); /** ÒÎ×Ó */ int nSeats = Ini.GetInt("main", "seat"); char sec[20]; for(int i = 0; i < nSeats; i++) { sprintf(sec, "seat%d", i + 1); OUMapTableInnerImg* pImg = new OUMapTableInnerImg(); pImg->m_emType = OUIIT_SEAT; pImg->m_pImg = OUMapTableImg::GetImage(Ini.GetString(sec, "img", "null.png").c_str()); pImg->m_nX = Ini.GetInt(sec, "x"); pImg->m_nY = Ini.GetInt(sec, "y"); pImg->m_nLayer = Ini.GetInt(sec, "lay"); m_Layers.push_back(pImg); } /** ×À×Ó */ sprintf(sec, "table"); OUMapTableInnerImg* pImg = new OUMapTableInnerImg(); pImg->m_emType = OUIIT_TABLE; pImg->m_pImg = OUMapTableImg::GetImage(Ini.GetString(sec, "img", "null.png").c_str()); pImg->m_nX = Ini.GetInt(sec, "x"); pImg->m_nY = Ini.GetInt(sec, "y"); pImg->m_nLayer = Ini.GetInt(sec, "lay"); m_Layers.push_back(pImg); /** Êý×Ö */ sprintf(sec, "num"); pImg = new OUMapTableInnerImg(); pImg->m_emType = OUIIT_NUMBER; pImg->m_pImg = NULL; pImg->m_nX = Ini.GetInt(sec, "x"); pImg->m_nY = Ini.GetInt(sec, "y"); pImg->m_nLayer = Ini.GetInt(sec, "lay"); m_Layers.push_back(pImg); m_szNumberFormat = Ini.GetString(sec, "img", "%d.png"); sort(m_Layers.begin(), m_Layers.end(), __innerimg_cmp); /** ¶¯¾²Ì¬ */ m_bStatic = true; for(int i = 0; i < m_Layers.size(); i++) { if(m_Layers[i]->m_pImg && !m_Layers[i]->m_pImg->m_bStatic) { m_bStatic = false; } } return true; }
void CRelaxReminderDlg::SaveSettingToIniFile() { // 进入临界区保护 EnterCriticalSection(&m_csSettingFile); CreateIniFileHeader(m_strConfigFile); CIni Ini(m_strConfigFile); // 先保存版本信息 Ini.Write("Version", "CurrentVersion", VersionNum2String(m_dwVersion)); // 保存时间参数 Ini.Write("Time", "WorkDuration", m_tm.GetWD()); Ini.Write("Time", "ShortRelaxDuration", m_tm.GetSRD()); Ini.Write("Time", "EnableLongRelax", m_tm.GetEnableLongRelax()); Ini.Write("Time", "LongRelaxFrequency", m_tm.GetLRF()); Ini.Write("Time", "LongRelaxDuration", m_tm.GetLRD()); // 保存提示参数 Ini.Write("Notify", "PreNotify", m_bPreNotify); Ini.Write("Notify", "LockInput", m_bLockInput); Ini.Write("Notify", "LockType", m_iLockType); Ini.Write("Notify", "GraceTimeBeforeLockInput", m_iGraceTimeBeforeLockInput); Ini.Write("Notify", "DarkerScreen", m_bDarkerScreen); Ini.Write("Notify", "DarkerScreenAlpha", m_iDarkerScreenAlpha); Ini.Write("Notify", "DarkerScreenAnimate", m_eDarkerScreenAnimateType); Ini.Write("Notify", "DarkerScreenColor", m_colorDarkerScreen); Ini.Write("Notify", "DarkerScreenType", m_eDarkerScreenType); Ini.Write("Notify", "NotifyWindowType", m_eNotifyWindowType); // 保存自动状态转换参数 Ini.Write("AutoAway", "EnableAutoPause", m_tm.GetEnableAutoPause()); Ini.Write("AutoAway", "AutoPauseThreshold", m_tm.GetAPT()); Ini.Write("AutoAway", "FullscreenPause", m_tm.GetEnableFullScreenPause()); Ini.Write("AutoAway", "EnableAutoReset", m_tm.GetEnableAutoReset()); Ini.Write("AutoAway", "AutoResetThreshold", m_tm.GetART()); // 保存语言参数 Ini.Write("Language", "LanguageId", m_strLanguageId); // 保存杂项参数 Ini.Write("Misc", "LockComputer", m_bLockComputer); Ini.Write("Misc", "CloseMonitor", m_bCloseMonitor); Ini.Write("Misc", "ShowFloatingWindow", m_bShowFloatingWindowAtStartup); Ini.Write("Misc", "ShowTrayIcon", m_bShowTrayIconAtStartup); Ini.Write("Misc", "EnableLog", GetEnableLog()); Ini.Write("Misc", "LogLevel", GetLogLevel()); Ini.Write("Misc", "LogFileSize", GetLogFileSize()); Ini.Write("Misc", "AutoStartWithSystem", GetAppAutoStartWithSystem()); // 离开临界区保护 LeaveCriticalSection(&m_csSettingFile); }
void CDialogOptionLanguage::LoadListCtrl() { // 设置显示属性 ListView_SetExtendedListViewStyle(m_listLanguages, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES); m_listLanguages.SetBkColor(GetSysColor(COLOR_3DFACE)); m_listLanguages.SetTextBkColor(GetSysColor(COLOR_WINDOW)); m_listLanguages.SetTextColor(GetSysColor(COLOR_WINDOWTEXT)); // 设置列名称 m_listLanguages.InsertColumn(0, "LANGUAGE"); m_listLanguages.SetColumnWidth(0, 130); m_listLanguages.InsertColumn(1, "LANGUAGE NAME"); m_listLanguages.SetColumnWidth(1, 130); m_listLanguages.InsertColumn(2, "AVAILABLE"); m_listLanguages.SetColumnWidth(2, 71); // 加载INI文件中的语言列表 CIni Ini(m_pdlgMain->m_strLanguageFile); CString strLanguageList = Ini.ReadText("Index", "LanguageList"); strLanguageList += ","; int iStart = 0; int iEnd = 0; while (iStart <= strLanguageList.GetLength() - 1) { CString strLanguageId; iEnd = strLanguageList.Find(',', iStart); strLanguageId = strLanguageList.Mid(iStart, iEnd - iStart); strLanguageId.TrimLeft(); strLanguageId.TrimRight(); BOOL bLanguageNameExist; BOOL bLanguageAvailableExist; bLanguageNameExist = Ini.CheckExist(strLanguageId, "LanguageName"); bLanguageAvailableExist = Ini.CheckExist(strLanguageId, "Available"); if (bLanguageNameExist && bLanguageAvailableExist) { CString strLanguageName; strLanguageName = Ini.ReadText(strLanguageId, "LanguageName"); BOOL bLanguageAvailable; bLanguageAvailable = Ini.ReadInt(strLanguageId, "Available"); InsertItem(strLanguageId.GetBuffer(0), strLanguageName.GetBuffer(0), bLanguageAvailable); } iStart = iEnd + 1; } }
void COptions::Save( void ) { CRect Rect; ofstream Ini( "Accomplice.ini" ); if ( !Ini ) return; Ini << "// Accomplice Options Save File" << endl; Ini << "Window=" << max(0,pAccomplice->PosX-3) << "," << max(0,pAccomplice->PosY-22) << endl; Ini << "AlwaysTop=" << ( AlwaysOnTop ? "TRUE" : "FALSE" ) << endl; Ini << "Link2UO=" << ( Link2UO ? "TRUE" : "FALSE" ) << endl; Ini << "PrefixHex=" << ( PrefixHex ? "TRUE" : "FALSE" ) << endl; Ini << "CommandPrefix=" << (LPCSTR)CmdPrefix << endl; pNav->GetWindowRect( Rect ); Ini << "NavMap=" << pNav->Center.x << "," << pNav->Center.y << "," << Rect.left << "," << Rect.top << "," << Rect.right << "," << Rect.bottom << endl; Ini.close(); }
BOOL CDialogOptionLanguage::LoadLanguageListFromIniFile() { // 判断LanguageList是否存在 CIni Ini(m_pdlgMain->m_strLanguageFile); BOOL bLanguageListExist = Ini.CheckExist("Index", "LanguageList"); // 根据语言列表是否存在设置界面显示 GetDlgItem(IDC_STATIC_LANGUAGE_SELECT)->ShowWindow(bLanguageListExist); GetDlgItem(IDC_LIST_LANGUAGES)->ShowWindow(bLanguageListExist); GetDlgItem(IDC_STATIC_NO_LANGUAGE_FILE)->ShowWindow(!bLanguageListExist); if (!bLanguageListExist) { return FALSE; } LoadListCtrl(); return TRUE; }
/**\brief * 初始化 */ BOOL EGStaticObjMgr::LoadIni(char* filename,char* index) { EGCIniFile Ini(filename); m_nObjNum=Ini.ReadInt(index,"ObjNum"); m_pObjArray=new StaticObj[m_nObjNum]; //初始化模型 char* strFile; char* strIndex; for(unsigned int i=0; i<m_nObjNum; ++i) { strFile = Ini.ReadText(index, i); strIndex = Ini.ReadData(index,i); m_pObjArray[i].LoadIni(strFile, strIndex); _FREE(strFile); _FREE(strIndex); } return TRUE; }
cBlockIDMap(void) { cIniFile Ini("items.ini"); if (!Ini.ReadFile()) { return; } long KeyID = Ini.FindKey("Items"); if (KeyID == cIniFile::noID) { return; } unsigned NumValues = Ini.GetNumValues(KeyID); for (unsigned i = 0; i < NumValues; i++) { AString Name = Ini.ValueName(KeyID, i); if (Name.empty()) { continue; } AString Value = Ini.GetValue(KeyID, i); AddToMap(Name, Value); } // for i - Ini.Values[] }
void CRelaxReminderDlg::SaveStatisticsToIniFile() { // 进入临界区保护 EnterCriticalSection(&m_csStatisticFile); CreateIniFileHeader(m_strStatisticFile); CIni Ini(m_strStatisticFile); Ini.Write("Time", "TotalSeconds", m_tm.StatGet_TotalSeconds()); Ini.Write("Time", "WorkSeconds", m_tm.StatGet_WorkSeconds()); Ini.Write("Time", "SRelaxSeconds", m_tm.StatGet_SRelaxSeconds()); Ini.Write("Time", "LRelaxSeconds", m_tm.StatGet_LRelaxSeconds()); Ini.Write("Time", "PauseSeconds", m_tm.StatGet_PauseSeconds()); Ini.Write("Time", "ResetSeconds", m_tm.StatGet_ResetSeconds()); Ini.Write("Relax", "SRelaxTimes", m_tm.StatGet_SRelaxTimes()); Ini.Write("Relax", "LRelaxTimes", m_tm.StatGet_LRelaxTimes()); Ini.Write("Relax", "DelayedTimes", m_tm.StatGet_DelayedTimes()); Ini.Write("Relax", "SkippedTimes", m_tm.StatGet_SkippedTimes()); // 离开临界区保护 LeaveCriticalSection(&m_csStatisticFile); }
BOOL CRelaxReminderDlg::LoadStatisticsFromIniFile() { // 进入临界区保护 EnterCriticalSection(&m_csStatisticFile); CIni Ini(m_strStatisticFile); // 设置统计变量 m_tm.StatSet_TotalSeconds(Ini.ReadInt("Time", "TotalSeconds")); m_tm.StatSet_WorkSeconds(Ini.ReadInt("Time", "WorkSeconds")); m_tm.StatSet_SRelaxSeconds(Ini.ReadInt("Time", "SRelaxSeconds")); m_tm.StatSet_LRelaxSeconds(Ini.ReadInt("Time", "LRelaxSeconds")); m_tm.StatSet_PauseSeconds(Ini.ReadInt("Time", "PauseSeconds")); m_tm.StatSet_ResetSeconds(Ini.ReadInt("Time", "ResetSeconds")); m_tm.StatSet_SRelaxTimes(Ini.ReadInt("Relax", "SRelaxTimes")); m_tm.StatSet_LRelaxTimes(Ini.ReadInt("Relax", "LRelaxTimes")); m_tm.StatSet_DelayedTimes(Ini.ReadInt("Relax", "DelayedTimes")); m_tm.StatSet_SkippedTimes(Ini.ReadInt("Relax", "SkippedTimes")); // 离开临界区保护 LeaveCriticalSection(&m_csStatisticFile); return TRUE; }
bool CCommCommander::OpenComm(CString iniFilePathAndName) { char* iniFile = iniFilePathAndName.GetBuffer(iniFilePathAndName.GetLength()); CIni Ini(iniFile); int SelPortNO,SelBaudRate,SelDataBits,SelStopBits; char SelParity; CString temp; temp = Ini.ReadText("comm","PortNO"); temp.Delete(0,3); SelPortNO=atoi(temp); SelBaudRate=atoi(Ini.ReadText("comm","BaudRate")); SelDataBits=atoi(Ini.ReadText("comm","DataBits")); SelParity = atoi(Ini.ReadText("comm","Parity")); SelStopBits=atoi(Ini.ReadText("comm","StopBits")); if(m_SerialPort.InitPort(&(this->OnReceiveChar),SelPortNO,SelBaudRate,SelParity,SelDataBits,SelStopBits,EV_RXCHAR|EV_CTS,512)) { m_SerialPort.StartMonitoring(); TRACE("----Open Comm-------------"); } else { AfxMessageBox("该串口已经被其他应用程序所占用!\n请选择其它的串口"); return false; } m_Zero = Ini.ReadText("comm","Zero"); m_One = Ini.ReadText("comm","One"); m_Two = Ini.ReadText("comm","Two"); m_Three = Ini.ReadText("comm","Three"); m_Four = Ini.ReadText("comm","Four"); m_Five= Ini.ReadText("comm","Five"); m_Six = Ini.ReadText("comm","Six"); m_Seven = Ini.ReadText("comm","Seven"); m_Eight = Ini.ReadText("comm","Eight"); m_Nine = Ini.ReadText("comm","Nine"); m_VolumneUp = Ini.ReadText("comm","VolumneUp"); m_VolumneDown = Ini.ReadText("comm","VolumneDown"); m_SingerOn = Ini.ReadText("comm","SingerOn"); m_SingerOff = Ini.ReadText("comm","SingerOff"); m_SongBegin = Ini.ReadText("comm","SongBegin"); m_SongIdel = Ini.ReadText("comm","SongIdel"); m_SongCancel = Ini.ReadText("comm","SongCancel"); m_Play = Ini.ReadText("comm","Play"); m_Cancel1 = Ini.ReadText("comm","Cancel1"); m_Cancel2 = Ini.ReadText("comm","Cancel2"); m_Pause = Ini.ReadText("comm","Pause"); m_Applause = Ini.ReadText("comm","Applause"); m_TuneUp = Ini.ReadText("comm","TuneUp"); m_TuneDown = Ini.ReadText("comm","TuneDown"); m_Service = Ini.ReadText("comm","Service"); m_micUp = Ini.ReadText("comm","MicUp"); m_micDown = Ini.ReadText("comm","MicDown"); return true; }
void COptions::Load( void ) { /*No errors on load here. Instead just keep moving. This file shouldn't be user modified, so just keep us from crashing, and let defaults take over for errored values. */ ifstream Ini( "accomplice.ini" ); if ( !Ini ) return; char Buffer[128], *Word; CRect Rect; const char *Delim = "=/,\n\r "; const char *PrefixDelim = "\n\r "; while ( !Ini.eof() && !Ini.fail() ) { Ini.getline( Buffer, 128 ); if ( Buffer[0] == 0 || ( Buffer[0] == '/' && Buffer[1] == '/' ) ) continue; Word = strtok(Buffer, Delim); if ( !strcmpi("Window",Word) ) { if ( (Word = strtok(NULL,Delim)) ) pAccomplice->PosX = atoi(Word); if ( (Word = strtok(NULL,Delim)) ) pAccomplice->PosY = atoi(Word); } else if ( !strcmpi( "NavMap", Word ) ) { Word=strtok(NULL,Delim); pNav->Center.x = atoi(Word); Word=strtok(NULL,Delim); pNav->Center.y = atoi(Word); Word=strtok(NULL,Delim); Rect.left = atoi(Word); Word=strtok(NULL,Delim); Rect.top = atoi(Word); Word=strtok(NULL,Delim); Rect.right = atoi(Word); Word=strtok(NULL,Delim); Rect.bottom = atoi(Word); pNav->SetWindowPos( NULL, Rect.left, Rect.top, Rect.Width(), Rect.Height(), SWP_NOZORDER ); } else if ( !strcmpi("AlwaysTop",Word) ) { if ( (Word = strtok(NULL,Delim)) ) { if ( !strcmpi(Word,"TRUE") ) AlwaysOnTop = TRUE; else AlwaysOnTop = FALSE; } } else if ( !strcmpi("Link2UO",Word) ) { if ( (Word = strtok(NULL,Delim)) ) { if ( !strcmpi(Word,"TRUE") ) Link2UO = TRUE; else Link2UO = FALSE; } } else if ( !strcmpi("PrefixHex",Word) ) { if ( (Word = strtok(NULL,Delim)) ) { if ( !strcmpi(Word,"TRUE") ) PrefixHex = TRUE; else PrefixHex = FALSE; } } else if ( !strcmpi("CommandPrefix",Word) ) { CmdPrefix = strtok(NULL,PrefixDelim); } else { pSplash->MessageBox( "Error reading \"Accomplice.ini\"\nUnknown token.", "Ini Error", MB_OK|MB_ICONERROR ); } } Ini.close(); }
BOOL CRelaxReminderDlg::LoadSettingFromIniFile() { // 进入临界区保护 EnterCriticalSection(&m_csSettingFile); // 打开配置文件 CIni Ini(m_strConfigFile); // 先判断版本信息是否存在。若不存在,直接返回FALSE,加载默认参数。 BOOL bVersionExist = Ini.CheckExist("Version", "CurrentVersion"); if (bVersionExist == FALSE) { AppLog2Buf(L_WARN, "config file[%s] does NOT have version info.", m_strConfigFile); LeaveCriticalSection(&m_csSettingFile); return FALSE; } // 读取版本信息 CString strIniFileVersion = Ini.ReadText("Version", "CurrentVersion"); UINT dwIniFileVersion = VersionString2Num(strIniFileVersion); if (dwIniFileVersion == m_dwVersion) { AppLog2Buf(L_MSG, "config file version is %s, compatible with main app.", strIniFileVersion); } else { AppLog2Buf(L_WARN, "config file version is %s, file converting.", strIniFileVersion); } switch (dwIniFileVersion) { case VERSION_0_8_4: m_eDarkerScreenType = (EMultiMonitorType)Ini.ReadInt("Notify", "DarkerScreenType"); m_eNotifyWindowType = (EMultiMonitorType)Ini.ReadInt("Notify", "NotifyWindowType"); m_iGraceTimeBeforeLockInput = Ini.ReadInt("Notify", "GraceTimeBeforeLockInput"); case VERSION_0_8_3: case VERSION_0_8_2: case VERSION_0_8_1: case VERSION_0_8: case VERSION_0_7_14: m_strLanguageId = Ini.ReadText("Language", "LanguageId"); case VERSION_0_7_13: m_bShowFloatingWindowAtStartup = Ini.ReadInt("Misc", "ShowFloatingWindow"); m_bShowTrayIconAtStartup = Ini.ReadInt("Misc", "ShowTrayIcon"); case VERSION_0_7_12: m_tm.SetEnableFullScreenPause(Ini.ReadInt("AutoAway", "FullscreenPause")); case VERSION_0_7_11: case VERSION_0_7_10: m_eDarkerScreenAnimateType = (EAnimateType)Ini.ReadInt("Notify", "DarkerScreenAnimate"); m_colorDarkerScreen = Ini.ReadInt("Notify", "DarkerScreenColor"); case VERSION_0_7_9: case VERSION_0_7_8: case VERSION_0_7_7: SetEnableLog(Ini.ReadInt("Misc", "EnableLog")); SetLogLevel((ELogLevel)Ini.ReadInt("Misc", "LogLevel")); SetLogFileSize((ELogFileSize)Ini.ReadInt("Misc", "LogFileSize")); SetAppAutoStartWithSystem(Ini.ReadInt("Misc", "AutoStartWithSystem"), m_strAppFile); case VERSION_0_7_6: case VERSION_0_7_5: case VERSION_0_7_4: // 设置时间参数 m_tm.SetWD(Ini.ReadInt("Time", "WorkDuration")); m_tm.SetSRD(Ini.ReadInt("Time", "ShortRelaxDuration")); m_tm.SetEnableLongRelax(Ini.ReadInt("Time", "EnableLongRelax")); m_tm.SetLRF(Ini.ReadInt("Time", "LongRelaxFrequency")); m_tm.SetLRD(Ini.ReadInt("Time", "LongRelaxDuration")); // 设置提示参数 m_bPreNotify = Ini.ReadInt("Notify", "PreNotify"); m_bLockInput = Ini.ReadInt("Notify", "LockInput"); m_iLockType = Ini.ReadInt("Notify", "LockType"); m_bDarkerScreen = Ini.ReadInt("Notify", "DarkerScreen"); m_iDarkerScreenAlpha = Ini.ReadInt("Notify", "DarkerScreenAlpha"); // 设置自动状态转换参数 m_tm.SetEnableAutoPause(Ini.ReadInt("AutoAway", "EnableAutoPause")); m_tm.SetAPT(Ini.ReadInt("AutoAway", "AutoPauseThreshold")); m_tm.SetEnableAutoReset(Ini.ReadInt("AutoAway", "EnableAutoReset")); m_tm.SetART(Ini.ReadInt("AutoAway", "AutoResetThreshold")); // 设置杂项参数 m_bLockComputer = Ini.ReadInt("Misc", "LockComputer"); m_bCloseMonitor = Ini.ReadInt("Misc", "CloseMonitor"); break; default: AppLog2Buf(L_WARN, "invalid config file version[%s].", strIniFileVersion); break; } // 离开临界区保护 LeaveCriticalSection(&m_csSettingFile); return (dwIniFileVersion == m_dwVersion); }
//---------------------------------------------------------------------------------------------------------------------------------------- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // +-----------------------+ // | Class OneNebuRayon | // +-----------------------+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------------------------- OneNebuRayon::OneNebuRayon() { Ini(); }
Crono::Crono() { Ini(); }
LPSTR ReadIniFile(LPSTR* pFile,LPCSTR szSection,BYTE& bFileIsReg) { LPWSTR pPath=GetDefaultFileLocation(L"locate.ini",TRUE); if (pPath==NULL) return NULL; bFileIsReg=TRUE; char* pFileContent=NULL; try { CFile Ini(pPath,CFile::defRead|CFile::otherErrorWhenEOF,TRUE); DWORD dwSize=Ini.GetLength(); pFileContent=new char[dwSize+1]; Ini.Read(pFileContent,dwSize); pFileContent[dwSize]='\0'; Ini.Close(); } catch (...) { if (pFileContent!=NULL) delete[] pFileContent; delete[] pPath; return NULL; } delete[] pPath; LPCSTR pPtr=NULL; LPSTR pKeyName=NULL; CString Key,Value; if (szSection!=NULL) pPtr=FindSectionStart(pFileContent,szSection); if (pPtr==NULL) pPtr=FindSectionStart(pFileContent,"DEFAULT"); while (pPtr!=NULL) { pPtr=FindNextValue(pPtr,Key,Value); if (Key.IsEmpty()) break; while (Value.LastChar()==' ') Value.DelLastChar(); if (Key.CompareNoCase("KEY")==0) pKeyName=Value.GiveBuffer(); else if (Key.CompareNoCase("FILE")==0) { if (pFile!=NULL) *pFile=Value.GiveBuffer(); } else if (Key.CompareNoCase("FILETYPE")==0) { if (Value.CompareNoCase("BIN")==0) bFileIsReg=FALSE; else if (Value.CompareNoCase("REG")==0) bFileIsReg=TRUE; } } delete[] pFileContent; return pKeyName; }