BOOL CCreateBatchDownload::BuildBatchList() { if (m_bBLParametersChanged == false) return TRUE; GetDlgItemText (IDC_URL, m_strUrl); if (FALSE == CheckUrl ()) return FALSE; m_iAlphaFrom = m_wndA.GetCurSel (); m_iAlphaTo = m_iAlphaFrom + m_wndZ.GetCurSel () + 1; CString strNumbers; GetDlgItemText (IDC_NUMBERS, strNumbers); if (false == m_bl.Create (m_strUrl, strNumbers, (char)('A' + m_iAlphaFrom), (char)('A' + m_iAlphaTo))) { MessageBox (LS (L_SYNTAXERROR), LS (L_INPERR), MB_ICONERROR); GetDlgItem (IDC_NUMBERS)->SetFocus (); return FALSE; } FreeDownloads (); m_bBLParametersChanged = false; return TRUE; }
void CCreateBatchDownload::OnQuerysize() { if (FALSE == CheckUrl ()) return; if (FALSE == ReadAuth ()) return; if (m_bBLParametersChanged) { if (FALSE == BuildBatchList ()) return; m_pvDownloads = GenerateDownloads (); } CWaitDlg dlg; dlg.StartWaiting (LS (L_QUERINGSIZE), _threadCalcSize, TRUE, this, &dlg); }
void CHelperItemSet::InitPaihangTree(const char* worldid) { if(m_worldIdList.size()>0 ) { //for(int i=0;i<(int)m_worldIdList.size();i++) //{ // if(strcmp(((String)m_worldIdList[i]).c_str(),worldid)==0) return; //} } m_worldIdList.push_back(String(worldid)); int ArryLenth=3; char *Anchors[]={"top50level.html","top50money.html","top50xinfa.html"}; wchar_t *Names[]={L"高手排行(TOP50)", L"富豪排行(TOP50)", L"心法排行(TOP50)"}; if(!m_rootItemPaihang) return; char *PathStart="http://tl.sohu.com/tlbbrank"; char szPath[MAX_PATH]; char szAnchor[MAX_PATH]; for(int i=0;i<ArryLenth;i++) { memset(szAnchor, 0, MAX_PATH); memset(szPath, 0, MAX_PATH); strcpy(szPath, PathStart); strcat(szPath, "/"); strcat(szPath,worldid); strcat(szPath,"/"); strcat(szPath,Anchors[i]); WString itemName(Names[i]); strcpy(szAnchor,Anchors[i]); strcat(szAnchor,worldid); String itemAnchor(szAnchor); String itemUrl(szPath); itemUrl=CheckUrl(itemUrl); CHelperItem item(itemName, itemAnchor,itemUrl ); m_rootItemPaihang->AddChildItem(item); } }
void CHandleOutSearch::HandleChildElement(TiXmlNode* aElement) { TInt index=iPointArray.Count()-1; TInt itemIndex=iPointArray[index]->GetItemCount()-1; if(itemIndex<0) { iPointArray[index]->CreatNewItem(); itemIndex=0; } if(aElement->NoChildren()) { if(iFlag) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->Value())); CleanupStack::PushL(buf); if(buf->Compare(_L("br"))==0) { if(!iPointArray[index]->GetItem(itemIndex).IsNull()) iPointArray[index]->CreatNewItem(); } if(buf->Compare(_L("br"))!=0&&buf->Compare(_L("img"))!=0&&buf->Compare(_L("input"))!=0&&buf->Compare(_L("|"))!=0) { if(buf->Left(2).Compare(_L("--"))==0) { TInt f=0; for(TInt i=0;i<buf->Length();i++) { if(buf->Mid(i,1).Compare(_L("-"))!=0) { f=1; break; } } if(f==0) { iFlag=EFalse; } } if(iFlag) iPointArray[index]->GetItem(itemIndex).SetName(*buf); else { if(!iPointArray[index]->GetItem(itemIndex).IsNull()) iPointArray[index]->CreatNewItem(); } } iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); } } else { HBufC8* tag=TPtrC8((const TUint8*)aElement->Value()).Alloc(); CleanupStack::PushL(tag); TInt value=CheckTag(*tag); CleanupStack::PopAndDestroy(1); if(value>0) { switch(value) { case 1: //P±êÇ© { TiXmlNode* element=aElement->FirstChild(); while(element!=0) { HandleChildElement(element); element=element->NextSibling(); } } break; case 2: //Á¬½Ó±êÇ© { HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc(); CleanupStack::PushL(bufUrl); TInt urlFlag=CheckUrl(*bufUrl); if(urlFlag>0) { iPointArray[index]->GetItem(itemIndex).SetUrl(*bufUrl); } CleanupStack::PopAndDestroy(1); if(urlFlag==1||urlFlag==2) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); iPointArray[index]->GetItem(itemIndex).SetName(*buf); iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); iPointArray[index]->GetItem(itemIndex).SetIsLink(ETrue); iPointArray[index]->CreatNewItem(); } else { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc(); CleanupStack::PushL(bufUrl); if(CheckUrl(*bufUrl)==3) { if(buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_DownPage))==0||buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_HXML_DPage))==0) { iPointArray[index]->SetNextPageUrl(*bufUrl); } else if(buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_UpPage))==0||buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_HXML_UPage))==0) { iPointArray[index]->SetPrePageUrl(*bufUrl); } } iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(2); } } break; case 4://»»ÐбêÇ© if(!iPointArray[index]->GetItem(itemIndex).IsNull()&&iFlag) iPointArray[index]->CreatNewItem(); break; case 3://×ÖÌå±êÇ© { if(iFlag) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); iPointArray[index]->GetItem(itemIndex).SetName(*buf); iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); } } break; } } } }