int FSZip::load(string backfile, string filename, FileBuffer *p, bool async) { Zip zip; if (zip.Open(backfile.substr(1))) return -1; if (!zip.check_file_exist(filename)) return -1; if (async) { p->m_aync_thread = thread(zip_async_load, backfile, filename, p); } else { shared_ptr<FileBuffer> pzip = zip.get_file_buff(filename); if (pzip == NULL) return -1; p->swap(*pzip); p->m_loaded = true; } return 0; }
bool FSZip::exist(string backfile, string filename) { Zip zip; if (zip.Open(backfile.substr(1))) return false; return zip.check_file_exist(filename); }