GithubHelp home page GithubHelp logo

anewanonymous / cl.io.zip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jarvin-guan/cl.io.zip

0.0 1.0 0.0 42.69 MB

CL.IO.Zip(v1.1.0) is a Zip library written in C# for the .NET platform. it provide process delegate.

C# 99.07% JavaScript 0.48% CSS 0.08% HTML 0.06% Objective-C 0.31%

cl.io.zip's Introduction

CL.IO.Zip

####    CL.IO.Zip 是一个基于SharpZipLib的一个压缩和解压的类库,提供给用户在.net环境下使用(VB.NET,C#..等等)当前最新版本为:V1.1.0 百度网盘下载地址:http://pan.baidu.com/s/1qWwZ0LI


    做任何操作之前,请使用单例模式,获取ZipHandler对象。

    ZipHandler handler = ZipHandler.GetInstance();

##1.压缩

    1.1压缩文件夹,并获取压缩进度。

Method:PackDirectory

    public void PackDirectory(string strDirectory, string zipedFile, ProcessChange changedDG)

Demo

    var fromDic="E:\ZipTest";\\需要压缩的文件夹路径

    var toZip="E:\ZipFile.zip";\\生成压缩包的目标路径

    handler.PackDirectory(fromDic, toZip, (num) => { Debug.WriteLine("pack num:" + num); });\\num为百分比,最大为100,可在此处写处理逻辑

    1.2添加文件到zip文件中。

Method:AddFile

    public void AddFile(string filePath, string zipPath,string filePathInZip)

Demo

    var filePath="E:\ReadyToAdd.txt";\\需要添加到压缩包的文件路径

    var zipPath="E:\ZipFile.zip";\\压缩包文件路径

    handler.AddFile(filePath, zipPath, @"123" + Path.GetFileName(filePath));\\需要添加到压缩包的文件路径

    1.3添加文件夹到zip文件中(此函数支持是否保存文件路径的格式。)

Method:AddDirectory

    public void AddDirectory(string dicPath,string zipPath,string dicPathInZip,ProcessChange changedDG)

Demo

    var dicPath="E:\ReadyToAddDic";\\需要添加到压缩包的文件夹路径

    var zipPath="E:\ZipFile.zip";\\压缩包文件路径

    var dicPathInZip="ReadyToAddDic";\\需要压缩到压缩包内的相对路径,当前值指的是根目录的ReadyToAddDic

    handler.IsKeepPath=true;\\保存原路径

    handler.AddDirectory(dicPath, zipPath, dicPathInZip,(num) => { Debug.WriteLine("压缩进度:" + num); });

##2.解压

    2.1对压缩包进行解压。

Method:UnpackAll

     public void UnpackAll(string zipFilePath, string unzipPath, ProcessChange changedDG)

Demo

    var fromZip="E:\ZipTest.zip";\\需要解压的压缩文件路径

    var toDic="E:\ZipFile";\\解压到的文件夹路径

    handler.UnpackAll(fromZip, toDic, (num) => { Debug.WriteLine("解压进度:" + num); });

    2.2解压压缩包内的指定文件。

Method:UnpackFile

    public void UnpackFile(string zipFilePath,string unzipPath,string filePathInZip)

Demo

    var fromZip="E:\ZipFile.zip";

    var toDic="E:\UnZipTest";

    handler.UnpackFile(fromZip, toDic, @"models/db.js");

    2.3解压压缩包内的指定文件夹。

Method:UnpackDirectory

    public void UnpackDirectory(string zipFilePath, string unzipPath, string DicPathInZip)

Demo

    var fromZip="E:\ZipFile.zip";\\压缩包文件路径

    var toDic="E:\UnZipTest";

    var dicPathInZip="node_modules";

    handler.IsKeepPath=true;\\保存原路径

    handler.UnpackDirectory(fromZip, toDic, dicPathInZip);

cl.io.zip's People

Contributors

jarvin-guan avatar

Watchers

SuperStar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.