本文整理汇总了C++中CLibraryFile::GetPath方法的典型用法代码示例。如果您正苦于以下问题:C++ CLibraryFile::GetPath方法的具体用法?C++ CLibraryFile::GetPath怎么用?C++ CLibraryFile::GetPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLibraryFile
的用法示例。
在下文中一共展示了CLibraryFile::GetPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: ShowBitprintsTicket
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
示例3: 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 ) )
//.........这里部分代码省略.........
示例4: 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;
}
示例5: ShowBitziTicket
BOOL CFileExecutor::ShowBitziTicket(DWORD nIndex)
{
CString str;
if ( ! Settings.Library.BitziOkay )
{
Skin.LoadString( str, IDS_LIBRARY_BITZI_MESSAGE );
if ( AfxMessageBox( str, MB_ICONQUESTION|MB_YESNO ) != IDYES ) return FALSE;
Settings.Library.BitziOkay = TRUE;
Settings.Save();
}
CSingleLock pLock( &Library.m_pSection, TRUE );
CLibraryFile* pFile = Library.LookupFile( nIndex );
if ( pFile == NULL ) return FALSE;
if ( pFile->m_bSHA1 == FALSE || pFile->m_bTiger == FALSE )
{
CString strFormat;
Skin.LoadString( strFormat, IDS_LIBRARY_BITZI_HASHED );
str.Format( strFormat, (LPCTSTR)pFile->m_sName );
pLock.Unlock();
AfxMessageBox( str, MB_ICONINFORMATION );
return FALSE;
}
CString strURL = Settings.Library.BitziWebView;
CFile hFile;
if ( hFile.Open( pFile->GetPath(), CFile::modeRead|CFile::shareDenyNone ) && hFile.GetLength() > 0 )
{
static LPCTSTR pszHex = _T("0123456789ABCDEF");
BYTE nBuffer[20];
int nPeek = hFile.Read( nBuffer, 20 );
hFile.Close();
str.Empty();
for ( int nByte = 0 ; nByte < nPeek ; nByte++ )
{
str += pszHex[ (BYTE)nBuffer[ nByte ] >> 4 ];
str += pszHex[ (BYTE)nBuffer[ nByte ] & 15 ];
}
strURL = Settings.Library.BitziWebSubmit;
Replace( strURL, _T("(FIRST20)"), str );
}
Replace( strURL, _T("(NAME)"), CConnection::URLEncode( pFile->m_sName ) );
Replace( strURL, _T("(SHA1)"), CSHA::HashToString( &pFile->m_pSHA1 ) );
Replace( strURL, _T("(TTH)"), CTigerNode::HashToString( &pFile->m_pTiger ) );
Replace( strURL, _T("(AGENT)"), CConnection::URLEncode( Settings.SmartAgent() ) );
str.Format( _T("%I64i"), pFile->GetSize() );
Replace( strURL, _T("(SIZE)"), str );
pLock.Unlock();
DisplayURL( strURL );
return TRUE;
}
示例6: OnPrepare
BOOL CLibraryTipCtrl::OnPrepare()
{
{
CQuickLock oLock( Library.m_pSection );
CLibraryFile* pFile = Library.LookupFile( (DWORD)m_pContext );
if ( pFile == NULL ) return FALSE;
CSingleLock pLock( &m_pSection, TRUE );
// Basic data
m_sName = pFile->m_sName;
m_sPath = pFile->GetPath();
m_nIndex = pFile->m_nIndex;
m_sSize = Settings.SmartVolume( pFile->GetSize(), FALSE );
m_nIcon = 0;
if ( pFile->m_pFolder != NULL ) m_sFolder = pFile->m_pFolder->m_sPath;
m_sType.Empty();
m_sSHA1.Empty();
m_sTTH.Empty();
m_sED2K.Empty();
// Type information and icons
m_sType = ShellIcons.GetTypeString( m_sName );
m_nIcon = ShellIcons.Get( m_sName, 48 );
// URN
if ( pFile->m_bSHA1 && Settings.General.GUIMode != GUI_BASIC)
{
m_sSHA1 = _T("sha1:") + CSHA::HashToString( &pFile->m_pSHA1 );
}
if ( pFile->m_bTiger && Settings.General.GUIMode != GUI_BASIC)
{
m_sTTH = _T("tree:tiger/:") + CTigerNode::HashToString( &pFile->m_pTiger );
}
if ( pFile->m_bED2K && Settings.General.GUIMode != GUI_BASIC)
{
m_sED2K = _T("ed2k:") + CED2K::HashToString( &pFile->m_pED2K );
}
// Metadata
CSchema* pSchema = pFile->m_pSchema;
CString str, sData, sFormat;
m_pMetadata.Clear();
LoadString( str, IDS_TIP_LOCATION );
m_pMetadata.Add( str, m_sFolder );
LoadString( str, IDS_TIP_TYPE );
m_pMetadata.Add( str, m_sType );
LoadString( str, IDS_TIP_SIZE );
m_pMetadata.Add( str, m_sSize );
LoadString( sFormat, IDS_TIP_TODAYTOTAL );
sData.Format( sFormat, pFile->m_nHitsToday, pFile->m_nHitsTotal );
LoadString( str, IDS_TIP_HITS );
m_pMetadata.Add( str, sData );
sData.Format( sFormat, pFile->m_nUploadsToday, pFile->m_nUploadsTotal );
LoadString( str, IDS_TIP_UPLOADS );
m_pMetadata.Add( str, sData );
if ( pFile->m_pMetadata && pSchema )
{
m_pMetadata.Setup( pSchema, FALSE );
m_pMetadata.Combine( pFile->m_pMetadata );
m_pMetadata.Clean();
}
}
CalcSizeHelper();
return m_sz.cx > 0;
}