zoukankan      html  css  js  c++  java
  • Delphi 解压缩 ZipForge

    ZipForge

    http://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

    c++builder、Delphi 压缩文件

    ZipForge is a fast and powerful VCL Zip component, written in Delphi.
    It lets you easily create ZIP archives, extract files from zip files to hard drive or memory, add files to a zip archive from disk or memory, replace, move and delete files in zip archives. Also it creates and reads self-extracting (SFX) zip archives, AES encrypted and multi-volume zip files.

    ZipForge main features:

      • Opens and creates archives encrypted with strong AES encryption algorithm
      • Zip64 supports - lets you create ZIP files over 4 GB
      • Unicode file names support
      • Includes transaction system which allows you to rollback changes if archive update failed
      • Adds compressed data directly from streams and extracts archived files to streams without creating temp files
      • Lets you store full path with drive for each file
      • Allows to search for files inside archive by mask
      • Progress indication
      • Full Delphi source code is available 
    zf: TZipForge;
    zf := TZipForge.Create(nil);
    zf.OpenArchive(aInStream, False);
    zf.ExtractToStream(FileName, StreamOut);

    setup Path

    D:Program Files (x86)ComponentAceipForge

    压缩文件

    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->FileName = "a.zip";
        ZipForge1->OpenArchive( );
        // To String
        String StrOut;
        ZipForge1->ExtractToString( "a.txt", StrOut );
        Memo1->Text = StrOut;
        ZipForge1->CloseArchive( );
    }

    查找压缩包文件列表,找到文件名称,然后

    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/

  • 相关阅读:
    35.python之事件驱动模型
    33.python之操作系统,进程,线程
    VRChat之blender2.8版本设置
    VRChat模型制作及上传总篇(201912)
    linux常用指令
    java基础File的简单使用记录
    java 通过实现Comparable接口使用Collections.sort排序 及 利用set的特性对 list 进行去重
    [转发] java字符串-编码转换-工具类
    ssh服务不能远程时,使用telnet远程登录
    java中List遍历删除元素相关做法和注意事项
  • 原文地址:https://www.cnblogs.com/cb168/p/4949565.html
Copyright © 2011-2022 走看看