void CompressList(LPCSTR in_name, xr_vector<char*>* list, xr_vector<char*>* fl_list, BOOL bFast, BOOL make_pack, LPCSTR copy_path) { if (!list->empty() && in_name && in_name[0]){ string256 caption; VERIFY ('\\'!=in_name[xr_strlen(in_name)-1]); string_path tgt_folder; _splitpath (in_name,0,0,tgt_folder,0); int pack_num = 0; if (make_pack) OpenPack (tgt_folder,pack_num++); for (u32 it=0; it<fl_list->size(); it++) write_file_header ((*fl_list)[it],0,0,0,0); c_heap = xr_alloc<u8> (LZO1X_999_MEM_COMPRESS); //***main process***: BEGIN for (u32 it=0; it<list->size(); it++){ sprintf (caption,"Compress files: %d/%d - %d%%",it,list->size(),(it*100)/list->size()); SetWindowText (GetConsoleWindow(),caption); printf ("\n%-80s ",(*list)[it]); if (make_pack){ if (fs->tell()>XRP_MAX_SIZE){ ClosePack (); OpenPack (tgt_folder,pack_num++); } Compress ((*list)[it],in_name,bFast); } if (copy_path && copy_path[0]){ string_path src_fn, dst_fn; strconcat (sizeof(src_fn),src_fn,in_name,"\\",(*list)[it]); strconcat (sizeof(dst_fn),dst_fn,copy_path,tgt_folder,"\\",(*list)[it]); printf (" + COPY"); int age = FS.get_file_age(src_fn); FS.file_copy (src_fn,dst_fn); FS.set_file_age (dst_fn,age); } } if (make_pack) ClosePack (); xr_free (c_heap); //***main process***: END } else { Msg ("ERROR: folder not found."); } }
//销毁接口对象 void KPackFileManager::Release() { for (int i = 0; i < PACK_FILE_SHELL_MAX_SUPPORT_PAK_NUM; i++) { ClosePack(i); } delete this; }
void xrCompressor::PerformWork() { if (!files_list->empty() && target_name.size()) { string256 caption; int pack_num = 0; OpenPack (target_name.c_str(), pack_num++); for (u32 it=0; it<folders_list->size(); it++) write_file_header ((*folders_list)[it],0,0,0,0); if(!bStoreFiles) c_heap = xr_alloc<u8> (LZO1X_999_MEM_COMPRESS); for (u32 it=0; it<files_list->size(); it++) { xr_sprintf (caption,"Compress files: %d/%d - %d%%",it,files_list->size(),(it*100)/files_list->size()); SetWindowText (GetConsoleWindow(),caption); printf ("\n%-80s ",(*files_list)[it]); if (fs_pack_writer->tell()>XRP_MAX_SIZE) { ClosePack (); OpenPack (target_name.c_str(), pack_num++); } CompressOne ((*files_list)[it]); } ClosePack (); if(!bStoreFiles) xr_free (c_heap); }else { Msg ("ERROR: folder not found."); } }