本文整理汇总了C++中CDownload::FindMoreSources方法的典型用法代码示例。如果您正苦于以下问题:C++ CDownload::FindMoreSources方法的具体用法?C++ CDownload::FindMoreSources怎么用?C++ CDownload::FindMoreSources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDownload
的用法示例。
在下文中一共展示了CDownload::FindMoreSources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Add
CDownload* CDownloads::Add(CShareazaURL* pURL)
{
if ( pURL->m_nAction != CShareazaURL::uriDownload &&
pURL->m_nAction != CShareazaURL::uriSource ) return NULL;
CSingleLock pLock( &Transfers.m_pSection, TRUE );
CDownload* pDownload = NULL;
if ( pDownload == NULL && pURL->m_bSHA1 )
pDownload = FindBySHA1( &pURL->m_pSHA1 );
if ( pDownload == NULL && pURL->m_bTiger )
pDownload = FindByTiger( &pURL->m_pTiger );
if ( pDownload == NULL && pURL->m_bED2K )
pDownload = FindByED2K( &pURL->m_pED2K );
if ( pDownload == NULL && pURL->m_bBTH )
pDownload = FindByBTH( &pURL->m_pBTH );
if ( pDownload != NULL )
{
theApp.Message( MSG_DOWNLOAD, IDS_DOWNLOAD_ALREADY,
(LPCTSTR)pDownload->GetDisplayName() );
if ( pURL->m_sURL.GetLength() ) pDownload->AddSourceURLs( pURL->m_sURL, FALSE );
return pDownload;
}
pDownload = new CDownload();
if ( pURL->m_bSHA1 )
{
pDownload->m_bSHA1 = TRUE;
pDownload->m_pSHA1 = pURL->m_pSHA1;
pDownload->m_bSHA1Trusted = TRUE;
}
if ( pURL->m_bTiger )
{
pDownload->m_bTiger = TRUE;
pDownload->m_pTiger = pURL->m_pTiger;
pDownload->m_bTigerTrusted = TRUE;
}
if ( pURL->m_bMD5 )
{
pDownload->m_bMD5 = TRUE;
pDownload->m_pMD5 = pURL->m_pMD5;
pDownload->m_bMD5Trusted = TRUE;
}
if ( pURL->m_bED2K )
{
pDownload->m_bED2K = TRUE;
pDownload->m_pED2K = pURL->m_pED2K;
pDownload->m_bED2KTrusted = TRUE;
pDownload->Share( TRUE );
}
if ( pURL->m_bBTH )
{
pDownload->m_bBTH = TRUE;
pDownload->m_pBTH = pURL->m_pBTH;
pDownload->m_bBTHTrusted = TRUE;
pDownload->Share( TRUE );
}
if ( pURL->m_sName.GetLength() )
{
pDownload->m_sRemoteName = pURL->m_sName;
}
if ( pURL->m_bSize )
{
pDownload->m_nSize = pURL->m_nSize;
}
if ( pURL->m_sURL.GetLength() )
{
if ( ! pDownload->AddSourceURLs( pURL->m_sURL, FALSE ) )
{
if ( pURL->m_nAction == CShareazaURL::uriSource )
{
delete pDownload;
return NULL;
}
}
}
pDownload->SetTorrent( pURL->m_pTorrent );
m_pList.AddTail( pDownload );
theApp.Message( MSG_DOWNLOAD, IDS_DOWNLOAD_ADDED,
(LPCTSTR)pDownload->GetDisplayName(), pDownload->GetSourceCount() );
if( ( pDownload->m_bBTH && ( GetTryingCount(TRUE) < Settings.BitTorrent.DownloadTorrents ) ) ||
( !pDownload->m_bBTH && ( GetTryingCount(FALSE) < Settings.Downloads.MaxFiles ) ) )
{
pDownload->SetStartTimer();
if ( pURL->m_nAction != CShareazaURL::uriSource )
pDownload->FindMoreSources();
}
DownloadGroups.Link( pDownload );
//.........这里部分代码省略.........
示例2: PageDownloads
//.........这里部分代码省略.........
pDownload->m_bExpanded = TRUE;
}
else if ( strAction == L"collapse" )
{
if ( CDownloadsCtrl::IsExpandable( pDownload ) )
pDownload->m_bExpanded = FALSE;
}
else if ( strAction == L"resume" )
{
pDownload->Resume();
}
else if ( strAction == L"pause" )
{
if ( ! pDownload->IsPaused() && ! pDownload->IsTasking() )
pDownload->Pause();
}
else if ( strAction == L"cancel" )
{
if ( ! pDownload->IsTasking() )
pDownload->Remove();
continue;
}
else if ( strAction == L"clear" )
{
if ( pDownload->IsCompleted() && ! pDownload->IsPreviewVisible() )
{
pDownload->Remove();
continue;
}
}
else if ( strAction == L"more_sources" )
{
// roo_koo_too improvement
pDownload->FindMoreSources();
}
}
if ( CDownloadsCtrl::IsFiltered( pDownload ) ) continue;
CDownloadGroup* pGroup = NULL;
for ( POSITION posGroup = DownloadGroups.GetIterator(); posGroup != NULL; )
{
pGroup = DownloadGroups.GetNext( posGroup );
if ( pGroup->m_bRemoteSelected && pGroup->Contains( pDownload ) ) break;
pGroup = NULL;
}
if ( pGroup == NULL ) continue;
Add( L"download_id", strDownloadID );
Add( L"download_filename", pDownload->GetDisplayName() );
Add( L"download_size", ( pDownload->m_nSize == SIZE_UNKNOWN ) ?
LoadString( IDS_STATUS_UNKNOWN ) : Settings.SmartVolume( pDownload->m_nSize ) );
int nProgress = int( pDownload->GetProgress() );
str.Format( L"%i", nProgress );
Add( L"download_percent", str );
str.Format( L"%i", 100 - nProgress );
Add( L"download_percent_inverse", str );
Add( L"download_speed", Settings.SmartSpeed( pDownload->GetMeasuredSpeed() ) );
if ( CDownloadsCtrl::IsExpandable( pDownload ) )
{
if ( pDownload->m_bExpanded )
Add( L"download_is_expanded", L"true" );
else
Add( L"download_is_collapsed", L"true" );