bool CFile::Open(const std::string & strFilename, file_type_t type, file_mode_t mode) { // maybe we already have some file opened if(m_File) return false; // check for specified type if(type == FILE_PACKAGE) { return OpenPackage(strFilename, mode); } else if(strFilename.find(".pak") != std::string::npos) { return OpenPackage(strFilename, mode); } else { return OpenStandard(strFilename, mode); } // nothing could be done return false; }
void CFilesPackage::OpenPackage(const nstring & pkg, bool write) { CGZFileStream *file = new CGZFileStream(); if(!write) dynamic_cast<CGZFileStream *>(file)->Open(pkg, GZ_READ); else { mPackageName = pkg; dynamic_cast<CGZFileStream *>(file)->Open(pkg + ".package", GZ_WRITE_WITH_COMPRESS_8); } OpenPackage(file, write); mSelfOpen = true; }