// 保存配置信息 BOOL COBDPNDConfigReadWrite::fSaveAppConfig(void) { CMarkup xml; CString strAppConfigFile = fCommGetAppPath() + _T("\\Config.xml"); if (!xml.Load(strAppConfigFile)) { return CONFIG_ERR_LOAD_FILE; } CString strText; xml.ResetMainPos(); xml.FindElem(); if(xml.FindChildElem(_T("System"))) { xml.IntoElem(); if(xml.FindChildElem(_T("COM_OBD"))) { strText.Format(_T("%d"),m_tagAppConfig.tagComOBD.wPort); xml.SetChildAttrib(_T("Port"),strText); //strText.Format(_T("%d"),m_tagAppConfig.tagComOBD.dwBPS); //xml.SetChildAttrib(_T("BPS"),strText); //strText.Format(_T("%d"),m_tagAppConfig.tagComOBD.wData_Bits); //xml.SetChildAttrib(_T("Data_Bits"),strText); //strText.Format(_T("%d"),m_tagAppConfig.tagComOBD.wStop_Bits); //xml.SetChildAttrib(_T("Stop_Bits"),strText); //xml.SetChildAttrib(_T("Parity"),_T("None")); } //if(xml.FindChildElem(_T("COM_GPS"))) //{ // strText.Format(_T("%d"),m_tagAppConfig.tagComGPS.wPort); // xml.SetChildAttrib(_T("Port"),strText); // strText.Format(_T("%d"),m_tagAppConfig.tagComGPS.dwBPS); // xml.SetChildAttrib(_T("BPS"),strText); // strText.Format(_T("%d"),m_tagAppConfig.tagComGPS.wData_Bits); // xml.SetChildAttrib(_T("Data_Bits"),strText); // strText.Format(_T("%d"),m_tagAppConfig.tagComGPS.wStop_Bits); // xml.SetChildAttrib(_T("Stop_Bits"),strText); // xml.SetChildAttrib(_T("Parity"),_T("None")); //} if(xml.FindChildElem(_T("Setting"))) { xml.SetChildAttrib(_T("LANGUAGE"),m_tagAppConfig.tagSetting.strLanguage); if (m_tagAppConfig.tagSetting.bSaveErrorLog) xml.SetChildAttrib(_T("Save_ErrorLog"),_T("ON")); else xml.SetChildAttrib(_T("Save_ErrorLog"),_T("OFF")); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.wBacklightDay); xml.SetChildAttrib(_T("BACKLIGHT_DAY"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.wBacklightNight); xml.SetChildAttrib(_T("BACKLIGHT_NIGHT"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.wBacklightDayStart); xml.SetChildAttrib(_T("BACKLIGHT_DAY_START"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.wBackLightDayEnd); xml.SetChildAttrib(_T("BACKLIGHT_DAY_END"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.dwSystemOffTime); xml.SetChildAttrib(_T("System_Off_Time"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.dwSystemOffMode); xml.SetChildAttrib(_T("System_Off_Mode"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.dwAutoSelPanelTime); xml.SetChildAttrib(_T("Auto_Sel_Panel_Time"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagSetting.dwDefaultStartPanel); xml.SetChildAttrib(_T("Default_Start_Panel"),strText); strText.Format(_T("%0.5f"),m_tagAppConfig.tagSetting.fInstantFuelParameter); xml.SetChildAttrib(_T("Parameter_Fuel_Instant"),strText); strText.Format(_T("%0.5f"),m_tagAppConfig.tagSetting.fAvgFuelParameter); xml.SetChildAttrib(_T("Parameter_Fuel_Avg"),strText); strText.Format(_T("%0.5f"),m_tagAppConfig.tagSetting.fFuelPrice); xml.SetChildAttrib(_T("Fuel_Price"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagSetting.dwActiveEcuID); xml.SetChildAttrib(_T("Active_ECU_ID"),strText); } if(xml.FindChildElem(_T("Set_Alarm"))) { if (m_tagAppConfig.tagAlarmSet.bTroubleCode) xml.SetChildAttrib(_T("TroubleCode"),_T("ON")); else xml.SetChildAttrib(_T("TroubleCode"),_T("OFF")); strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wSpeed); xml.SetChildAttrib(_T("Speed"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wCoolant); xml.SetChildAttrib(_T("Coolant"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wFatigue_Driving); xml.SetChildAttrib(_T("Fatigue_Driving"),strText); strText.Format(_T("%0.2f"),m_tagAppConfig.tagAlarmSet.dbFuel); xml.SetChildAttrib(_T("Fuel"),strText); xml.IntoElem(); if(xml.FindChildElem(_T("Shift"))) { strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wShiftRpm); xml.SetChildAttrib(_T("Shift_Rpm"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wShiftSpeed); xml.SetChildAttrib(_T("Shift_Speed"),strText); } if(xml.FindChildElem(_T("Volt"))) { strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wVoltMin); xml.SetChildAttrib(_T("Volt_Min"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagAlarmSet.wVoltMax); xml.SetChildAttrib(_T("Volt_Max"),strText); } xml.OutOfElem(); } xml.OutOfElem(); } if(xml.FindChildElem(_T("Mini_Dlg"))) { strText.Format(_T("%d"),m_tagAppConfig.tagMiniSpeed.dw480X272_X); xml.SetChildAttrib(_T("X_480X272"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagMiniSpeed.dw480X272_Y); xml.SetChildAttrib(_T("Y_480X272"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagMiniSpeed.dw800X480_X); xml.SetChildAttrib(_T("X_800X480"),strText); strText.Format(_T("%d"),m_tagAppConfig.tagMiniSpeed.dw800X480_Y); xml.SetChildAttrib(_T("Y_800X480"),strText); } if(xml.FindChildElem(_T("UiData"))) { xml.IntoElem(); if(xml.FindChildElem(_T("Idle"))) { strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataIdle.dwLeftUpID); xml.SetChildAttrib(_T("ID_Left_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataIdle.dwLeftMiddleID); xml.SetChildAttrib(_T("ID_Left_Middle"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataIdle.dwLeftDownID); xml.SetChildAttrib(_T("ID_Left_Down"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataIdle.dwRightUpID); xml.SetChildAttrib(_T("ID_Right_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataIdle.dwRightMiddleID); xml.SetChildAttrib(_T("ID_Right_Middle"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataIdle.dwRightDownID); xml.SetChildAttrib(_T("ID_Right_Down"),strText); } if(xml.FindChildElem(_T("Tour"))) { strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataTour.dwLeftUpID); xml.SetChildAttrib(_T("ID_Left_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataTour.dwLeftMiddleID); xml.SetChildAttrib(_T("ID_Left_Middle"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataTour.dwLeftDownID); xml.SetChildAttrib(_T("ID_Left_Down"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataTour.dwRightUpID); xml.SetChildAttrib(_T("ID_Right_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataTour.dwRightMiddleID); xml.SetChildAttrib(_T("ID_Right_Middle"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataTour.dwRightDownID); xml.SetChildAttrib(_T("ID_Right_Down"),strText); } if(xml.FindChildElem(_T("Race"))) { strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwLeftUpID); xml.SetChildAttrib(_T("ID_Left_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwLeftDownID); xml.SetChildAttrib(_T("ID_Left_Down"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwMiddleUpID); xml.SetChildAttrib(_T("ID_Middle_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwMiddleMiddleID); xml.SetChildAttrib(_T("ID_Middle_Middle"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwMiddleDownID); xml.SetChildAttrib(_T("ID_Middle_Down"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwRightUpID); xml.SetChildAttrib(_T("ID_Right_Up"),strText); strText.Format(_T("0x%08X"),m_tagAppConfig.tagUiDataRace.dwRightDownID); xml.SetChildAttrib(_T("ID_Right_Down"),strText); } xml.OutOfElem(); } if(xml.FindChildElem(_T("APP_START_LIST"))) { xml.IntoElem(); while(xml.FindChildElem(_T("APP"))) { for (int i=0;i<m_vecAppList.size();i++) { if (xml.GetChildAttrib(_T("ID")) == m_vecAppList[i].strAppID) { xml.SetChildAttrib(_T("PATH"),m_vecAppList[i].strAppPath); if (m_vecAppList[i].bAutoRun) xml.SetChildAttrib(_T("AUTO_RUN"),_T("1")); else xml.SetChildAttrib(_T("AUTO_RUN"),_T("0")); } } } xml.OutOfElem(); } xml.Save(strAppConfigFile); return TRUE; }
int parseProfessor(string path, dadosProfessor *temp){ CMarkup xml; int nTrab = 0, nArt = 0; if(!xml.Load(path)){ cout << "Erro de abertura do arquivo xml." << endl; return 1; } // ========= DADOS GERAIS =================== if (!xml.FindElem("CURRICULO-VITAE")){ cout << "Sem CV" << endl; return ERROR; } xml.IntoElem(); //seta CV como tag pai if(!xml.FindElem("DADOS-GERAIS")){ cout << "Sem DADOS-GERAIS." << endl; return ERROR; } temp->nome = xml.GetAttrib("NOME-COMPLETO"); //cout << temp.nome << endl; xml.IntoElem(); // define DADOS-GERAIS como parent if(!xml.FindElem("ATUACOES-PROFISSIONAIS")){ cout << "Sem ATUACOES-PROFISSIONAIS" <<endl; return ERROR; } if(!xml.FindChildElem("ATUACAO-PROFISSIONAL")){ cout << "Sem ATUACAO-PROFISSIONAL" << endl; return ERROR; } temp->instituicao = xml.GetChildAttrib("NOME-INSTITUICAO"); //cout << temp.instituicao << endl; xml.IntoElem(); // define ATUACAO-PROFISSIONAL como parent if(!xml.FindChildElem("ATIVIDADES-DE-PESQUISA-E-DESENVOLVIMENTO")){ cout << "Sem linha de pesquisa" << endl; return ERROR; } xml.IntoElem(); //define APD como parent if(!xml.FindChildElem("PESQUISA-E-DESENVOLVIMENTO")){ cout << "Sem linha de pesquisa" << endl; return ERROR; } xml.IntoElem(); // define PD como parent if(!xml.FindChildElem("LINHA-DE-PESQUISA")){ cout << "Sem linha de pesquisa" << endl; return ERROR; } temp->area = xml.GetChildAttrib("TITULO-DA-LINHA-DE-PESQUISA"); //cout << temp.area << endl; xml.ResetPos(); // ========= TRABALHOS EM EVENTOS =================== xml.FindElem("CURRICULO-VITAE"); // se passou pelo primeiro findelem(curriculo vitae) //passa por esse xml.IntoElem(); //seta CV como tag pai if(!xml.FindElem("PRODUCAO-BIBLIOGRAFICA")){ cout << "Sem PRODUCAO-BIBLIOGRAFICA." << endl; return ERROR; } xml.IntoElem(); if(!xml.FindElem("TRABALHOS-EM-EVENTOS")){ cout << "Sem TRABALHOS-EM-EVENTOS." << endl; return ERROR; } xml.IntoElem();// define TRABALHOS-EM-EVENTOS como parent while(xml.FindElem()){ Trabalho trab; xml.FindChildElem("DADOS-BASICOS-DO-TRABALHO"); trab.titulo = xml.GetChildAttrib("TITULO-DO-TRABALHO"); trab.ano = xml.GetChildAttrib("ANO-DO-TRABALHO"); temp->pubEventos.push_back(trab); nTrab++; } temp->nPubEventos = nTrab; xml.ResetPos(); // ========= ARTIGOS PUBLICADOS =================== xml.FindElem("CURRICULO-VITAE"); // se passou pelo primeiro findelem(curriculo vitae) //passa por esse xml.IntoElem(); //seta CV como tag pai if(!xml.FindElem("PRODUCAO-BIBLIOGRAFICA")){ cout << "Sem PRODUCAO-BIBLIOGRAFICA." << endl; return ERROR; } xml.IntoElem(); if(!xml.FindElem("ARTIGOS-PUBLICADOS")){ cout << "Sem ARTIGOS-PUBLICADOS." << endl; return ERROR; } xml.IntoElem();// define ARTIGOS-PUBLICADOS como parent while(xml.FindElem()){ Artigo artigo; xml.FindChildElem("DADOS-BASICOS-DO-ARTIGO"); artigo.titulo = xml.GetChildAttrib("TITULO-DO-ARTIGO"); artigo.ano = xml.GetChildAttrib("ANO-DO-ARTIGO"); temp->pubPeriodicos.push_back(artigo); nArt++; } temp->nPubPeriodicos = nArt; return SUCCESS; }
// 初始化应用配置信息 BOOL COBDPNDConfigReadWrite::fInitAppConfig(void) { CMarkup xml; CString strAppPath = fCommGetAppPath() + _T("\\"); CString strAppConfigFile = strAppPath + _T("Config.xml"); if (!xml.Load(strAppConfigFile)) { return CONFIG_ERR_LOAD_FILE; } xml.ResetMainPos(); xml.FindElem(); if(xml.FindChildElem(_T("System"))) { xml.IntoElem(); if(xml.FindChildElem(_T("Base"))) { m_tagAppConfig.bIsDemo = (xml.GetChildAttrib(_T("Demo_Mode"))==_T("ON")?TRUE:FALSE); m_tagAppConfig.strTextFile = xml.GetChildAttrib(_T("File_Text")); m_tagAppConfig.strFilterAppList = xml.GetChildAttrib(_T("FILTER_APP_LIST")); } if(xml.FindChildElem(_T("COM_OBD"))) { m_tagAppConfig.tagComOBD.wPort = (WORD)_ttoi(xml.GetChildAttrib(_T("Port"))); m_tagAppConfig.tagComOBD.dwBPS =(WORD) _ttoi(xml.GetChildAttrib(_T("BPS"))); m_tagAppConfig.tagComOBD.wData_Bits = (WORD)_ttoi(xml.GetChildAttrib(_T("Data_Bits"))); m_tagAppConfig.tagComOBD.wStop_Bits = (WORD)_ttoi(xml.GetChildAttrib(_T("Stop_Bits"))); m_tagAppConfig.tagComOBD.wParity = 0;//_ttoi(xml.GetChildAttrib(_T("Parity"))); } if(xml.FindChildElem(_T("COM_GPS"))) { m_tagAppConfig.tagComGPS.wPort = (WORD)_ttoi(xml.GetChildAttrib(_T("Port"))); m_tagAppConfig.tagComGPS.dwBPS = (WORD)_ttoi(xml.GetChildAttrib(_T("BPS"))); m_tagAppConfig.tagComGPS.wData_Bits = (WORD)_ttoi(xml.GetChildAttrib(_T("Data_Bits"))); m_tagAppConfig.tagComGPS.wStop_Bits = (WORD)_ttoi(xml.GetChildAttrib(_T("Stop_Bits"))); m_tagAppConfig.tagComGPS.wParity = 0;//_ttoi(xml.GetChildAttrib(_T("Parity"))); } if(xml.FindChildElem(_T("Setting"))) { m_tagAppConfig.tagSetting.strLanguage = xml.GetChildAttrib(_T("LANGUAGE")); m_tagAppConfig.tagSetting.bSaveErrorLog = (xml.GetChildAttrib(_T("Save_ErrorLog"))==_T("OFF")?FALSE:TRUE); m_tagAppConfig.tagSetting.wBacklightDay = _ttoi(xml.GetChildAttrib(_T("BACKLIGHT_DAY"))); m_tagAppConfig.tagSetting.wBacklightNight = _ttoi(xml.GetChildAttrib(_T("BACKLIGHT_NIGHT"))); m_tagAppConfig.tagSetting.wBacklightDayStart = _ttoi(xml.GetChildAttrib(_T("BACKLIGHT_DAY_START"))); m_tagAppConfig.tagSetting.wBackLightDayEnd = _ttoi(xml.GetChildAttrib(_T("BACKLIGHT_DAY_END"))); m_tagAppConfig.tagSetting.dwActiveEcuID = _ttoi(xml.GetChildAttrib(_T("Active_EUC_ID"))); m_tagAppConfig.tagSetting.str24or12 = xml.GetChildAttrib(_T("Time_24_12Hour")); m_tagAppConfig.tagSetting.dwSystemOffTime = _ttoi(xml.GetChildAttrib(_T("System_Off_Time"))); m_tagAppConfig.tagSetting.dwSystemOffMode = _ttoi(xml.GetChildAttrib(_T("System_Off_Mode"))); m_tagAppConfig.tagSetting.dwAutoSelPanelTime = _ttoi(xml.GetChildAttrib(_T("Auto_Sel_Panel_Time"))); m_tagAppConfig.tagSetting.fAvgFuelParameter = wcstod(xml.GetChildAttrib(_T("Parameter_Fuel_Avg")),0); m_tagAppConfig.tagSetting.fInstantFuelParameter = wcstod(xml.GetChildAttrib(_T("Parameter_Fuel_Instant")),0); m_tagAppConfig.tagSetting.fFuelPrice = wcstod(xml.GetChildAttrib(_T("Fuel_Price")),0); m_tagAppConfig.tagSetting.dwActiveEcuID = _ttoi(xml.GetChildAttrib(_T("Active_ECU_ID"))); } if(xml.FindChildElem(_T("Language_list"))) { xml.IntoElem(); m_tagAppConfig.vecLanguage.clear(); while(xml.FindChildElem(_T("LANGUAGE"))) { _TagLanguage tagLanData; tagLanData.strLanID = xml.GetChildAttrib(_T("LANGUAGE_ID")); tagLanData.strLanName = xml.GetChildAttrib(_T("LANGUAGE_NAME")); tagLanData.strLanSN = xml.GetChildAttrib(_T("LANGUAGE_SN")); tagLanData.strResFiles = xml.GetChildAttrib(_T("LANGUAGE_RES")); m_tagAppConfig.vecLanguage.push_back(tagLanData); } xml.OutOfElem(); } if(xml.FindChildElem(_T("Set_Alarm"))) { m_tagAppConfig.tagAlarmSet.bTroubleCode = xml.GetChildAttrib(_T("TroubleCode"))==_T("ON")?TRUE:FALSE; m_tagAppConfig.tagAlarmSet.wSpeed = _ttoi(xml.GetChildAttrib(_T("Speed"))); m_tagAppConfig.tagAlarmSet.wCoolant = _ttoi(xml.GetChildAttrib(_T("Coolant"))); m_tagAppConfig.tagAlarmSet.wFatigue_Driving = _ttoi(xml.GetChildAttrib(_T("Fatigue_Driving"))); m_tagAppConfig.tagAlarmSet.dbFuel = wcstod(xml.GetChildAttrib(_T("Fuel")),0); xml.IntoElem(); if(xml.FindChildElem(_T("Shift"))) { m_tagAppConfig.tagAlarmSet.wShiftRpm = _ttoi(xml.GetChildAttrib(_T("Shift_Rpm"))); m_tagAppConfig.tagAlarmSet.wShiftSpeed = _ttoi(xml.GetChildAttrib(_T("Shift_Speed"))); } if(xml.FindChildElem(_T("Volt"))) { m_tagAppConfig.tagAlarmSet.wVoltMin = _ttoi(xml.GetChildAttrib(_T("Volt_Min"))); m_tagAppConfig.tagAlarmSet.wVoltMax = _ttoi(xml.GetChildAttrib(_T("Volt_Max"))); } xml.OutOfElem(); } xml.OutOfElem(); } if(xml.FindChildElem(_T("Mini_Dlg"))) { m_tagAppConfig.tagMiniSpeed.dw480X272_X = _ttoi(xml.GetChildAttrib(_T("X_480X272"))); m_tagAppConfig.tagMiniSpeed.dw480X272_Y = _ttoi(xml.GetChildAttrib(_T("Y_480X272"))); m_tagAppConfig.tagMiniSpeed.dw800X480_X = _ttoi(xml.GetChildAttrib(_T("X_800X480"))); m_tagAppConfig.tagMiniSpeed.dw800X480_Y = _ttoi(xml.GetChildAttrib(_T("Y_800X480"))); } if(xml.FindChildElem(_T("UiData"))) { xml.IntoElem(); if(xml.FindChildElem(_T("Idle"))) { m_tagAppConfig.tagUiDataIdle.dwLeftUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Up"))); m_tagAppConfig.tagUiDataIdle.dwLeftMiddleID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Middle"))); m_tagAppConfig.tagUiDataIdle.dwLeftDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Down"))); m_tagAppConfig.tagUiDataIdle.dwRightUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Up"))); m_tagAppConfig.tagUiDataIdle.dwRightMiddleID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Middle"))); m_tagAppConfig.tagUiDataIdle.dwRightDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Down"))); } if(xml.FindChildElem(_T("Tour"))) { m_tagAppConfig.tagUiDataTour.dwLeftUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Up"))); m_tagAppConfig.tagUiDataTour.dwLeftMiddleID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Middle"))); m_tagAppConfig.tagUiDataTour.dwLeftDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Down"))); m_tagAppConfig.tagUiDataTour.dwRightUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Up"))); m_tagAppConfig.tagUiDataTour.dwRightMiddleID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Middle"))); m_tagAppConfig.tagUiDataTour.dwRightDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Down"))); } if(xml.FindChildElem(_T("Race"))) { m_tagAppConfig.tagUiDataRace.dwLeftUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Up"))); m_tagAppConfig.tagUiDataRace.dwLeftDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Left_Down"))); m_tagAppConfig.tagUiDataRace.dwRightUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Up"))); m_tagAppConfig.tagUiDataRace.dwRightDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Right_Down"))); m_tagAppConfig.tagUiDataRace.dwMiddleUpID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Middle_Up"))); m_tagAppConfig.tagUiDataRace.dwMiddleMiddleID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Middle_Middle"))); m_tagAppConfig.tagUiDataRace.dwMiddleDownID = fCommStr2Hex(xml.GetChildAttrib(_T("ID_Middle_Down"))); } xml.OutOfElem(); } if(xml.FindChildElem(_T("Sound"))) { m_tagAppConfig.tagSoundFile.strDong = strAppPath + xml.GetChildAttrib(_T("Dong")); m_tagAppConfig.tagSoundFile.strInitialze = strAppPath + xml.GetChildAttrib(_T("Initialze")); m_tagAppConfig.tagSoundFile.strStart = strAppPath + xml.GetChildAttrib(_T("Start")); m_tagAppConfig.tagSoundFile.strGetData = strAppPath + xml.GetChildAttrib(_T("GetData")); m_tagAppConfig.tagSoundFile.strAlarmCoolant = strAppPath + xml.GetChildAttrib(_T("AlarmCoolant")); m_tagAppConfig.tagSoundFile.strAlarmFatigueDriving = strAppPath + xml.GetChildAttrib(_T("AlarmFatigueDriving")); m_tagAppConfig.tagSoundFile.strAlarmOverSpeed = strAppPath + xml.GetChildAttrib(_T("AlarmOverSpeed")); m_tagAppConfig.tagSoundFile.strAlarmVoltHigh = strAppPath + xml.GetChildAttrib(_T("AlarmVoltHigh")); m_tagAppConfig.tagSoundFile.strAlarmVoltLow = strAppPath + xml.GetChildAttrib(_T("AlarmVoltLow")); m_tagAppConfig.tagSoundFile.strAlarmTrouble = strAppPath + xml.GetChildAttrib(_T("AlarmTrouble")); } if(xml.FindChildElem(_T("GPS_LIST"))) { xml.IntoElem(); m_vecGPSList.clear(); while(xml.FindChildElem(_T("GPS"))) { TagAppInfo tagAppInfo; tagAppInfo.strAppID = xml.GetChildAttrib(_T("ID")); tagAppInfo.strAppName = xml.GetChildAttrib(_T("NAME_CHS")); tagAppInfo.strAppPath = xml.GetChildAttrib(_T("FOLDER")); tagAppInfo.strAppExe = xml.GetChildAttrib(_T("EXE")); tagAppInfo.bAutoRun = FALSE; m_vecGPSList.push_back(tagAppInfo); } xml.OutOfElem(); } if(xml.FindChildElem(_T("DSA_LIST"))) { xml.IntoElem(); m_vecDSAList.clear(); while(xml.FindChildElem(_T("DSA"))) { TagAppInfo tagAppInfo; tagAppInfo.strAppID = xml.GetChildAttrib(_T("ID")); tagAppInfo.strAppName = xml.GetChildAttrib(_T("NAME_CHS")); tagAppInfo.strAppPath = xml.GetChildAttrib(_T("FOLDER")); tagAppInfo.strAppExe= xml.GetChildAttrib(_T("EXE")); tagAppInfo.bAutoRun = FALSE; m_vecDSAList.push_back(tagAppInfo); } xml.OutOfElem(); } if(xml.FindChildElem(_T("APP_START_LIST"))) { xml.IntoElem(); m_vecAppList.clear(); while(xml.FindChildElem(_T("APP"))) { TagAppInfo tagAppInfo; tagAppInfo.strAppID = xml.GetChildAttrib(_T("ID")); if (tagAppInfo.strAppID == _T("1")) tagAppInfo.strAppName = theMainDlg->fGetBinText(DS_SETUP_GUIDE_DSA_TITLE); if (tagAppInfo.strAppID == _T("2")) tagAppInfo.strAppName = theMainDlg->fGetBinText(DS_SETUP_GUIDE_GPS_TITLE); tagAppInfo.strAppPath = xml.GetChildAttrib(_T("PATH")); if (xml.GetChildAttrib(_T("AUTO_RUN")) == _T("1")) tagAppInfo.bAutoRun = TRUE; else tagAppInfo.bAutoRun = FALSE; m_vecAppList.push_back(tagAppInfo); } xml.OutOfElem(); } return TRUE; }
/* SET_ITEM_DATA(type, Type, false); SET_ITEM_DATA(version, Version, true); SET_ITEM_DATA(downurl, DownURL, true); SET_ITEM_DATA(downpath, DownPath, false); SET_ITEM_DATA(description, Description, false); SET_ITEM_DATA(force, Force, false); SET_ITEM_DATA(regsrv, RegSrv, false); */ BOOL CUpdateUtil::ReadXML(CString& strXMLdoc, CItemList* pSourceItemList, int nKind) { CString strData = ""; if(strXMLdoc.IsEmpty()) return FALSE; CMarkup xml; if(!xml.SetDoc(strXMLdoc)) return FALSE; xml.ResetPos(); if(!xml.FindElem(_T("update-data"))) return FALSE; UTIL_CANCEL(); while(xml.FindChildElem(_T("file"))) { UTIL_CANCEL(); strData = ""; strData = xml.GetChildAttrib(_T("name")); if(!strData.IsEmpty()) { xml.IntoElem(); if(nKind == UPDATE_KIND_SOURCE) { PUPDATE_DATA pFileData = (PUPDATE_DATA)pSourceItemList->GetNewItem(); memset(pFileData, 0, sizeof(UPDATE_DATA)); STRCPY(Name); if(xml.FindChildElem(_T("type"))) { DATA_INIT_AND_DEPOSIT(); STRCPY(Type); } if(xml.FindChildElem(_T("version"))) { DATA_INIT_AND_DEPOSIT(); STRCPY(Version); } if(xml.FindChildElem(_T("size"))) { DATA_INIT_AND_DEPOSIT(); pFileData->Size = CString2Integer(strData); } if(xml.FindChildElem(_T("downurl"))) { DATA_INIT_AND_DEPOSIT(); STRCPY(DownURL); } else return FALSE; if(xml.FindChildElem(_T("downpath"))) { DATA_INIT_AND_DEPOSIT(); strData = GetFolderPath(strData); STRCPY(DownPath); } if(xml.FindChildElem(_T("description"))) { DATA_INIT_AND_DEPOSIT(); STRCPY(Description); } if(xml.FindChildElem(_T("force"))) { DATA_INIT_AND_DEPOSIT_NOCASE(); STRCPY(Force); } if(xml.FindChildElem(_T("regsrv"))) { DATA_INIT_AND_DEPOSIT_NOCASE(); STRCPY(RegSrv); } if(xml.FindChildElem(_T("checksum"))) { DATA_INIT_AND_DEPOSIT_NOCASE(); STRCPY(CheckSum); } if(xml.FindChildElem(_T("optionflag"))) { DATA_INIT_AND_DEPOSIT(); pFileData->OptionFlag = CString2Integer(strData); } } else { PUPDATE_DATA pFileData = (PUPDATE_DATA)pSourceItemList->GetNewItem(); memset(pFileData, 0, sizeof(UPDATE_DATA)); STRCPY(Name); if(xml.FindChildElem(_T("version"))) { DATA_INIT_AND_DEPOSIT(); STRCPY(Version); } else { return FALSE; } if(xml.FindChildElem(_T("downpath"))) { DATA_INIT_AND_DEPOSIT(); strData = GetFolderPath(strData); STRCPY(DownPath); } } xml.OutOfElem(); } } return TRUE; }