CAlbumFolder* CAlbumFolder::FindFile(CLibraryFile* pFile) const { if ( m_pFiles.Find( pFile ) != NULL ) return (CAlbumFolder*)this; POSITION pos = GetFolderIterator(); CAlbumFolder* pFirst = pos ? GetNextFolder( pos ) : NULL; if ( GetFolderCount() > 1 ) { while ( pos ) { CAlbumFolder* pFolder = GetNextFolder( pos )->FindFile( pFile ); if ( pFolder != NULL ) return pFolder; } CAlbumFolder* pFolder = pFirst->FindFile( pFile ); if ( pFolder != NULL ) return pFolder; } else if ( pFirst != NULL ) { CAlbumFolder* pFolder = pFirst->FindFile( pFile ); if ( pFolder != NULL ) return pFolder; } return NULL; }
void CAlbumFolder::Delete(BOOL bIfEmpty) { if ( m_pParent == NULL ) return; if ( bIfEmpty ) { if ( ! m_bAutoDelete ) return; if ( m_bCollSHA1 ) return; if ( GetFolderCount() ) return; if ( GetFileCount() ) return; } m_pParent->OnFolderDelete( this ); delete this; }
void CAlbumFolder::Serialize(CArchive& ar, int nVersion) { POSITION pos; if ( ar.IsStoring() ) { ar << m_sSchemaURI; ar.WriteCount( m_pXML != NULL ? 1 : 0 ); if ( m_pXML ) m_pXML->Serialize( ar ); ar << m_bCollSHA1; if ( m_bCollSHA1 ) ar.Write( &m_pCollSHA1, sizeof(SHA1) ); ar << m_sName; ar << m_bExpanded; ar << m_bAutoDelete; ar << m_sBestView; ar.WriteCount( GetFolderCount() ); for ( pos = GetFolderIterator() ; pos ; ) { CAlbumFolder* pFolder = GetNextFolder( pos ); pFolder->Serialize( ar, nVersion ); } ar.WriteCount( GetFileCount() ); for ( pos = GetFileIterator() ; pos ; ) { CLibraryFile* pFile = GetNextFile( pos ); ar << pFile->m_nIndex; } } else { CLibraryFile* pCollection = NULL; if ( m_pParent != NULL ) { ar >> m_sSchemaURI; m_pSchema = SchemaCache.Get( m_sSchemaURI ); } else {
void CIMToolWin::AddItem(int Folder, const char *t, int img) { if (Folder >= 0 && Folder < GetFolderCount()) folders[Folder]->AddItem(t, img); }