void CDlgView::ReadURLConfigFile(const string& strUrlFilePath,const string& localpath) { //if (Download(strUrlFilePath.c_str(),localpath.c_str())) if (DownLoadFile(strUrlFilePath.c_str(),localpath.c_str())) { ifstream ifs; ifs.open(localpath,ios::in); if (!ifs.is_open()) { return ; } //ifs.read() Json::Reader reader; Json::Value root; if (reader.parse(ifs, root,false)) { ReadLargeApp(root,m_LargeappUrl_list); ReadCommApp(root,m_commappUrl_list); ReadGamesApp(root,m_gameappUrl_list); } ifs.close(); ///删除下载的临时文件 DeleteFile(localpath.c_str()); } else { UiFun::MessageBoxEx(_T("下载配置文件失败\r\n") , _T("提示") ,MFB_OK|MFB_ERROR ); } }
void CSearchResultView::DialogEvent(TInt aCommand) { switch(aCommand) { case -98: break; case ESRDialogContentInfoWait: { if(iShowInfo) { iShowInfo->CancelSendRequest(); } } break; case ESRDialogContentListWait: { if(iInSearch) { iInSearch->CancelSendRequest(); this->iAllPage=iInSearch->GetAllPage(); this->iCurPage=iInSearch->GetCurPage(); } } break; case ESRDialogContentGradeWait: { if(iShowGrade) { iShowGrade->CancelSendRequest(); } } break; case ESRDialogAddDownLoadInfo: { if(iDownLoadState==5||iDownLoadState==2) { DownLoadFile(1); } } break; case ESRDialogDownLoad: DownLoadFile(0); break; } iSearchList->SetEdwinVisible(ETrue); }
void CSearchResultView::CheckDownLoadFile() { TBuf<50> bufTemp; TInt index=iSearchList->GetSelectedIndex(); bufTemp.Zero(); //判断是会否打开wap广告 ::ParseBuf(iInSearch->GetOneItem(index),_L(","),3,bufTemp); if(bufTemp.Compare(_L("A"))==0) { bufTemp.Zero(); ::ParseBuf(iInSearch->GetOneItem(index),_L(","),5,bufTemp); TBuf<300> url; url.Format(KADVISEURL,&iMainEngine.GetIMEI(),&bufTemp); iMainEngine.LaunchWapBrowswerL(url); return; } bufTemp.Zero(); //判断是否下载广告 ::ParseBuf(iInSearch->GetOneItem(index),_L(","),4,bufTemp); if(bufTemp.Compare(_L("A"))==0) { bufTemp.Zero(); ::ParseBuf(iInSearch->GetOneItem(index),_L(","),5,bufTemp); TBuf<300> url; url.Format(KADVISEURL,&iMainEngine.GetIMEI(),&bufTemp); TBuf<50> fileName; ::ParseBuf(iInSearch->GetOneItem(index),_L(","),0,fileName); TBuf<50> fileSize; ::ParseBuf(iInSearch->GetOneItem(index),_L(","),2,fileSize); iDownLoadState= AddDownLoadList(*this,ESRDialogAddDownLoadInfo,url,fileName,::ConvertTDesCToTInt(fileSize),0,1,1); return; } bufTemp.Zero(); ::ParseBuf(iInSearch->GetOneItem(index),_L(","),1,bufTemp); TInt rValue=::CheckFileType(bufTemp); //图片、工具、游戏 if(rValue==EFileTypeImage||rValue==EFileTypeAppOrGame) { this->GetInfo(); } else { DownLoadFile(0); //this->InitDialog(iMainEngine.GetDesById(ETurkeyTextRes_DownLoadAddToList),ESRDialogDownLoad); iSearchList->SetEdwinVisible(EFalse); } }
void CSearchResultView::ContentInfoEvent(TInt aLeftCommond) { iContentInfo=NULL; iShowInfo->CancelSendRequest(); //DELETE(iShowInfo); if(aLeftCommond==ESRDialogContentInfo) { //this->InitDialog(iMainEngine.GetDesById(ETurkeyTextRes_DownLoadAddToList),ESRDialogDownLoad); iSearchList->SetEdwinVisible(EFalse); DownLoadFile(0); } iSearchList->SetEdwinVisible(ETrue); }
int CChangePWD::ZTEChangePassWord() { char http[MAX_BUFFER_SIZE] = { 0 }; char data[MAX_BUFFER_SIZE] = { 0 }; char msg[MAX_BUFFER_SIZE] = { 0 }; char text[5]; char szTempPath[MAX_PATH], cookies[MAX_PATH], szTempName[MAX_PATH]; GetTempPath(MAX_PATH, szTempPath); GetTempFileName(szTempPath, _T("CZTE"), 0, cookies); //获取验证码和cookies GetTempFileName(szTempPath, _T("Code"), 0, szTempName); strcat(szTempName, ".png"); char TempUrl[MAX_STRING]; sprintf(TempUrl, "%s/servlet/ValidateCodeServlet", Config.m_csZTEServer); int ifSeccess = 0; for (int i = 1; i <= 3; i++) { if (ifSeccess)break; sprintf(TempUrl, "%s/servlet/ValidateCodeServlet", Config.m_csZTEServer); if (DownLoadFile(szTempName, TempUrl, NULL, DOWNTIMEOUT, NULL, cookies) == 0){ authcode(szTempName, text); sprintf(data, "userName=%s&userPassword=%s&validateCode=%s&Submit3=%%C8%%B7+++%%B6%%A8", Account, PassWordOld, text); sprintf(TempUrl, "%s/user/userLogin.action", Config.m_csZTEServer); SendPost(http, MAX_BUFFER_SIZE, TempUrl, NULL, DOWNTIMEOUT, NULL, cookies, NULL, data); ifSeccess = GetHTTPMsg(http, MAX_BUFFER_SIZE, 1, "欢迎您", NULL, NULL, msg, NULL, NULL, NULL, "<LI>"); } printf("重试次数:%d\n",i); } if (ifSeccess) { printf("\n登录完成"); //拿下post必须提交信息 char includemsg1[MAX_STRING], includemsg2[MAX_STRING], includemsg3[MAX_STRING], includemsg4[MAX_STRING], includemsg5[MAX_STRING], includemsg6[MAX_STRING], includemsg7[MAX_STRING], includemsg8[MAX_STRING]; sprintf(TempUrl, "%s/user/editUserPwd.action", Config.m_csZTEServer); if (DownLoadFileToBuffer(http, MAX_BUFFER_SIZE, TempUrl, NULL, DOWNTIMEOUT, NULL, cookies, NULL,NULL) >= 0){ GetHTTPMsg(http, MAX_BUFFER_SIZE, 3, "isSuccess", "pop", "queryReturnURL", includemsg1, includemsg2, includemsg3, "value=\"", "\""); GetHTTPMsg(http, MAX_BUFFER_SIZE, 3, "userVo.startDate", "userVo.endDate", "userVo.userType", includemsg4, includemsg5, includemsg6, "value=\"", "\""); GetHTTPMsg(http, MAX_BUFFER_SIZE, 2, "struts.token.name", "struts.token\"", NULL, includemsg7, includemsg8, NULL, "value=\"", "\""); //printf(http); //printf("\n阶段二"); //提交修改密码 sprintf(data, "isSuccess=%s&pop=%s&queryReturnURL=%s&userVo.startDate=%s&userVo.endDate=%s&userVo.userType=%s&struts.token.name=%s&struts.token=%s&oldPassword=%s&newPassword=%s&reNewPassword=%s", includemsg1, includemsg2, includemsg3, includemsg4, includemsg5, includemsg6, includemsg7, includemsg8, PassWordOld, PassWordNew1, PassWordNew2); //printf(data); sprintf(TempUrl, "%s/user/updatePwd.action", Config.m_csZTEServer); SendPost(http, MAX_BUFFER_SIZE, TempUrl, NULL, DOWNTIMEOUT, NULL, cookies, NULL, data); GetHTTPMsg(http, MAX_BUFFER_SIZE, 1, "msgSuccess", NULL, NULL, msg, NULL, NULL, "<dt>", "</dt>"); //printf(http); if (strlen(msg)) { char Remind[MAX_BUFFER_SIZE] = { 0 }; sprintf(Remind, "中兴认证密码修改%s", msg); AfxMessageBox(Remind, MB_OK | MB_ICONINFORMATION | MB_TOPMOST); if (strstr(Remind, "成功") != 0) return 1; } } } else { AfxMessageBox("登陆失败", MB_OK | MB_ICONINFORMATION | MB_TOPMOST); } DeleteFile(cookies); DeleteFile(szTempName); return 0; }
void S65ShowVideo::DownLoadFinish() { int nbegin=3; m_strUrlContent=m_strUrlContent.substr(nbegin,m_strUrlContent.length()-nbegin); CDataConvert dataConvert; m_strUrlContent=dataConvert.UTF8ToGB(m_strUrlContent.c_str()); Json* root= Json_create(m_strUrlContent.c_str()); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// string detailClassName ="S"+PersonalApi::convertIntToString(AppDelegate::S1NaviSelected) +"ShowVideo"; string currentClassName(detailClassName.c_str()); string version = currentClassName+"version"; string needUpDate = currentClassName+"needUpDate"; string newVersion = currentClassName+"newVersion"; string time = currentClassName+"time"; Json* root_Version=Json_getItem(root,"version"); if (root_Version) { string versionStr(root_Version->valuestring); if (CCUserDefault::sharedUserDefault()->getStringForKey(version.c_str()).compare(versionStr) == 0) { CCUserDefault::sharedUserDefault()->setBoolForKey(needUpDate.c_str(),false); AppDelegate::loadingLabel->setString(""); //setButtonEnabel(false); setUpUpDateLabel(CCPointMake(130, 570),CCPointMake(900, 570),CCUserDefault::sharedUserDefault()->getStringForKey(time.c_str()),CCUserDefault::sharedUserDefault()->getBoolForKey(needUpDate.c_str())); return; } else { CCUserDefault::sharedUserDefault()->setBoolForKey(needUpDate.c_str(),true); CCUserDefault::sharedUserDefault()->setStringForKey(newVersion.c_str(), root_Version->valuestring); } } Json* root_time=Json_getItem(root,"time"); if (root_time) { CCUserDefault::sharedUserDefault()->setStringForKey(time.c_str(), root_time->valuestring); } setUpUpDateLabel(CCPointMake(130, 570),CCPointMake(900, 570),CCUserDefault::sharedUserDefault()->getStringForKey(time.c_str()),CCUserDefault::sharedUserDefault()->getBoolForKey(needUpDate.c_str())); //setButtonEnabel(true); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //picture and title Json* root_smallpicture=Json_getItem(root,"video"); if (root_smallpicture && root_smallpicture->type==Json_Array) { Json* json_child=root_smallpicture->child; map<string, string> valueMap; showPicMap.clear(); showBigPicMap.clear(); int i = 0;//smal image int k = 0; int j = 0;//big image while(json_child) { Json* child_pic_url=Json_getItem(json_child,"img"); Json* child_video_url=Json_getItem(json_child,"video_url"); if (i==0) { //self { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollBigPic%d.png",AppDelegate::S1NaviSelected,j+1); string picNameStr(szsamllpicname); showBigPicMap[PersonalApi::convertIntToString(j+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(j+1)] = valueStr; } j++; } }else if (i==1) { { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } }else if (i==3) { { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } //self { if (child_pic_url) { char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } }else{ if(child_pic_url){ char szsamllpicname[512]={0}; sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1); string picNameStr(szsamllpicname); showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr; DownLoadFile(child_pic_url->valuestring,szsamllpicname); string valueStr = child_video_url->valuestring; valueMap[PersonalApi::convertIntToString(k+1)] = valueStr; } k++; } i++; json_child=json_child->next; } string str1 = "S"+PersonalApi::convertIntToString(AppDelegate::S1NaviSelected) +"5scrollPic"; string str2 = "S"+PersonalApi::convertIntToString(AppDelegate::S1NaviSelected) +"5VideoIntro"; PersonalApi::wirteVecToXml(showPicMap,str1); PersonalApi::wirteVecToXml(valueMap,str2); } checkPicDownLoading(); }