bool CZipArchive::ExtractFile(WORD uIndex, LPCTSTR lpszPath, DWORD nBufSize) { if (!nBufSize) return false; CFileHeader header; GetFileInfo(header, uIndex); // to ensure that slash and oem conversions take place CString szFile = lpszPath; szFile.TrimRight(_T("\\")); szFile += _T("\\") + GetFileDirAndName(header.m_szFileName); // just in case in the archive there are file names with drives if (IsFileDirectory(uIndex)) { ForceDirectory(szFile); SetFileAttributes(szFile, header.m_uExternalAttr); } else { if (!OpenFile(uIndex)) return false; ForceDirectory(GetFilePath(szFile)); CFile f(szFile, CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite); DWORD iRead; CAutoBuffer buf(nBufSize); do { iRead = ReadFile(buf, buf.GetSize()); if (iRead) f.Write(buf, iRead); } while (iRead == buf.GetSize()); CloseFile(f); } return true; }
void FileProperties::Load() { if(!loaded) { loaded=true; smallIcon=GetFileIcon(fullPath, SHGFI_SMALLICON | SHGFI_ICON); bigIcon=GetFileIcon(fullPath, SHGFI_LARGEICON | SHGFI_ICON); isDirectory=IsFileDirectory(fullPath); displayName=GetFileDisplayName(fullPath); typeName=GetFileTypeName(fullPath); lastWriteTime=GetFileLastWriteTime(fullPath); size=GetFileSize(fullPath); } }