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


C++ CLibraryFile::GetFolder方法代码示例

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


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

示例1: OnInitDialog

BOOL CFileGeneralPage::OnInitDialog()
{
	CFilePropertiesPage::OnInitDialog();

	{
		CQuickLock oLock( Library.m_pSection );

		CLibraryFile* pFile = GetFile();
		if ( ! pFile ) return TRUE;

		m_sPath = pFile->GetFolder();
		m_sType = ShellIcons.GetTypeString( pFile->m_sName );
		m_sSize.Format( _T("%s  (%I64i)"), Settings.SmartVolume( pFile->GetSize() ), pFile->GetSize() );
		m_sIndex.Format( _T("# %lu"), pFile->m_nIndex );

		m_sSHA1	 = pFile->m_oSHA1.toShortUrn();
		m_sTiger = pFile->m_oTiger.toShortUrn();
		m_sED2K	 = pFile->m_oED2K.toShortUrn();
		m_sMD5	 = pFile->m_oMD5.toShortUrn();

		if ( m_sSHA1.IsEmpty() && m_sED2K.IsEmpty() && m_sTiger.IsEmpty() && m_sMD5.IsEmpty() )
			LoadString( m_sSHA1, IDS_NO_URN_AVAILABLE );

		SYSTEMTIME pTime;
		FileTimeToSystemTime( &pFile->m_pTime, &pTime );
		SystemTimeToTzSpecificLocalTime( NULL, &pTime, &pTime );

		CString strDate, strTime;
		GetDateFormat( LOCALE_USER_DEFAULT, DATE_LONGDATE, &pTime, NULL, strDate.GetBuffer( 64 ), 64 );
		GetTimeFormat( LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT, &pTime, NULL, strTime.GetBuffer( 64 ), 64 );
		strDate.ReleaseBuffer();
		strTime.ReleaseBuffer();

		m_sModified = strDate + _T(", ") + strTime;
	}

	UpdateData( FALSE );

	return TRUE;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:40,代码来源:PageFileGeneral.cpp

示例2: Update

void CLibraryMetaPanel::Update()
{
	CSingleLock pLock1( &Library.m_pSection, TRUE );
	CSingleLock pLock2( &m_pSection, TRUE );

	CLibraryListPtr pSel( GetViewSelection() );
	m_nSelected = pSel ? static_cast< int >( pSel->GetCount() ) : 0;

	// Show info for library files only
	CLibraryFile* pFirst = NULL;
	if ( m_nSelected )
	{
		const CLibraryListItem& pItem = pSel->GetHead();
		if ( pItem.Type == CLibraryListItem::LibraryFile )
			pFirst = Library.LookupFile( pItem );
		if ( pFirst == NULL ) m_nSelected = 0;
	}

	m_nIcon32 = m_nIcon48 = -1;

	if ( m_nSelected == 1 )
	{
		m_nIndex	= pFirst->m_nIndex;
		m_sName		= pFirst->m_sName;
		m_sPath		= pFirst->GetPath();
		m_sFolder	= pFirst->GetFolder();
		m_sSize		= Settings.SmartVolume( pFirst->GetSize() );
		m_sType		= ShellIcons.GetTypeString( m_sName );
		m_nIcon32	= ShellIcons.Get( pFirst->GetPath(), 32 );
		m_nIcon48	= ShellIcons.Get( pFirst->GetPath(), 48 );
		m_nRating	= pFirst->m_nRating;
	}
	else if ( m_nSelected > 1 )
	{
		CString strFormat;
		LoadString( strFormat, IDS_LIBPANEL_MULTIPLE_FILES );
		m_sName.Format( strFormat, m_nSelected );
		QWORD nSize = 0;

		m_sFolder	= pFirst->GetFolder();
		m_nIcon32	= ShellIcons.Get( pFirst->GetPath(), 32 );
		m_nIcon48	= ShellIcons.Get( pFirst->GetPath(), 48 );
		m_nRating	= 0;

		for ( POSITION pos = pSel->GetHeadPosition() ; pos ; )
		{
			CLibraryFile* pFile = Library.LookupFile( pSel->GetNext( pos ) );
			if ( pFile == NULL ) continue;

			nSize += pFile->GetSize() / 1024;

			if ( pFile->IsAvailable() && pFile->GetFolder().CompareNoCase( m_sFolder ) )
			{
				LoadString( m_sFolder, IDS_LIBPANEL_MULTIPLE_FOLDERS );
			}

			int nIcon = ShellIcons.Get( pFile->GetPath(), 48 );
			if ( nIcon != m_nIcon48 ) m_nIcon48 = -1;
			nIcon = ShellIcons.Get( pFile->GetPath(), 32 );
			if ( nIcon != m_nIcon32 ) m_nIcon32 = -1;
		}

		m_sSize = Settings.SmartVolume( nSize );
		m_sPath.Empty();
		m_sType.Empty();
	}

	m_pSchema = NULL;

	if ( pSel )
	{
		for ( POSITION pos = pSel->GetHeadPosition() ; pos ; )
		{
			const CLibraryListItem& pItem = pSel->GetNext( pos );
			if ( pItem.Type != CLibraryListItem::LibraryFile ) continue;
			CLibraryFile* pFile = Library.LookupFile( pItem );
			if ( pFile == NULL ) continue;
			m_pSchema = pFile->m_pSchema;
			if ( m_pSchema ) break;
		}
	}

	if ( m_pServiceData )
	{
		m_pMetadata->Setup( m_pServiceData );
	}
	else
	{
		m_pMetadata->Setup( m_pSchema );

		if ( m_pSchema && pSel )
		{
			for ( POSITION pos = pSel->GetHeadPosition() ; pos ; )
			{
				const CLibraryListItem& pItem = pSel->GetNext( pos );
				if ( pItem.Type != CLibraryListItem::LibraryFile ) continue;
				if ( CLibraryFile* pFile = Library.LookupFile( pItem ) )
				{
					if ( pFile->m_pMetadata != NULL &&
						m_pSchema->Equals( pFile->m_pSchema ) )
//.........这里部分代码省略.........
开发者ID:ivan386,项目名称:Shareaza,代码行数:101,代码来源:CtrlLibraryMetaPanel.cpp

示例3: OnPrepare

BOOL CLibraryTipCtrl::OnPrepare()
{
	CSingleLock oLock( &Library.m_pSection );
	if ( ! oLock.Lock( 300 ) )
		return FALSE;

	CLibraryFile* pLibraryFile = NULL;
	CPeerProjectFile* pFile = NULL;

	if ( m_nFileIndex )
	{
		pLibraryFile = Library.LookupFile( m_nFileIndex );
		pFile = static_cast< CPeerProjectFile* >( pLibraryFile );
	}
	else if ( m_pFile )
	{
		pLibraryFile = LibraryMaps.LookupFileByHash( m_pFile );
		pFile = m_pFile;
	}
	else
		return FALSE;

	if ( ! pFile )
		return FALSE;

	CSingleLock pLock( &m_pSection, TRUE );

	// Basic data
	m_sName = pFile->m_sName.IsEmpty() ? pFile->m_sPath : pFile->m_sName;
	if ( pLibraryFile )
		m_sPath = pLibraryFile->GetPath();
	else
		m_sPath.Empty();

	m_sSize = Settings.SmartVolume( pFile->GetSize() );

	if ( pLibraryFile )
		m_sFolder = pLibraryFile->GetFolder();
	else
		m_sFolder.Empty();	// Ghost files have no location

	// Type information and icons
	m_sType = ShellIcons.GetTypeString( m_sName );
	m_nIcon = ShellIcons.Get( m_sPath.IsEmpty() ? m_sName : m_sPath, 48 );

	// URN
	if ( Settings.General.GUIMode != GUI_BASIC )
	{
		m_sSHA1 = pFile->m_oSHA1.toShortUrn();
		m_sTTH = pFile->m_oTiger.toShortUrn();
		m_sED2K = pFile->m_oED2K.toShortUrn();
		m_sBTH = pFile->m_oBTH.toShortUrn();
		m_sMD5 = pFile->m_oMD5.toShortUrn();
	}
	else // Basic Mode
	{
		m_sSHA1.Empty();
		m_sTTH.Empty();
		m_sED2K.Empty();
		m_sBTH.Empty();
		m_sMD5.Empty();
	}

	// Metadata
	CSchemaPtr pSchema = pLibraryFile ? pLibraryFile->m_pSchema : NULL;

	m_pMetadata.Clear();

	if ( ! m_sFolder.IsEmpty() )
		m_pMetadata.Add( LoadString( IDS_TIP_LOCATION ), m_sFolder );

	if ( ! m_sType.IsEmpty() )
		m_pMetadata.Add( LoadString( IDS_TIP_TYPE ), m_sType );

	if ( m_sSize )
		m_pMetadata.Add( LoadString( IDS_TIP_SIZE ), m_sSize );

	if ( pLibraryFile )
	{
		CString strData, strFormat = LoadString( IDS_TIP_TODAYTOTAL );
		strData.Format( strFormat, pLibraryFile->m_nHitsToday, pLibraryFile->m_nHitsTotal );
		m_pMetadata.Add( LoadString( IDS_TIP_HITS ), strData );
		strData.Format( strFormat, pLibraryFile->m_nUploadsToday, pLibraryFile->m_nUploadsTotal );
		m_pMetadata.Add( LoadString( IDS_TIP_UPLOADS ), strData );

		if ( pLibraryFile->m_pMetadata && pSchema )
		{
			m_pMetadata.Setup( pSchema, FALSE );
			m_pMetadata.Combine( pLibraryFile->m_pMetadata );
			m_pMetadata.Clean();
		}
	}

	oLock.Unlock();

	CalcSizeHelper();

	return m_sz.cx > 0;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:99,代码来源:CtrlLibraryTip.cpp


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