Dotnet zip library examples




















Branches Tags. Could not load branches. Could not load tags. Latest commit. Git stats 4 commits. Failed to load latest commit information. BZip2 CF. BZip2 Tests. Setup Runtime. Setup Utils. Zip CF. Zip Full DLL. Zip Reduced. Zip SL. Zip Tests. Zlib CF. Zlib Tests. View code. What do I need, in order to be able to create and read zip files from within my application using this library? What if I just want to use the graphical tool? What do I need to build this library from the source? How big is the library?

Why would you want to produce yet another Zip Library? Does this library make self-extracting zip files? Does this library read self-extracting zip files? Are the zip files this library makes compatible with the Java. NET application, using this library? Can I use Windows Explorer to open the zip files that this library creates, and vice versa? Does the library work with applications that depend on the. NET Compact Framework? Is there a version of the library built to work with Silverlight applications?

Does the library support zero-length zip entries, zipfile comments, zip entry comments, zipping up empty directories, recursive directory traversal, zipping up selected files by filename with wildcards , and password-protecting entries?

Does the library handle ZIP64? Does the library do AES or encryption? Does this library support any compression algorithm other than deflate? Can the library read or create "Split" zip files? Does this library use System. Why would a developer not just use the Packaging APIs included in the. NET Framework 3. Does the library support reading or writing encrypted or password protected zip files? Can Windows Explorer "compressed folders" read and extract the zip files created by this library if the zip has password protection?

Can I use the DotNetZip library to read. Does the library support Unicode filenames and comments? Can the library be used to read a zip file that has entries with filenames containing Chinese characters, produced by WinRAR?

What about reading and writing zip files with other languages and code pages? Can Windows Explorer "compressed folders" read the zip files created by this library if the zip has entries with Unicode-encoded filenames?

Is there documentation for the library? I cannot view the CHM documentation. The error is: "This program cannot display the webpage. Does the library support zipping to a stream? Or unzipping from a stream? Ok, the library can write a zip archive to a stream, and read a zip from a stream, But Can an application read an entry as a stream?

Does this library allow removal of entries from zip files, or updating of entries in zip files? Packaging namespace, but Microsoft has done a terrible job with it. It requires all sorts of strange URIs, resource and document parts, relationships, and running data through streams when you should just be able to add and remove objects. Possibly the same people who designed the way WPF works with bitmaps. The DotNetZip library , which is free, provides. NET managed classes that you can use from C to compress and decompress true Zip files.

To get started, download the library and unzip it. Put it somewhere you can find it easily during development because the library contains the compiled DLL that you will use. The library includes several different versions for normal Visual Studio, compact framework, Silverlight, and so on. For normal use, you would use the normal version, which currently is in the zip-v1.

Sub-folders contain Debug and Release versions. To use the library, create a new program. Open the Project menu and select Add Reference. NET class library, because it isn't a. NET class library. So for all those reasons, J isn't ideal.

This works in a limited fashion. The drawbacks here: it isn't documented. It isn't a very intuitive or powerful programming interface. There are no events, so embedding it into a Winforms app with a progress bar would be difficult. Also, the shell In fact in some cases, calling into this DLL to perform a ZIP extraction can display a dialog box, so it may not be suitable for use within server or "headless" applications.

There are other libraries out there than do zip files for. But there are compromises with each one. Some are commercial and expensive.

Some are slow. Some are complicated to use. Some of these options lack features. Some of them have more than one of these drawbacks. DotNetZip provides another option. It's a very simple-to-use class library that provides good ZIP file support. Using this library, you can write. The library also supports self-extracting archives. It is well documented and provides good performance. Though DotNetZip is implemented in. There is a version of this library available for the.

NET Compact Framework, too. I have not tested DotNetZip for use with Mono, but I've heard reports that people use the binary releases with Mono successfully, without change. This software is open source. It is released under the Microsoft Public License of October The use of the "Microsoft Public License" does not mean it is licensed by Microsoft. See the License. It is packaged as a DLL that your application must reference: Ionic.

In the "developer's kit" package, there is documentation, code examples, and debug versions of the DLL. The ZIP library depends on a set of supporting classes for doing compression and decompression; these are exposed in other namespaces.

Likewise, if you want to do BZIP2 compression, outside the scope of a zip file, you can use the Ionic. For each DLL, there is a version for the regular. DotNetZip also includes command-line and GUI tools for manipulating zip files; these can be helpful to developers when building applications that create or manipulate zip files. They also can be helpful as end-user tools. There are other downloads for DotNetZip - the source package, the runtime-only package DLLs and no helpfile or tools , the documentation-only package, etc.

There are many other examples available: some are included in the source package, some in the class reference documentation in the help file, and others on the web. Those examples provide many illustrate how to read and write zip files, taking advantage of all the various features of zip files exposed by the library.

For a full set of examples, your best bet is to see the documentation. Here's a basic primer:. The main type you will use to fiddle with zip files is the ZipFile class. Full name: Ionic.

You use this to create, read, or update zip files. There is also a ZipOutputStream class, which offers a Stream metaphor, for those who want it. You should choose one or the other for your application. ExtractAll End Using. Extract Next End Using. Notice that a using clause is always employed. DOn't forget this.

Don't leave it off. If you don't understand what it is, don't just skip it. It's important. There are a number of other options for using the class library. For example, you can read zip archives from streams, or you can create write zip archives to streams, or you can extract into streams. You can apply passwords for weak encryption. You can specify a code page for the filenames and metadata of entries in an archive.

You can rename entries in archives, and you can add or remove entries from archives. You can set up save and read progress events. Check the documentation for complete information, or use Visual Studio's intellisense to explore some of the properties and methods on the ZipFile class. Another type you will use is ZipEntry. This represents a single entry - either a file or a directory - within a ZipFile. You never directly instantiate a ZipEntry type. For example, the following code adds a file as an entry into a ZipFile, then renames the entry within the zip file:.

Extracting a zip file that was created in this way will produce a file called "RenamedFile. As an alternative to using ZipFile type to create a zip file, you can use the ZipOutputStream type to create zip files. To do so, wrap it around a stream, and write to it. It cannot read or update zip files. If you want to read zip files using a streaming metaphor, you can use ZipInputStream.

The former is for reading zip files; the latter is for writing them. One important note: the ZipFile. AddXxx methods add the file or directory you specify, including the directory. Save ;. When you extract that file from the zip, either using this Zip library or winzip or the built-in zip support in Windows, or some other package, all those directories will be created, and the file will be written into that directory hierarchy.

If you don't want that directory information in your archive, then you need to use the overload of the AddFile method that allows you to explicitly specify the directory used for the entry within the archive:. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.

Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 0. Related Hot Network Questions.



0コメント

  • 1000 / 1000