// FileEnumerator.cpp: implementation of the CFileEnumerator class. // ////////////////////////////////////////////////////////////////////// #include "FileEnumerator.h" #include ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CFileEnumerator::CFileEnumerator() { m_szRootPath[0] = 0; } CFileEnumerator::~CFileEnumerator() { Clear(); } void CFileEnumerator::Clear() { m_szRootPath[0] = 0; for( int i = 0; i < m_vecEnumeratedFiles.size(); ++i ) { SAFE_DELETEA( m_vecEnumeratedFiles[i] ); } } const char* CFileEnumerator::GetRootPath() { return m_szRootPath; } bool CFileEnumerator::Enumerate( const char* szRootPath ) { Clear(); // if( false == IsDirectoryExist( szRootPath ) ) // { // return false; // } // // strcpy( m_szRootPath, szRootPath ); // // char szTmp[MAX_PATH]; // // WIN32_FIND_DATA w32fd; // // wsprintf( szTmp, "%s\\*.*", m_szRootPath ); // HANDLE hFind = FindFirstFile( szTmp, &w32fd ); // // if( INVALID_HANDLE_VALUE == hFind ) // { // return false; // } // // // std::string strCurrentSubPath(""); // std::vector< std::string > vecSubDirList; // // while(1) // { // if( w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) // { // if( 0 == stricmp( ".", w32fd.cFileName ) || // 0 == stricmp( "..", w32fd.cFileName ) ) // { // continue; // } // // wsprintf( szTmp, "%s%s", strCurrentSubPath.c_str(), w32fd.cFileName ); // // m_vecSubPathName.push_back( w32fd.cFileName ); // // // // CString strTmp; // strTmp.Format( "%s%s", strCurrentSubPath, w32fd.cFileName ); // if( !IsExcludedSubDir( strTmp ) ) // { // astrSubDirList.Add( strTmp ); // } // } // else // { // FilePatchInfoRecord fpir; // // // strcpy( fpir.szFileName, strCurrentSubPath+w32fd.cFileName ); // CString strFullPathName = m_strLocalFilePath+strCurrentSubPath+w32fd.cFileName; // // m_strStateInfoString.Format( "»õ ¹öÀüÀÇ %s ÆÄÀÏÀ» °Ë»çÁß", strFullPathName ); // // CCrc32Static::FileCrc32Assembly( strFullPathName, fpir.dwCRC32 ); // HANDLE hFile = CreateFile( strFullPathName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, // NULL, OPEN_EXISTING, 0, 0 ); // fpir.dwSize = GetFileSize ( hFile, NULL ); // CloseHandle( hFile ); // // m_LocalPatchInfo.GetList().Add( fpir ); // } // // } return true; }