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


C++ CLibraryFile类代码示例

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


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

示例1: GetNextFile

BOOL CAlbumFolder::MetaToFiles(BOOL bAggressive)
{
	if ( m_pSchema == NULL || m_pXML == NULL ) return FALSE;

	for ( POSITION pos = GetFileIterator() ; pos ; )
	{
		CLibraryFile* pFile	= GetNextFile( pos );
		CSchema* pSchema	= pFile->m_pSchema;

		if ( pSchema == NULL ) continue;

		if ( CSchemaChild* pChild = m_pSchema->GetContained( pSchema->m_sURI ) )
		{
			CXMLElement* pXML = pFile->m_pMetadata->Clone();

			if ( pChild->MemberCopy( m_pXML, pXML, TRUE, bAggressive ) )
			{
				CXMLElement* pRoot = pSchema->Instantiate( TRUE );
				pRoot->AddElement( pXML );
				pFile->SetMetadata( pRoot );
				delete pRoot;
			}
			else
			{
				delete pXML;
			}
		}
	}

	return TRUE;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:31,代码来源:AlbumFolder.cpp

示例2: pLock

void CLibraryFileView::OnUpdateMusicBrainzLookup(CCmdUI* pCmdUI)
{
	if ( m_bGhostFolder || GetSelectedCount() != 1 || m_bRequestingService )
	{
		pCmdUI->Enable( FALSE );
		return;
	}

	CSingleLock pLock( &Library.m_pSection );
	if ( ! pLock.Lock( 200 ) ) return;

	CLibraryFile* pFile = GetSelectedFile();
	if ( ! pFile->IsSchemaURI( CSchema::uriAudio ) || pFile->m_pMetadata == NULL )
	{
		pCmdUI->Enable( FALSE );
		return;
	}

	CMetaList* pMetaList = new CMetaList();
	pMetaList->Setup( pFile->m_pSchema, FALSE );
	pMetaList->Combine( pFile->m_pMetadata );

	pLock.Unlock();

	pCmdUI->Enable( pMetaList->IsMusicBrainz() );

	delete pMetaList;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:28,代码来源:CtrlLibraryFileView.cpp

示例3: if

BOOL CLibraryAlbumTrack::LockRating()
{
	if ( m_nSetRating == 7 )
	{
		CFilePropertiesSheet dlg;
		dlg.Add( m_nIndex );
		return dlg.DoModal( 2 ) == IDOK;
	}
	else if ( m_nSetRating >= 0 && m_nSetRating <= 6 )
	{
		CQuickLock oLock( Library.m_pSection );
		CLibraryFile* pFile = Library.LookupFile( m_nIndex );
		if ( pFile == NULL ) return FALSE;
		
		pFile->m_nRating = m_nRating = ( m_nSetRating > 1 ? m_nSetRating : 0 );
		pFile->ModifyMetadata();
		
		Library.Update();
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:25,代码来源:CtrlLibraryAlbumView.cpp

示例4: ASSUME_LOCK

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;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:31,代码来源:LibraryMaps.cpp

示例5: GetSystemMetrics

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;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:33,代码来源:PageProfileFiles.cpp

示例6: SetMetadata

void CAlbumFolder::SetCollection(SHA1* pSHA1, CCollectionFile* pCollection)
{
	m_bCollSHA1 = TRUE;
	m_pCollSHA1 = *pSHA1;
	m_sBestView.Empty();

	if ( m_pCollection != NULL )
	{
		delete m_pCollection;
		m_pCollection = NULL;
	}

	if ( CXMLElement* pMetadata = pCollection->GetMetadata() )
	{
		pMetadata = pMetadata->Clone();
		SetMetadata( pMetadata );
		delete pMetadata;
	}

	for ( POSITION pos = LibraryMaps.GetFileIterator() ; pos ; )
	{
		CLibraryFile* pFile = LibraryMaps.GetNextFile( pos );

		if ( pFile->IsAvailable() )
		{
			if ( m_pCollSHA1 == pFile->m_pSHA1 ||
				 pCollection->FindFile( pFile, TRUE ) ) AddFile( pFile );
		}
	}

	m_nUpdateCookie++;
	Library.m_nUpdateCookie++;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:33,代码来源:AlbumFolder.cpp

示例7: pTransfersLock

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 );
	}
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:59,代码来源:CtrlLibraryFileView.cpp

示例8: 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();
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:11,代码来源:LibraryDictionary.cpp

示例9: LookupFile

CLibraryFile* CLibraryMaps::LookupFile(DWORD_PTR nIndex, BOOL bSharedOnly, BOOL bAvailableOnly) const
{
	if ( ! nIndex ) return NULL;

	CLibraryFile* pFile = NULL;

	CQuickLock oLock( Library.m_pSection );

	return ( m_pIndexMap.Lookup( nIndex, pFile ) &&
		pFile->CheckFileAttributes( SIZE_UNKNOWN, bSharedOnly, bAvailableOnly ) ) ?
		pFile : NULL;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:12,代码来源:LibraryMaps.cpp

示例10: ClearServicePages

// Called when the selection changes
void CLibraryFileView::CheckDynamicBar()
{
	bool bIsMusicBrainz = false;
	ClearServicePages();

	CLibraryFrame* pFrame = GetFrame();
	if ( _tcscmp( pFrame->GetDynamicBarName(), L"WebServices.MusicBrainz" ) == 0 )
		bIsMusicBrainz = true;

	if ( GetSelectedCount() != 1 )
	{
		if ( bIsMusicBrainz )
		{
			pFrame->SetDynamicBar( NULL );
			m_bRequestingService = FALSE;	// ToDo: Abort operation
		}
		return;
	}

	CSingleLock pLock( &Library.m_pSection, TRUE );

	CLibraryFile* pFile = GetSelectedFile();

	if ( pFile == NULL )	// Ghost file
	{
		pFrame->SetDynamicBar( NULL );
		m_bRequestingService = FALSE;
		return;
	}

	if ( ! pFile->IsSchemaURI( CSchema::uriAudio ) || pFile->m_pMetadata == NULL )
	{
		if ( bIsMusicBrainz )
			pFrame->SetDynamicBar( NULL );

		m_bRequestingService = FALSE;	// ToDo: Abort operation
		return;
	}

	CMetaList* pMetaList = new CMetaList();
	pMetaList->Setup( pFile->m_pSchema, FALSE );
	pMetaList->Combine( pFile->m_pMetadata );

	pLock.Unlock();

	if ( ! pMetaList->IsMusicBrainz() && bIsMusicBrainz )
		pFrame->SetDynamicBar( NULL );
	else
		pFrame->HideDynamicBar();

	m_bRequestingService = FALSE;	// ToDo: Abort operation
	delete pMetaList;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:54,代码来源:CtrlLibraryFileView.cpp

示例11: ASSERT_VALID

CLibraryFile* CLibraryMaps::LookupFileByName(LPCTSTR pszName, QWORD nSize, BOOL bSharedOnly, BOOL bAvailableOnly) const
{
	ASSERT_VALID( this );
	ASSERT( pszName && *pszName );

	CLibraryFile* pFile = NULL;
	CString strName = PathFindFileName( pszName );
	ToLower( strName );

	CQuickLock oLock( Library.m_pSection );

	return ( m_pNameMap.Lookup( strName, pFile ) &&
		pFile->CheckFileAttributes( nSize, bSharedOnly, bAvailableOnly ) ) ?
		pFile : NULL;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:15,代码来源:LibraryMaps.cpp

示例12: pLock

BOOL CWebServices::ShowBitprintsTicket(DWORD nIndex)
{
	if ( ! Settings.WebServices.BitprintsOkay )
	{
		if ( MsgBox( IDS_BITPRINTS_MESSAGE, MB_ICONQUESTION|MB_YESNO ) != IDYES )
			return FALSE;
		Settings.WebServices.BitprintsOkay = true;
		Settings.Save();
	}

	CSingleLock pLock( &Library.m_pSection, TRUE );

	CLibraryFile* pFile = Library.LookupFile( nIndex );
	if ( pFile == NULL ) return FALSE;

	if ( ! pFile->m_oSHA1 || ! pFile->m_oTiger || ! pFile->m_oED2K )
	{
		CString strMessage;
		strMessage.Format( LoadString( IDS_BITPRINTS_NOT_HASHED ), (LPCTSTR)pFile->m_sName );
		pLock.Unlock();
		MsgBox( strMessage, MB_ICONINFORMATION );
		return FALSE;
	}

	CString str, strURL = Settings.WebServices.BitprintsWebView;

	CFile hFile;
	if ( hFile.Open( pFile->GetPath(), CFile::modeRead|CFile::shareDenyNone ) )
	{
		strURL = Settings.WebServices.BitprintsWebSubmit;

		if ( hFile.GetLength() > 0 )
		{
			static LPCTSTR pszHex = L"0123456789ABCDEF";
			BYTE nBuffer[20];
			int nPeek = hFile.Read( nBuffer, 20 );
			hFile.Close();

			for ( int nByte = 0; nByte < nPeek; nByte++ )
			{
				str += pszHex[ (BYTE)nBuffer[ nByte ] >> 4 ];
				str += pszHex[ (BYTE)nBuffer[ nByte ] & 15 ];
			}

			strURL.Replace( L"(FIRST20)", str );
		}
		else
开发者ID:GetEnvy,项目名称:Envy,代码行数:47,代码来源:WebServices.cpp

示例13: oLock

BOOL CBitprintsDownloader::SubmitMetaData(CXMLElement* pXML)
{
	CQuickLock oLock( Library.m_pSection );

	CLibraryFile* pFile = Library.LookupFile( m_nFileIndex );

	if ( pFile == NULL )
	{
		delete pXML;
		return FALSE;
	}

	BOOL bSuccess = pFile->MergeMetadata( pXML, TRUE );

	delete pXML;

	return bSuccess;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:18,代码来源:BitprintsDownloader.cpp

示例14: 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 );
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:11,代码来源:LibraryDictionary.cpp

示例15: oLock

CLibraryFile* CLibraryMaps::LookupFileByTiger(const Hashes::TigerHash& oTiger, BOOL bSharedOnly, BOOL bAvailableOnly) const
{
	if ( ! oTiger ) return NULL;

	CQuickLock oLock( Library.m_pSection );

	CLibraryFile* pFile = m_pTigerMap[ oTiger[ 0 ] & HASH_MASK ];

	for ( ; pFile ; pFile = pFile->m_pNextTiger )
	{
		if ( validAndEqual( oTiger, pFile->m_oTiger ) )
		{
			if ( pFile->CheckFileAttributes( SIZE_UNKNOWN, bSharedOnly, bAvailableOnly ) )
				return pFile;

			//return NULL;
		}
	}

	return NULL;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:21,代码来源:LibraryMaps.cpp


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