本文整理汇总了C++中CLibraryFile::IsShared方法的典型用法代码示例。如果您正苦于以下问题:C++ CLibraryFile::IsShared方法的具体用法?C++ CLibraryFile::IsShared怎么用?C++ CLibraryFile::IsShared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLibraryFile
的用法示例。
在下文中一共展示了CLibraryFile::IsShared方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WhatsNew
CFileList* CLibraryMaps::WhatsNew(const CQuerySearch* pSearch, int nMaximum) const
{
ASSUME_LOCK( Library.m_pSection );
const DWORD tNow = static_cast< DWORD >( time( NULL ) );
CFileList* pHits = NULL;
for ( POSITION pos = GetFileIterator() ; pos ; )
{
CLibraryFile* pFile = GetNextFile( pos );
if ( pFile->IsAvailable() && pFile->IsShared() && pFile->m_oSHA1 &&
( ! pSearch->m_pSchema || pSearch->m_pSchema->Equals( pFile->m_pSchema ) ) )
{
const DWORD nTime = pFile->GetCreationTime();
if ( nTime && nTime + 12 * 60 * 60 > tNow ) // 12 hours
{
pFile->m_nHitsToday++;
pFile->m_nHitsTotal++;
if ( ! pHits )
pHits = new CFileList;
pHits->AddTail( pFile );
if ( nMaximum && pHits->GetCount() >= nMaximum )
break;
}
}
}
return pHits;
}
示例2: OnInitDialog
BOOL CFilesProfilePage::OnInitDialog()
{
CSettingsPage::OnInitDialog();
CRect rc;
m_wndList.GetClientRect( &rc );
rc.right -= GetSystemMetrics( SM_CXVSCROLL ) + 1;
m_wndList.InsertColumn( 0, _T("File"), LVCFMT_LEFT, rc.right, -1 );
ShellIcons.AttachTo( &m_wndList, 16 ); // m_wndList.SetImageList()
{
CQuickLock oLock( Library.m_pSection );
CAlbumFolder* pFolder = LibraryFolders.GetAlbumTarget( CSchema::uriFavouritesFolder, _T("Title"), NULL );
if ( pFolder != NULL )
{
for ( POSITION pos = pFolder->GetFileIterator() ; pos ; )
{
CLibraryFile* pFile = pFolder->GetNextFile( pos );
if ( pFile->IsShared() )
{
m_wndList.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, m_wndList.GetItemCount(),
pFile->m_sName, 0, 0, ShellIcons.Get( pFile->GetPath(), 16 ), pFile->m_nIndex );
}
}
}
}
UpdateData( FALSE );
return TRUE;
}
示例3: RemoveFile
void CLibraryDictionary::RemoveFile(CLibraryFile& oFile)
{
ASSUME_LOCK( Library.m_pSection );
ProcessFile( oFile, false, oFile.IsShared() );
// Always invalidate the table when removing a hashed file...
// ToDo: Is this wise? It will happen all the time.
if ( oFile.IsHashed() )
Invalidate();
}
示例4: AddFile
void CLibraryDictionary::AddFile(CLibraryFile& oFile)
{
ASSUME_LOCK( Library.m_pSection );
const bool bCanUpload = oFile.IsShared();
ProcessFile( oFile, true, bCanUpload );
if ( bCanUpload && m_bValid )
m_pTable->AddHashes( oFile );
}
示例5: GetSharedCount
int CAlbumFolder::GetSharedCount() const
{
int nCount = 0;
for ( POSITION pos = GetFileIterator() ; pos ; )
{
CLibraryFile* pFile = GetNextFile( pos );
if ( pFile->IsShared() ) nCount++;
}
for ( POSITION pos = GetFolderIterator() ; pos ; )
{
nCount += GetNextFolder( pos )->GetSharedCount();
}
return nCount;
}
示例6: Browse
CFileList* CLibraryMaps::Browse(int nMaximum) const
{
ASSUME_LOCK( Library.m_pSection );
CFileList* pHits = NULL;
for ( POSITION pos = GetFileIterator() ; pos ; )
{
CLibraryFile* pFile = GetNextFile( pos );
if ( pFile->IsAvailable() && pFile->IsShared() && pFile->m_oSHA1 )
{
if ( ! pHits )
pHits = new CFileList;
pHits->AddTail( pFile );
if ( nMaximum && pHits->GetCount() >= nMaximum )
break;
}
}
return pHits;
}
示例7: CacheItem
void CLibraryDetailView::CacheItem(int nItem)
{
CLibraryFile* pFile = Library.LookupFile( m_pList[ nItem ].nIndex );
if ( ! pFile ) return;
LDVITEM* pItem = &m_pList[ nItem ];
pItem->nCookie = m_nListCookie;
if ( pItem->pText == NULL ) pItem->pText = new CStringArray();
CStringArray* pText = pItem->pText;
pText->SetSize( m_nStyle == LVS_REPORT ? DETAIL_COLUMNS + m_pColumns.GetCount() : 1 );
CString strName( pFile->m_sName );
int nDot = strName.ReverseFind( '.' );
if ( nDot >= 0 ) strName.SetAt( nDot, 0 );
pText->SetAt( 0, strName );
if ( m_nStyle == LVS_ICON )
{
pItem->nIcon = ShellIcons.Get( pFile->m_sName, 32 );
}
else
{
if ( pFile->m_nIcon16 >= 0 )
pItem->nIcon = pFile->m_nIcon16;
else
pItem->nIcon = pFile->m_nIcon16 = ShellIcons.Get( pFile->m_sName, 16 );
}
pItem->nState &= LDVI_SELECTED;
if ( ! pFile->IsShared() ) pItem->nState |= LDVI_PRIVATE;
if ( ! pFile->m_bSHA1 ) pItem->nState |= LDVI_UNSCANNED;
if ( pFile->m_bVerify == TS_FALSE ) pItem->nState |= LDVI_UNSAFE;
if ( m_nStyle != LVS_REPORT ) return;
if ( LPCTSTR pszType = _tcsrchr( pFile->m_sName, '.' ) )
pText->SetAt( 1, pszType + 1 );
else
pText->SetAt( 1, _T("") );
pText->SetAt( 2, Settings.SmartVolume( pFile->GetSize(), FALSE ) );
if ( pFile->m_pFolder != NULL ) pText->SetAt( 3, pFile->m_pFolder->m_sPath );
CString str;
str.Format( _T("%lu (%lu)"), pFile->m_nHitsToday, pFile->m_nHitsTotal );
pText->SetAt( 4, str );
str.Format( _T("%lu (%lu)"), pFile->m_nUploadsToday, pFile->m_nUploadsTotal );
pText->SetAt( 5, str );
TCHAR szModified[ 64 ];
SYSTEMTIME pTime;
FileTimeToSystemTime( &pFile->m_pTime, &pTime );
SystemTimeToTzSpecificLocalTime( NULL, &pTime, &pTime );
GetDateFormat( LOCALE_USER_DEFAULT, 0, &pTime, _T("yyyy-MM-dd"), szModified, 64 );
_tcscat( szModified, _T(" ") );
GetTimeFormat( LOCALE_USER_DEFAULT, 0, &pTime, _T("hh:mm tt"), szModified + _tcslen( szModified ), 64 - _tcslen( szModified ) );
pText->SetAt( 6, szModified );
if ( m_pSchema == NULL ) return;
int nColumn = DETAIL_COLUMNS;
BOOL bSource = pFile->m_pMetadata && m_pSchema->Equals( pFile->m_pSchema ) &&
m_pSchema->m_sSingular.CompareNoCase( pFile->m_pMetadata->GetName() ) == 0;
for ( POSITION pos = m_pColumns.GetHeadPosition() ; pos ; nColumn++ )
{
CSchemaMember* pMember = (CSchemaMember*)m_pColumns.GetNext( pos );
if ( pMember->m_sName.CompareNoCase( _T("SHA1") ) == 0 )
{
if ( pFile->m_bSHA1 )
{
pText->SetAt( nColumn, CSHA::HashToString( &pFile->m_pSHA1 ) );
}
else pText->SetAt( nColumn, _T("") );
}
else if ( bSource )
{
pText->SetAt( nColumn, pMember->GetValueFrom( pFile->m_pMetadata, NULL, TRUE ) );
}
else
{
pText->SetAt( nColumn, _T("") );
}
}
}
示例8: Search
CFileList* CLibraryDictionary::Search(const CQuerySearch* pSearch, const int nMaximum, const bool bLocal, const bool bAvailableOnly)
{
ASSUME_LOCK( Library.m_pSection );
if ( ! m_bValid )
{
BuildHashTable();
if ( ! m_bValid )
return NULL;
}
// Only check the hash when a search comes from other client.
if ( ! bLocal && ! m_pTable->Check( pSearch ) )
return NULL;
++m_nSearchCookie;
CLibraryFile* pHit = NULL;
CQuerySearch::const_iterator pWordEntry = pSearch->begin();
const CQuerySearch::const_iterator pLastWordEntry = pSearch->end();
for ( ; pWordEntry != pLastWordEntry; ++pWordEntry )
{
if ( pWordEntry->first[ 0 ] == L'-' )
continue;
CString strWord( pWordEntry->first, static_cast< int >( pWordEntry->second ) );
CFileList* pList = NULL;
if ( m_oWordMap.Lookup( strWord, pList ) )
{
for ( POSITION pos = pList->GetHeadPosition(); pos; )
{
CLibraryFile* pFile = pList->GetNext( pos );
if ( bAvailableOnly && ! pFile->IsAvailable() )
continue;
if ( ! bLocal && ! pFile->IsShared() )
continue;
if ( pFile->m_nSearchCookie == m_nSearchCookie )
{
++pFile->m_nSearchWords;
}
else
{
pFile->m_nSearchCookie = m_nSearchCookie;
pFile->m_nSearchWords = 1;
pFile->m_pNextHit = pHit;
pHit = pFile;
}
}
}
}
size_t nLowerBound = ( pSearch->tableSize() >= 3 ) ?
( pSearch->tableSize() * 2 / 3 ) : pSearch->tableSize();
CFileList* pHits = NULL;
for ( ; pHit; pHit = pHit->m_pNextHit )
{
ASSERT( pHit->m_nSearchCookie == m_nSearchCookie );
if ( pHit->m_nSearchWords < nLowerBound )
continue;
if ( pSearch->Match( pHit->GetSearchName(),
pHit->m_pSchema ? (LPCTSTR)pHit->m_pSchema->GetURI() : NULL,
pHit->m_pMetadata, pHit ) )
{
if ( ! pHits )
pHits = new CFileList;
pHits->AddTail( pHit );
if ( ! bLocal )
{
pHit->m_nHitsToday ++;
pHit->m_nHitsTotal ++;
}
if ( pHit->m_nCollIndex )
{
CLibraryFile* pCollection = LibraryMaps.LookupFile( pHit->m_nCollIndex, ! bLocal, bAvailableOnly );
if ( pCollection )
{
if ( pCollection->m_nSearchCookie != m_nSearchCookie )
{
pCollection->m_nSearchCookie = m_nSearchCookie;
pHits->AddHead( pCollection );
}
}
else
{
// Collection removed without deleting indexes
pHit->m_nCollIndex = 0ul;
}
}
if ( nMaximum > 0 && pHits->GetCount() >= nMaximum )
//.........这里部分代码省略.........