本文整理汇总了C++中CDownload::CloseTransfers方法的典型用法代码示例。如果您正苦于以下问题:C++ CDownload::CloseTransfers方法的具体用法?C++ CDownload::CloseTransfers怎么用?C++ CDownload::CloseTransfers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDownload
的用法示例。
在下文中一共展示了CDownload::CloseTransfers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnApply
BOOL CDownloadEditPage::OnApply()
{
if ( ! UpdateData() )
return FALSE;
CString strMessage;
Hashes::Sha1Hash oSHA1;
Hashes::TigerHash oTiger;
Hashes::Ed2kHash oED2K;
Hashes::Md5Hash oMD5;
Hashes::BtHash oBTH;
oSHA1.fromString( m_sSHA1 );
oTiger.fromString( m_sTiger );
oED2K.fromString( m_sED2K );
oMD5.fromString( m_sMD5 );
oBTH.fromString( m_sBTH );
if ( ! m_sSHA1.IsEmpty() && ! oSHA1 )
{
strMessage.Format( LoadString( IDS_DOWNLOAD_EDIT_BAD_HASH ), _T("SHA1") );
MsgBox( strMessage, MB_ICONEXCLAMATION );
GetDlgItem( IDC_URN_SHA1 )->SetFocus();
return FALSE;
}
if ( ! m_sTiger.IsEmpty() && ! oTiger )
{
strMessage.Format( LoadString( IDS_DOWNLOAD_EDIT_BAD_HASH ), _T("Tiger-Root") );
MsgBox( strMessage, MB_ICONEXCLAMATION );
GetDlgItem( IDC_URN_TIGER )->SetFocus();
return FALSE;
}
if ( ! m_sED2K.IsEmpty() && ! oED2K )
{
strMessage.Format( LoadString( IDS_DOWNLOAD_EDIT_BAD_HASH ), _T("ED2K") );
MsgBox( strMessage, MB_ICONEXCLAMATION );
GetDlgItem( IDC_URN_ED2K )->SetFocus();
return FALSE;
}
if ( ! m_sMD5.IsEmpty() && ! oMD5 )
{
strMessage.Format( LoadString( IDS_DOWNLOAD_EDIT_BAD_HASH ), _T("MD5") );
MsgBox( strMessage, MB_ICONEXCLAMATION );
GetDlgItem( IDC_URN_MD5 )->SetFocus();
return FALSE;
}
if ( ! m_sBTH.IsEmpty() && ! oBTH )
{
strMessage.Format( LoadString( IDS_DOWNLOAD_EDIT_BAD_HASH ), _T("BitTorrent") );
MsgBox( strMessage, MB_ICONEXCLAMATION );
GetDlgItem( IDC_URN_BTH )->SetFocus();
return FALSE;
}
CSingleLock pLock( &Transfers.m_pSection );
if ( ! pLock.Lock( 250 ) )
return FALSE;
CDownloadSheet* pSheet = (CDownloadSheet*)GetParent();
CDownload* pDownload = pSheet->GetDownload();
if ( ! pDownload )
return CPropertyPageAdv::OnApply(); // Invalid download
bool bNeedUpdate = false;
bool bCriticalChange = false;
bNeedUpdate = pDownload->m_bSHA1Trusted ^ ( m_bSHA1Trusted == TRUE );
bNeedUpdate |= pDownload->m_bTigerTrusted ^ ( m_bTigerTrusted == TRUE );
bNeedUpdate |= pDownload->m_bED2KTrusted ^ ( m_bED2KTrusted == TRUE );
bNeedUpdate |= pDownload->m_bMD5Trusted ^ ( m_bMD5Trusted == TRUE );
bNeedUpdate |= pDownload->m_bBTHTrusted ^ ( m_bBTHTrusted == TRUE );
if ( pDownload->m_sName != m_sName )
{
pLock.Unlock();
if ( MsgBox( IDS_DOWNLOAD_EDIT_CHANGE_NAME, MB_ICONQUESTION|MB_YESNO ) != IDYES ) return FALSE; // Was IDS_DOWNLOAD_EDIT_RENAME
pLock.Lock();
pDownload = pSheet->GetDownload();
if ( ! pDownload ) return CPropertyPageAdv::OnApply();
pDownload->Rename( m_sName );
bNeedUpdate = true;
}
QWORD nNewSize = 0;
if ( _stscanf( m_sFileSize, _T("%I64u"), &nNewSize ) == 1 && nNewSize != pDownload->m_nSize )
{
pLock.Unlock();
if ( MsgBox( IDS_DOWNLOAD_EDIT_CHANGE_SIZE, MB_ICONQUESTION|MB_YESNO ) != IDYES ) return FALSE;
pLock.Lock();
pDownload = pSheet->GetDownload();
if ( ! pDownload ) return CPropertyPageAdv::OnApply();
pDownload->m_nSize = nNewSize;
pDownload->CloseTransfers();
pDownload->ClearVerification();
bCriticalChange = true;
}
SYSTEMTIME tDate;
m_wndDate.GetTime( &tDate );
//.........这里部分代码省略.........