本文整理汇总了C++中CLibraryFile::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ CLibraryFile::Delete方法的具体用法?C++ CLibraryFile::Delete怎么用?C++ CLibraryFile::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLibraryFile
的用法示例。
在下文中一共展示了CLibraryFile::Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLibraryDelete
void CLibraryFileView::OnLibraryDelete()
{
CSingleLock pTransfersLock( &Transfers.m_pSection, TRUE ); // Can clear uploads and downloads
CSingleLock pLibraryLock( &Library.m_pSection, TRUE );
CLibraryListPtr pList( new CLibraryList() );
POSITION posSel = StartSelectedFileLoop();
while ( CLibraryFile* pFile = GetNextSelectedFile( posSel, FALSE, ! m_bGhostFolder ) )
{
pList->AddTail( pFile );
}
while ( ! pList->IsEmpty() )
{
CLibraryFile* pFile = Library.LookupFile( pList->GetHead(), FALSE, ! m_bGhostFolder );
if ( pFile == NULL )
{
pList->RemoveHead(); // Remove item from list to avoid endless loop
continue;
}
if ( m_bGhostFolder )
{
for ( INT_PTR nProcess = pList->GetCount() ; nProcess > 0 && pList->GetCount() > 0 ; nProcess-- )
{
if ( ( pFile = Library.LookupFile( pList->RemoveHead() ) ) != NULL )
pFile->Delete( TRUE );
}
}
else
{
CDeleteFileDlg dlg( this );
dlg.m_sName = pFile->m_sName;
dlg.m_sComments = pFile->m_sComments;
dlg.m_nRateValue = pFile->m_nRating;
dlg.m_bAll = pList->GetCount() > 1;
pLibraryLock.Unlock();
pTransfersLock.Unlock();
if ( dlg.DoModal() != IDOK ) break;
pTransfersLock.Lock();
pLibraryLock.Lock();
for ( INT_PTR nProcess = dlg.m_bAll ? pList->GetCount() : 1 ; nProcess > 0 && pList->GetCount() > 0 ; nProcess-- )
{
if ( ( pFile = Library.LookupFile( pList->RemoveHead(), FALSE, TRUE ) ) != NULL )
{
dlg.Apply( pFile );
pFile->Delete();
}
}
}
Library.Update( true );
}
}
示例2: CullDeletedFiles
void CLibraryMaps::CullDeletedFiles(CLibraryFile* pMatch)
{
ASSUME_LOCK( Library.m_pSection );
if ( CFileList* pList = LookupFilesByHash( pMatch, FALSE, FALSE, 0 ) )
{
for ( POSITION pos = pList->GetHeadPosition() ; pos ; )
{
CLibraryFile* pFile = const_cast< CLibraryFile* >( pList->GetNext( pos ) );
if ( ! pFile->IsAvailable() )
pFile->Delete( TRUE );
}
delete pList;
}
}