在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
ZipForgehttp://www.componentace.com/zip_component_zip_delphi_zipforge.htm downLoad http://www.componentace.com/download/download.php?editionid=12 Example http://www.componentace.com/zip-delphi.htm 这个压缩是通用的,其他压缩软件能打开。 procedure TFrmMain.myzipZF(ainFile,aoutFile:string); var ms:tmemorystream; begin ms := tmemorystream.Create; ms.LoadFromFile(ainFile); self.ZipForge1.FileName :=aoutFile; self.ZipForge1.OpenArchive; self.ZipForge1.AddFromStream(system.IOUtils.TPath.GetFileName(ainFile),ms,true ); self.ZipForge1.CloseArchive; ms.Free; end; proced
c++builder、Delphi 压缩文件 ZipForge is a fast and powerful VCL Zip component, written in Delphi. ZipForge main features:
zf: TZipForge; zf := TZipForge.Create(nil); zf.OpenArchive(aInStream, False); zf.ExtractToStream(FileName, StreamOut);
var Zip:=TZipForge.Create(nil); setup Path D:\Program Files (x86)\ComponentAce\ZipForge 压缩文件 void __fastcall TForm4::Button1Click( TObject * Sender ) { TMemoryStream * ms = new TMemoryStream( ); Memo1->Text="Hello Word!"; Memo1->Lines->SaveToStream( ms ); ZipForge1->FileName = "a.zip";//压缩包的名称 ZipForge1->OpenArchive( ); ZipForge1->AddFromStream( "a.txt", ms, true );//压缩包里的文件 //ZipForge1->AddFromString("b.txt","text2",) ZipForge1->CloseArchive( ); delete ms; } 解压缩 void __fastcall TForm4::Button2Click( TObject * Sender ) { TMemoryStream * ms = new TMemoryStream( ); ZipForge1->FileName = "a.zip";//压缩包名称 ZipForge1->OpenArchive( ); ZipForge1->ExtractToStream( "a.txt", ms );//压缩包里的文件 ms->Position = 0; Memo1->Lines->LoadFromStream( ms ); // To String // String StrOut; // ZipForge1->ExtractToString( "a.txt", StrOut ); ZipForge1->CloseArchive( ); delete ms; }
解压缩到字符串 void __fastcall TForm4::Button2Click( TObject * Sender ) 查找压缩包文件列表,找到文件名称,然后 ZipForge1->ExtractToStream(文件名,stream); Use FindFirst and FindNext methods of TZipForgefor searching files within the archive file. 获得压缩包中的文件列表 TZFArchiveItem afItem; bool aFound = ZipForge1->FindFirst( "*.*", afItem, faAnyFile, "" ); while ( aFound ) { this->mmoFileList->Lines->Add( afItem.FileName ); aFound = ZipForge1->FindNext( afItem ); } 压缩包文件详情 this->mmoFileList->Lines->Add( afItem.FileName ); this->mmoFileList->Lines->Add( ">>>>" ); this->mmoFileList->Lines->Add( afItem.StoredPath ); this->mmoFileList->Lines->Add( afItem.CompressedSize );//压缩后文件大小 this->mmoFileList->Lines->Add( afItem.UncompressedSize );//压缩前文件大小 this->mmoFileList->Lines->Add( afItem.CompressionRate ); this->mmoFileList->Lines->Add((int) afItem.Encrypted ); this->mmoFileList->Lines->Add( afItem.LastModFileDate ); this->mmoFileList->Lines->Add( afItem.LastModFileTime ); this->mmoFileList->Lines->Add( afItem.CRC ); this->mmoFileList->Lines->Add( afItem.ExternalFileAttributes ); this->mmoFileList->Lines->Add( afItem.Comment );
从流中解压 TMemoryStream * ms; ms = new TMemoryStream( ); ms->LoadFromFile( "a.zip" ); ZipForge1->OpenArchive( ms, false );
.Net c# ICSharpCode.SharpZipLib.dll ZipOutputStream http://icsharpcode.github.io/SharpZipLib/
自带zip var zip:TZipFile;//压缩文件 ss:tstringstream; begin ss:=tstringstream.Create('hello'); zip:=tzipfile.Create; zip.Open('aa.zip',zmwrite); zip.Add(ss,'com.txt'); zip.Close; zip.Free; ss.Free; 解压文件 var zip := TZipFile.Create; zip.Open('aa.zip',zmRead); self.Caption:=zip.FileName[0]; zip.ExtractAll(); zip.Close; zip.Free; 大文件200M的怎么等解压完再结束,
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论