当前位置: 首页>>代码示例>>C++>>正文


C++ CDownload::AddReview方法代码示例

本文整理汇总了C++中CDownload::AddReview方法的典型用法代码示例。如果您正苦于以下问题:C++ CDownload::AddReview方法的具体用法?C++ CDownload::AddReview怎么用?C++ CDownload::AddReview使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDownload的用法示例。


在下文中一共展示了CDownload::AddReview方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnSearchDownload

void CBaseMatchWnd::OnSearchDownload() 
{
	CSingleLock pSingleLock( &m_pMatches->m_pSection, TRUE );
	CPtrList pFiles, pHits;
	POSITION pos;
	
	for ( pos = m_pMatches->m_pSelectedFiles.GetHeadPosition() ; pos ; )
	{
		CMatchFile* pFile = (CMatchFile*)m_pMatches->m_pSelectedFiles.GetNext( pos );
		
		pSingleLock.Unlock();
		
		switch ( CheckExisting( pFile->m_bSHA1, &pFile->m_pSHA1, pFile->m_bTiger, &pFile->m_pTiger, pFile->m_bED2K, &pFile->m_pED2K ) )
		{
		case 1:
			pFiles.AddTail( pFile );
			break;
		case 3:
			return;
		}
		
		pSingleLock.Lock();
	}
	
	for ( pos = m_pMatches->m_pSelectedHits.GetHeadPosition() ; pos ; )
	{
		CQueryHit* pHit = (CQueryHit*)m_pMatches->m_pSelectedHits.GetNext( pos );
		
		pSingleLock.Unlock();
		
		switch ( CheckExisting( pHit->m_bSHA1, &pHit->m_pSHA1, pHit->m_bTiger, &pHit->m_pTiger, pHit->m_bED2K, &pHit->m_pED2K ) )
		{
		case 1:
			pHits.AddTail( pHit );
			break;
		case 3:
			return;
		}
		
		pSingleLock.Lock();
	}
	
	pSingleLock.Unlock();
	
	if ( pFiles.IsEmpty() && pHits.IsEmpty() ) return;
	
	CSyncObject* pSync[2] = { &Network.m_pSection, &Transfers.m_pSection };
	CMultiLock pMultiLock( pSync, 2, TRUE );
	
	for ( pos = pFiles.GetHeadPosition() ; pos ; )
	{
		CMatchFile* pFile = (CMatchFile*)pFiles.GetNext( pos );
		if ( m_pMatches->m_pSelectedFiles.Find( pFile ) != NULL ) Downloads.Add( pFile );

	}
	
	for ( pos = pHits.GetHeadPosition() ; pos ; )
	{
		CQueryHit* pHit = (CQueryHit*)pHits.GetNext( pos );
		if ( m_pMatches->m_pSelectedHits.Find( pHit ) != NULL ) 
		{
			CDownload *pDownload = Downloads.Add( pHit );
			// Send any reviews to the download, so they can be viewed later
			if ( pDownload && ( pHit->m_nRating || ! pHit->m_sComments.IsEmpty() ) )
			{
				pDownload->AddReview( &pHit->m_pAddress, 2, pHit->m_nRating, pHit->m_sNick, pHit->m_sComments );
			}
		}
	}
	
	pMultiLock.Unlock();
	
	m_wndList.Invalidate();
	
	if ( Settings.Search.SwitchToTransfers && ! m_bContextMenu && GetTickCount() - m_tContextMenu > 5000 )
	{
		GetManager()->Open( RUNTIME_CLASS(CDownloadsWnd) );
	}
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:79,代码来源:WndBaseMatch.cpp

示例2: Add

CDownload* CDownloads::Add(CMatchFile* pFile, BOOL bAddToHead)
{
	CSingleLock pLock( &Transfers.m_pSection, TRUE );
	
	CDownload* pDownload = NULL;
	
	if ( pDownload == NULL && pFile->m_bSHA1 )
		pDownload = FindBySHA1( &pFile->m_pSHA1 );
	if ( pDownload == NULL && pFile->m_bTiger )
		pDownload = FindByTiger( &pFile->m_pTiger );
	if ( pDownload == NULL && pFile->m_bED2K )
		pDownload = FindByED2K( &pFile->m_pED2K );
	
	if ( pDownload != NULL )
	{
		theApp.Message( MSG_DOWNLOAD, IDS_DOWNLOAD_ALREADY, (LPCTSTR)pFile->m_pHits->m_sName );
		
		for ( CQueryHit* pHit = pFile->m_pHits ; pHit ; pHit = pHit->m_pNext )
		{
			pDownload->AddSourceHit( pHit );

			// Send any reviews to the download, so they can be viewed later
			if ( pHit->m_nRating || ! pHit->m_sComments.IsEmpty() )
			{
				pDownload->AddReview( &pHit->m_pAddress, 2, pHit->m_nRating, pHit->m_sNick, pHit->m_sComments );
			}
		}
		
		pDownload->Resume();
	}
	else
	{
		pDownload = new CDownload();
		if ( bAddToHead ) m_pList.AddHead( pDownload );
		else m_pList.AddTail( pDownload );
		
		if ( pFile->m_pBest != NULL )
		{
			pDownload->AddSourceHit( pFile->m_pBest, TRUE );
		}
		
		for ( CQueryHit* pHit = pFile->m_pHits ; pHit ; pHit = pHit->m_pNext )
		{
			if ( pHit != pFile->m_pBest )
			{
				pDownload->AddSourceHit( pHit, TRUE );
			}

			// Send any reviews to the download, so they can be viewed later
			if ( pHit->m_nRating || ! pHit->m_sComments.IsEmpty() )
			{
				pDownload->AddReview( &pHit->m_pAddress, 2, pHit->m_nRating, pHit->m_sNick, pHit->m_sComments );
			}
		}
		
		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;
	}
	
	pFile->m_bDownload = TRUE;
	
	DownloadGroups.Link( pDownload );
	Transfers.StartThread();
	
	if ( ( (pDownload->GetSourceCount() == 0 ) ||
		   ( pDownload->m_bED2K && ! pDownload->m_bSHA1 )) &&
		   (GetTryingCount() < Settings.Downloads.MaxFiles ) )
	{
		pDownload->FindMoreSources();
		pDownload->SetStartTimer();
	}
	
	return pDownload;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:77,代码来源:Downloads.cpp


注:本文中的CDownload::AddReview方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。