本文整理汇总了C++中CDownload::GetSourceCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CDownload::GetSourceCount方法的具体用法?C++ CDownload::GetSourceCount怎么用?C++ CDownload::GetSourceCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDownload
的用法示例。
在下文中一共展示了CDownload::GetSourceCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Add
CDownload* CDownloads::Add(CQueryHit* pHit, BOOL bAddToHead)
{
CSingleLock pLock( &Transfers.m_pSection, TRUE );
CDownload* pDownload = NULL;
if ( pDownload == NULL && pHit->m_bSHA1 )
pDownload = FindBySHA1( &pHit->m_pSHA1 );
if ( pDownload == NULL && pHit->m_bTiger )
pDownload = FindByTiger( &pHit->m_pTiger );
if ( pDownload == NULL && pHit->m_bED2K )
pDownload = FindByED2K( &pHit->m_pED2K );
if ( pDownload != NULL )
{
theApp.Message( MSG_DOWNLOAD, IDS_DOWNLOAD_ALREADY, (LPCTSTR)pHit->m_sName );
pDownload->AddSourceHit( pHit );
pDownload->Resume();
}
else
{
pDownload = new CDownload();
pDownload->AddSourceHit( pHit, TRUE );
if ( bAddToHead ) m_pList.AddHead( pDownload );
else m_pList.AddTail( pDownload );
theApp.Message( MSG_DOWNLOAD, IDS_DOWNLOAD_ADDED,
(LPCTSTR)pDownload->GetDisplayName(), pDownload->GetSourceCount() );
if( pDownload->m_bSHA1 ) pDownload->m_bSHA1Trusted = TRUE;
else if( pDownload->m_bED2K ) pDownload->m_bED2KTrusted = TRUE;
}
pHit->m_bDownload = TRUE;
DownloadGroups.Link( pDownload );
Transfers.StartThread();
if ( ( (pDownload->GetSourceCount() == 0 ) || ( pDownload->m_bED2K && ! pDownload->m_bSHA1 ) )
&&( (GetTryingCount() < Settings.Downloads.MaxFiles ) || ( bAddToHead ) ) )
{
pDownload->SetStartTimer();
}
return pDownload;
}
示例2: GetCount
int CDownloads::GetCount(BOOL bActiveOnly) const
{
if ( ! bActiveOnly ) return m_pList.GetCount();
int nCount = 0;
for ( POSITION pos = GetIterator() ; pos ; )
{
CDownload* pDownload = GetNext( pos );
if ( ! pDownload->IsMoving() && ! pDownload->IsPaused() &&
pDownload->GetSourceCount( TRUE ) > 0 )
nCount++;
}
return nCount;
}