{"id":13408587,"url":"https://github.com/haf/DotNetZip.Semverd","last_synced_at":"2025-03-14T13:31:42.898Z","repository":{"id":1741817,"uuid":"2277110","full_name":"haf/DotNetZip.Semverd","owner":"haf","description":"Please use System.IO.Compression! A fork of the DotNetZip project without signing with a solution that compiles cleanly. This project aims to follow semver to avoid versioning conflicts.  DotNetZip is a FAST, FREE class library and toolset for manipulating zip files. Use VB, C# or any .NET language to easily create, extract, or update zip files.","archived":true,"fork":false,"pushed_at":"2024-05-15T15:16:24.000Z","size":7098,"stargazers_count":545,"open_issues_count":110,"forks_count":216,"subscribers_count":45,"default_branch":"master","last_synced_at":"2024-05-28T12:53:30.910Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-08-26T23:19:05.000Z","updated_at":"2024-06-18T13:49:55.446Z","dependencies_parsed_at":"2024-06-18T13:59:59.700Z","dependency_job_id":null,"html_url":"https://github.com/haf/DotNetZip.Semverd","commit_stats":{"total_commits":216,"total_committers":46,"mean_commits":4.695652173913044,"dds":0.8425925925925926,"last_synced_commit":"42a096d455e0eaaa80f1344024df0d36c106de80"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haf%2FDotNetZip.Semverd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haf%2FDotNetZip.Semverd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haf%2FDotNetZip.Semverd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haf%2FDotNetZip.Semverd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haf","download_url":"https://codeload.github.com/haf/DotNetZip.Semverd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243584339,"owners_count":20314737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:00:53.872Z","updated_at":"2025-03-14T13:31:41.153Z","avatar_url":"https://github.com/haf.png","language":"C#","readme":"## Repository archived\r\n\r\nThis repository was created before `System.IO.Compression` and the code is unmaintained\r\nat this point. Please transition to `System.IO.Compression`.\r\n\r\nIntroducing the DotNetZip Library and Tools\r\n-------------------------------------------\r\n\r\n\r\n\r\nDotNetZip is the name of an open-source project that delivers a .NET\r\nlibrary for handling ZIP files, and some associated tools.\r\n\r\n - The library allows .NET programmers to build applications\r\n   that read, create and modify ZIP files.\r\n\r\n - The tools are .NET programs that rely on the library, and can be used\r\n   by anyone on any Windows machine to build or extract ZIP files.\r\n\r\n\r\n## How to build?\r\n\r\n`bundle \u0026\u0026 rake`\r\n\r\nCI: https://ci.appveyor.com/project/haf/dotnetzip-semverd\r\n\r\nWhy DotNetZip?\r\n---------------------------------\r\n\r\nThe Microsoft .NET Framework base class library lacks a good set of\r\nbuilt-in classes for creating and reading ZIP files, and Windows itself\r\nlacks full-powered built-in ZIP tools.  DotNetZip fills those needs.\r\n\r\nThere are other ZIP libraries available, but some of them have licenses\r\nthat may be unfriendly, some of them are too hard to use or not powerful\r\nenough, and some of them are too expensive (not free).  DotNetZip\r\nprovides one more alternative. The goals for this alternative:\r\n\r\n - easy to adopt - low cost (Free), and a friendly license\r\n - fully-featured\r\n - good performance - in speed and compression\r\n - easy to use.\r\n\r\n\r\n\r\nDotNetZip background\r\n---------------------------------\r\n\r\nMany people seem to think, incorrectly, that the classes in the\r\nSystem.IO.Compression namespace, like GZipStream or DeflateStream, can\r\ncreate or read zip files. Not true.\r\n\r\nThe System.IO.Compression namespace, available starting with .NET v2.0\r\nfor the desktop Framework and v3.5 for the Compact Framework, includes\r\nbase class libraries supporting compression within streams - both the\r\nDeflate and Gzip formats are supported. But these classes are not\r\ndirectly useful for creating compressed ZIP archives.  GZIP is not\r\nZIP. Deflate is not ZIP.  The GZipStream in System.IO.Compression is\r\nable to read and write GZIP streams, but that is not the same as reading\r\nor writing a zip file.  Also, these classes deliver poor compression in\r\npractice, especially with binary data, or previously-compressed data.\r\n\r\n\r\nYes, it is possible to read and write zip files, using the classes in\r\nthe .NET Framework.\r\n\r\n  - You can do it with the System.IO.Packaging.ZipPackage class, added\r\n    in .NET v3.0. Actually this class lets you create a package file,\r\n    which is a zipfile with a particular internal structure. It includes\r\n    a manifest and some other things.  But the interface is odd and\r\n    confusing if all you want is a regular-old ZIP file.  Also, the\r\n    classes in this namespace do not provide control for things like\r\n    passwords, comments, AES encryption, ZIP64, Unicode, and so on.\r\n\r\n  - You can also create and read zip files with the J# runtime. This\r\n    also has its drawbacks.  First, J# is going out of support, or may\r\n    be out of support now.  Second, the J# runtime is huge, and you have\r\n    to swallow the whole thing, even if all you want is zip file\r\n    capability.  Also, the J# runtime is based on the java.util.zip\r\n    classes from Java v1.4, dating from 1998.  The runtime hasn't been\r\n    updated in years and still includes bugs in zip file handling. It\r\n    lacks support for AES, for ZIP64, and Unicode.  It is not accessible\r\n    from COM. Finally, the zip classes in the J# runtime are decidedly\r\n    un-dotnet.  There's no support for events, or enumerators to let you\r\n    do things like For Each in VB, or foreach in C#. The interface is\r\n    clunky. It does not feel like a .NET class library, because it isn't\r\n    a .NET class library.  So for all those reasons, J# isn't ideal.\r\n\r\n  - You can also rely on P/Invoke to the shell32.dll, and the\r\n    ShellClass. This works in a limited fashion. The drawbacks here: it\r\n    isn't documented.  It isn't a very intuitive or powerful programming\r\n    interface.  There are no events, so embedding it into a Winforms app\r\n    with a progress bar would be difficult.  Again it lacks an easy way\r\n    to use or access many ZIP features, like encryption or ZIP64 or\r\n    self-extracting archives.  Also, the shell32.dll is designed for use\r\n    within Windows Explorer, and presumes a user interface.  In fact in\r\n    some cases, calling into this DLL to perform a ZIP extraction can\r\n    display a dialog box, so it may not be suitable for use within\r\n    server or \"headless\" applications.\r\n\r\n\r\nThere are other libraries out there than do zip files for .NET.  But\r\nthere are compromises with each one.  Some are commercial and expensive.\r\nSome are slow.  Some are complicated to use.  Some of these options lack\r\nfeatures.  Some of them have more than one of these drawbacks.\r\n\r\nDotNetZip provides another option.  It's a very simple-to-use class\r\nlibrary that provides good ZIP file support.  Using this library, you\r\ncan write .NET applications that read and write zip-format files,\r\nincluding files with passwords, Unicode filenames, ZIP64, AES\r\nencryption, and comments.  The library also supports self-extracting\r\narchives.  It is well documented and provides good performance.\r\n\r\nThough DotNetZip is implemented in .NET and was originally intended to\r\nprovide a managed-code library for ZIP files, you can now use it library\r\nfrom any COM environment, including Javascript, VBScript, VB6, VBA, PHP,\r\nPerl, and others.  Using DotNetZip, you could generate an AES-encrypted\r\nzip file from within the code of a macro running in MS-Excel, for example.\r\n\r\nDotNetZip works with applications running on PCs with Windows.  There is a\r\nversion of this library available for the .NET Compact Framework, too.\r\n\r\nI have not tested DotNetZip for use with Mono, but I've heard reports\r\nthat people use the binary releases with Mono successfully, without\r\nchange.\r\n\r\n\r\nLicense\r\n--------\r\n\r\nThis software is open source. It is released under the Microsoft Public\r\nLicense of October 2006.  The use of the \"Microsoft Public License\" does\r\nnot mean it is licensed by Microsoft.  See the License.txt file for\r\ndetails.\r\n\r\nDotNetZip is derived in part from ZLIB, the C-language library by Mark\r\nAdler and Jean-loup Gailly .  See the License.ZLIB.txt file included in\r\nthe DotNetZip download for details.\r\n\r\n\r\n\r\nWhat is DotNetZip?  and How is it packaged?\r\n---------------------------------------------\r\n\r\nDotNetZip is primarily a managed library for dealing with ZIP files.\r\n\r\nIt is packaged as a DLL that your application must reference:\r\nIonic.Zip.dll.  In the \"developer's kit\" package, there is\r\ndocumentation, code examples, and debug versions of the DLL.\r\n\r\nThe ZIP library depends on a set of supporting classes for doing\r\ncompression and decompression; these are exposed in other namespaces.\r\n\r\nThe classes in the ZIP library reside in these namespaces:\r\n\r\n   namespace     interesting classes\r\n   ------------------------------------------------------------\r\n   Ionic.Zip     ZipFile, ZipEntry, ZipOutputStream, and\r\n                 ZipInputStream.\r\n\r\n   Ionic.Zlib    DeflateStream, GZipStream, ZlibStream\r\n\r\n   Ionic.BZip2   BZip2InputStream, BZip2OutputStream\r\n\r\n   Ionic.Crc     CRC32\r\n\r\n\r\nIf you want only ZLIB (raw compression and decompression, RFC 1950,\r\n1951, and 1952), the ZLIB classes are packaged independently, in\r\nIonic.Zlib.dll.  Likewise, if you want to do BZIP2 compression, outside\r\nthe scope of a zip file, you can use the Ionic.BZip2.dll assembly.\r\n\r\nIf you want ZIP, or both ZIP and ZLIB, then your application should\r\ndepend soly on Ionic.Zip.dll; this assembly includes a superset of the\r\nclasses in Ionic.Zlib.dll and Ionic.BZip2.dll.\r\n\r\nFor each DLL, there is a version for the regular .NET Framework and\r\nanother for the Compact Framework.\r\n\r\nDotNetZip also includes command-line and GUI tools for manipulating zip\r\nfiles; these can be helpful to developers when building applications\r\nthat create or manipulate zip files. They also can be helpful as\r\nend-user tools.\r\n\r\nThere are other downloads for DotNetZip - the source package, the\r\nruntime-only package (DLLs and no helpfile or tools), the\r\ndocumentation-only package, etc.\r\n\r\n\r\n\r\n\r\nUsing the Zip Class Library: The Basics\r\n----------------------------------------\r\n\r\nThe examples here provide just the basics.\r\n\r\nThere are many other examples available: some are included in the source\r\npackage, some in the class reference documentation in the help file, and\r\nothers on the web.  Those examples provide many illustrate how to read\r\nand write zip files, taking advantage of all the various features of zip\r\nfiles exposed by the library.  For a full set of examples, your best bet\r\nis to see the documentation. Here's a basic primer:\r\n\r\nThe main type you will use to fiddle with zip files is the ZipFile\r\nclass. Full name: Ionic.Zip.ZipFile.  You use this to create, read, or\r\nupdate zip files.  There is also a ZipOutputStream class, which offers a\r\nStream metaphor, for those who want it. You should choose one or the\r\nother for your application.\r\n\r\nThe simplest way to create a ZIP file in C# looks like this:\r\n\r\n      using(ZipFile zip= new ZipFile())\r\n      {\r\n        zip.AddFile(filename);\r\n        zip.Save(NameOfZipFileTocreate);\r\n      }\r\n\r\n\r\nOr in VB.NET, like this:\r\n\r\n     Using zip As ZipFile = New ZipFile\r\n         zip.AddFile(filename)\r\n         zip.Save(\"MyZipFile.zip\")\r\n     End Using\r\n\r\n\r\nThe using clause is important; don't leave it out.\r\n\r\n\r\nThe simplest way to Extract all the entries from a zipfile looks\r\nlike this:\r\n\r\n      using (ZipFile zip = ZipFile.Read(NameOfExistingZipFile))\r\n      {\r\n        zip.ExtractAll(args[1]);\r\n      }\r\n\r\nBut you could also do something like this:\r\n\r\n      using (ZipFile zip = ZipFile.Read(NameOfExistingZipFile))\r\n      {\r\n        foreach (ZipEntry e in zip)\r\n        {\r\n          e.Extract();\r\n        }\r\n      }\r\n\r\n\r\nOr in VB, extraction would be like this:\r\n     Using zip As ZipFile = ZipFile.Read(NameOfExistingZipFile)\r\n         zip.ExtractAll\r\n     End Using\r\n\r\nOr this:\r\n     Using zip As ZipFile = ZipFile.Read(NameOfExistingZipFile)\r\n        Dim e As ZipEntry\r\n        For Each e In zip\r\n            e.Extract\r\n        Next\r\n     End Using\r\n\r\n\r\nThat covers the basics.\r\n\r\nNotice that a using clause is always employed. DOn't forget this.  Don't\r\nleave it off.  If you don't understand what it is, don't just skip it.\r\nIt's important.\r\n\r\nThere are a number of other options for using the class library.  For\r\nexample, you can read zip archives from streams, or you can create\r\n(write) zip archives to streams, or you can extract into streams.  You\r\ncan apply passwords for weak encryption.  You can specify a code page\r\nfor the filenames and metadata of entries in an archive.  You can rename\r\nentries in archives, and you can add or remove entries from archives.\r\nYou can set up save and read progress events. You can do LINQ queries on\r\nthe Entries collection.  Check the documentation for complete\r\ninformation, or use Visual Studio's intellisense to explore some of the\r\nproperties and methods on the ZipFile class.\r\n\r\nAnother type you will use is ZipEntry. This represents a single entry -\r\neither a file or a directory - within a ZipFile.  To add an entry to a\r\nzip file, you call one of the AddEntry (or AddFile) methods on the\r\nZipFile class.  You never directly instantiate a ZipEntry type.  The\r\nAddEntry/AddFile returns a ZipEntry type; you can then modify the\r\nproperties of the entry within the zip file, using that object.\r\n\r\nFor example, the following code adds a file as an entry into a ZipFile,\r\nthen renames the entry within the zip file:\r\n\r\n      using(ZipFile zip= new ZipFile())\r\n      {\r\n        ZipEntry e = zip.AddFile(filename);\r\n        e.FileName = \"RenamedFile.txt\";\r\n        zip.Save(NameOfZipFileTocreate);\r\n      }\r\n\r\nExtracting a zip file that was created in this way will produce a file\r\ncalled \"RenamedFile.txt\", regardless of the name of the file originally\r\nadded to the ZipFile.\r\n\r\n\r\nAs an alternative to using ZipFile type to create a zip file, you can\r\nuse the ZipOutputStream type to create zip files .  To do so, wrap it\r\naround a stream, and write to it.\r\n\r\n      using (var fs = File.Create(filename))\r\n      {\r\n        using(var s = new ZipOutputStream(fs))\r\n        {\r\n          s.PutNextEntry(\"entry1.txt\");\r\n          byte[] buffer = Encoding.ASCII.GetBytes(\"This is the content for entry #1.\");\r\n          s.Write(buffer, 0, buffer.Length);\r\n        }\r\n      }\r\n\r\nUnlike the ZipFile class, the ZipOutputStream class can only create zip\r\nfiles. It cannot read or update zip files.\r\n\r\nIf you want to read zip files using a streaming metaphor, you can use\r\nZipInputStream.  Think of ZipInputStream and ZipOutputStream as\r\nalternatives to using ZipFile to manipulate zip files. The former is for\r\nreading zip files; the latter is for writing them.\r\n\r\n\r\n\r\nAbout Directory Paths\r\n---------------------------------\r\n\r\nOne important note: the ZipFile.AddXxx methods add the file or\r\ndirectory you specify, including the directory.  In other words,\r\nlogic like this:\r\n    ZipFile zip = new ZipFile();\r\n    zip.AddFile(\"c:\\\\a\\\\b\\\\c\\\\Hello.doc\");\r\n    zip.Save();\r\n\r\n...will produce a zip archive that contains a single entry, or file, and\r\nthat file is stored with the relative directory information.  When you\r\nextract that file from the zip, either using this Zip library or winzip\r\nor the built-in zip support in Windows, or some other package, all those\r\ndirectories will be created, and the file will be written into that\r\ndirectory hierarchy.  At extraction time, if you were to extract that\r\nfile into a directory like c:\\documents, then resulting file would be\r\nnamed c:\\documents\\a\\b\\c\\Hello.doc .\r\n\r\nThis is by design.\r\n\r\nIf you don't want that directory information in your archive,\r\nthen you need to use the overload of the AddFile() method that\r\nallows you to explicitly specify the directory used for the entry\r\nwithin the archive:\r\n\r\n    zip.AddFile(\"c:\\\\a\\\\b\\\\c\\\\Hello.doc\", \"files\");\r\n    zip.Save();\r\n\r\nThis will create an archive with an entry called \"files\\Hello.doc\",\r\nwhich contains the contents of the on-disk file located at\r\nc:\\a\\b\\c\\Hello.doc .\r\n\r\nIf you extract that file into a directory e:\\documents, then the\r\nresulting file will be called e:\\documents\\files\\Hello.doc .\r\n\r\nIf you want no directory at all, specify \"\" (the empty string).\r\nSpecifying null (Nothing in VB) will include all the directory hierarchy\r\nin the filename, as in the orginal case.\r\n\r\n\r\n\r\n\r\nPre-requisites to run Applications that use DotNetZip\r\n-----------------------------------------------------\r\n\r\nTo run desktop applications that depend on DotNetZip:\r\n .NET Framework 4.0 or later\r\n\r\n\r\n\r\n\r\n\r\nIn more detail: The Zip Class Library\r\n----------------------------------------------\r\n\r\nThe Zip class library is packaged as Ionic.Zip.DLL for the regular .NET\r\nFramework and Ionic.Zip.CF.dll for the Compact Framework.  The Zip\r\nlibrary allows applications to create, read, and update zip files.\r\n\r\nThis library uses the DeflateStream class to compress file data,\r\nand extends it to support reading and writing of the metadata -\r\nthe header, CRC, and other optional data - defined or required\r\nby the zip format spec.\r\n\r\nThe key object in the class library is the ZipFile class.  Some of the\r\nimportant methods on it:\r\n\r\n      - AddItem - adds a file or a directory to a zip archive\r\n      - AddDirectory - adds a directory to a zip archive\r\n      - AddFile - adds a file to a zip archive\r\n      - AddFiles - adds a set of files to a zip archive\r\n      - Extract - extract a single element from a zip file\r\n      - Read - static methods to read in an existing zipfile, for\r\n               later extraction\r\n      - Save - save a zipfile to disk\r\n\r\nThere is also a supporting class, called ZipEntry.  Applications can\r\nenumerate the entries in a ZipFile, via ZipEntry.  There are other\r\nsupporting classes as well.  Typically, 80% of apps will use just the\r\nZipFile class, and will not need to directly interact with these other\r\nclasses. But they are there if you need them.\r\n\r\nIf you want to create or read zip files, the Ionic.Zip.DLL assembly is\r\nthe one you want.\r\n\r\nWhen building applications that do zip stuff, you need to add a reference to\r\nthe Ionic.Zip.dll in Visual Studio, or specify Ionic.Zip.dll with the\r\n/R flag on the CSC.exe or VB.exe compiler line.\r\n\r\n\r\n\r\n\r\nIn more detail: The Zlib Class Library\r\n-----------------------------------------\r\n\r\nThe Zlib class library is packaged as Ionic.Zlib.DLL for the regular .NET\r\nFramework and Ionic.Zlib.CF.dll for the Compact Framework.  The ZLIB\r\nlibrary does compression and decompression according to IETF RFC's 1950 (ZLIB),\r\n1951 (Deflate), and 1952 (GZIP).\r\n\r\nSee http://www.ietf.org/rfc/rfc1950.txt\r\n    http://www.ietf.org/rfc/rfc1951.txt\r\n and  http://www.ietf.org/rfc/rfc1952.txt\r\n\r\n\r\nThe key classes are:\r\n\r\n  ZlibCodec - a class for Zlib (RFC1950/1951/1952) encoding and decoding.\r\n        This low-level class does deflation and inflation on buffers.\r\n\r\n  DeflateStream - patterned after the DeflateStream in\r\n        System.IO.Compression, this class supports compression\r\n        levels and other options.\r\n\r\n  GZipStream - patterned after the GZipStream in\r\n        System.IO.Compression, this class supports compression\r\n        levels and other options.\r\n\r\n  ZlibStream - similar to the GZipStream in\r\n        System.IO.Compression, this class generates or consumes raw ZLIB\r\n        streams.\r\n\r\n\r\nIf you want to simply compress (deflate) raw block or stream data, this\r\nlibrary is the thing you want.\r\n\r\nWhen building applications that do zlib things, you need to add a reference to\r\nthe Ionic.Zlib.dll in Visual Studio, or specify Ionic.Zlib.dll with the\r\n/R flag on the CSC.exe or VB.exe compiler line.\r\n\r\nNB: If your application does both Zlib and Zip stuff, you need only add\r\na reference to Ionic.Zip.dll.  Ionic.Zip.dll includes all the capability\r\nin Ionic.Zlib.dll.  Ionic.Zip.dll is a superset.\r\n\r\n\r\n\r\nIn more detail: The BZip2 Class Library\r\n-----------------------------------------\r\n\r\nThe BZip2 class library is packaged as Ionic.BZip2.DLL for the regular .NET\r\nFramework and Ionic.BZip2.CF.dll for the Compact Framework.  The BZip2\r\nlibrary does compression according to the bzip2 format created by\r\nJulian Seward.\r\nSee http://en.wikipedia.org/wiki/Bzip2\r\n\r\nNB: If your application does a combination of BZip2, Zlib and Zip stuff,\r\nyou need only add a reference to Ionic.Zip.dll.  Ionic.Zip.dll includes\r\nall the capability in Ionic.Zlib.dll and Ionic.BZip2.dll.  Ionic.Zip.dll\r\nis a superset.\r\n\r\nIf you try to link to more than one of these, you will get compiler\r\nwarnings about \"duplicate types\".\r\n\r\n\r\n\r\nNamespace changes for DotNetZip\r\n-----------------------------------------\r\n\r\nThe namespace for the DotNetZip classes is Ionic.Zip.\r\nClasses are like:\r\n  Ionic.Zip.ZipFile\r\n  Ionic.Zip.ZipEntry\r\n  Ionic.Zip.ZipException\r\n  etc\r\n\r\n(check the .chm file for the full list)\r\n\r\nFor the versions prior to v1.7, the namespace DotNetZip was Ionic.Utils.Zip.\r\nThe classes were like so:\r\n  Ionic.Utils.Zip.ZipFile\r\n  Ionic.Utils.Zip.ZipEntry\r\n  etc\r\n\r\nIf you have code that depends on an older version of the library, with\r\nclasses in the Ionic.Utils.Zip namespace), a simple namespace\r\nreplacement will allow your code to compile against the new version of\r\nthe library.\r\n\r\n\r\nIn addition to the Zip capability, DotNetZip includes capability (new\r\nfor v1.7).  For Zlib, the classes are like this:\r\n  Ionic.Zlib.DeflateStream\r\n  Ionic.Zlib.ZlibStream\r\n  Ionic.Zlib.ZlibCodec\r\n  ...\r\n\r\n(again, check the .chm file for the full list)\r\n\r\nFor v1.9.1.6, the CRC class moved from the Ionic.Zlib namespace to the\r\nIonic.Crc namespace.\r\n\r\n\r\n\r\n\r\nDependencies\r\n---------------------------------\r\n\r\nOriginally, this library was designed to depend upon the built-in\r\nSystem.IO.Compression.DeflateStream class for the compression.  This\r\nproved to be less than satisfactory because the built-in compression\r\nlibrary did not support compression levels and also was not available on\r\n.NET CF 2.0.\r\n\r\nAs of v1.7, the library includes a managed code version of zlib, the\r\nlibrary that produces RFC1950 and RFC1951 compressed streams.  Within\r\nthat version of zlib, there is also a DeflateStream class which is\r\nsimilar to the built-in System.IO.Compression.DeflateStream, but more\r\nflexible, and often more effective as well.\r\n\r\n\r\n\r\n\r\nThe Documentation\r\n--------------------------------------------\r\n\r\nThere is a single set of developer reference documentation for all of\r\nthe DotNetZip library features, including Zip and Zlib stuff.  It is\r\npackaged in two ways: As a .chm file, and as a Help Viewer 1.0 resource.\r\nThe latter is the new format suitable for viewing within VS2010.\r\n\r\nIf you only use the Zlib stuff, then you should focus on the doc in the\r\nIonic.Zlib namespace.  Likewise BZip2.  If you are building apps for\r\nmobile devices running the Compact Framework, then ignore the pieces\r\nthat deal with SaveSelfExtractor() and AES.\r\n\r\nConsult the help file for more specifics here.\r\n\r\nIn some cases, upon opening the .chm file for DotNetZip, the help\r\nitems tree loads, but the contents are empty. You may see an error:\r\n\"This program cannot display the webpage.\"  or, \"Address is invalid.\"\r\nIf this happens, it's likely that you've encountered a problem with Windows\r\nprotection of files downloaded from less trusted locations. To work around\r\nthis, within Windows Explorer, right-click on the CHM file, select properties,\r\nand Unblock it, using the button in lower part of properties window.\r\n\r\nThe help is also packaged in a format that you can integrate into Visual\r\nStudio 2008, or Visual Studio 2010.  VS2008 requires MS Help 2.0, while\r\nVS2010 requires a different, newer format, sometimes called MS Help 3,\r\nand sometimes (confusingly) called \"MS Help Viewer 1.0 format\".\r\n\r\nThe DotNetZip \"devkit\" download includes help in all these formats.\r\n\r\n\r\n\r\nThe Zip Format\r\n---------------------------------\r\nThe zip format is described by PKWare, at\r\n  http://www.pkware.com/business_and_developers/developer/popups/appnote.txt\r\n\r\nEvery valid zipfile conforms to this specification.  For example, the\r\nspec says that for each compressed file contained in the zip archive,\r\nthe zipfile contains a byte array of compressed data.  (The byte array\r\nis something the DeflateStream class can produce directly.)  But the\r\nzipfile also contains header and \"directory\" information - you might\r\ncall this \"metadata\".  In other words, the zipfile must contain a list\r\nof all the compressed files in the archive. The zipfile also contains\r\nCRC checksums, and can also contain comments, and other optional\r\nattributes for each file.  These are things the DeflateStream class -\r\neither the one included in the .NET Framework Class Library, or the one\r\nembedded in this library - does not read or write.\r\n\r\nManaging the metadata in a zip file is most of what DotNetZip does.\r\n\r\n\r\nWhich DLL to use?\r\n--------------------------------\r\nThe binary releases of DotNetZip include multiple distinct DLLs or\r\nassemblies.  Which one should you use?\r\n\r\nThe likely answer is:  use Ionic.Zip.dll.\r\n\r\nThat's the mainstream library, the full library, and it includes all the\r\ncapability.  If you have particular requirements, like you want a\r\nsmaller library, or you want to exclude the Self-Extracting stuff, or\r\nyou only want the ZLIB capability, then you may want to choose a\r\ndifferent assembly.\r\n\r\nHere's a summary of the options.\r\n\r\n\r\nUsage scenario                                 Reference this DLL\r\n------------------------------------------------------------------\r\nreading or writing Zip files                   Ionic.Zip.dll\r\n\r\nraw block or stream compression, ZLIB, GZIP,   Ionic.Zlib.dll\r\n   or DEFLATE\r\n\r\nraw block or stream compression, BZIP2         Ionic.BZip2.dll\r\n\r\nboth raw compression as well as reading        Ionic.Zip.dll\r\n   or writing Zip files\r\n\r\nreading or writing Zip files, using desktop    Ionic.Zip.Reduced.dll\r\n  .NET framework but never creating a\r\n  self-extracting archive\r\n\r\n\r\nNever reference both Ionic.Zlib.dll and Ionic.Zip.dll, or both\r\nIonic.BZip2.dll and Ionic.Zip.dll in the same application.  If your\r\napplication does both Zlib and Zip stuff, you need only add a reference\r\nto Ionic.Zip.dll.  Ionic.Zip.dll includes all the capability in\r\nIonic.Zlib.dll and Ionic.BZip2.dll You always need to reference only a\r\nsingle Ionic DLL, regardless whether you use Zlib or BZip2 or Zip or\r\nsome combination.\r\n\r\n\r\n\r\n\r\nSelf-Extracting Archive support\r\n--------------------------------\r\n\r\nThe Self-Extracting Archive (SFX) support in the library allows you to\r\ncreate a self-extracting zip archive.  An SFX is both a standard EXE\r\nfile *and* a ZIP file.  The exe contains boilerplate program logic to\r\nunzip the embedded zip file.  When the user executes the SFX runs, the\r\nboilerplate application logic just reads the zip content and\r\nthen unzips itself. You can open an SFX in WinZip and other zip tools,\r\nas well, if you want to view it.\r\n\r\nRunning the SFX (unpacking from the SFX) requires the .NET Framework\r\ninstalled on the machine, but does not require the DotNetZip library.\r\n\r\nThere are two versions of the SFX - one that presents a GUI form, and\r\nanother that runs as a console (command line) application.\r\n\r\nNB: Creation of SFX is not supported in the Compact Framework version of\r\nthe library.\r\n\r\nAlso, there is no way, currently, to produce an SFX file that can run on\r\nthe .NET Compact Framework.\r\n\r\n\r\n\r\n\r\nThe Reduced ZIP library\r\n--------------------------------\r\n\r\nThe full DotNetZip library is currently about 400k in size.  The SFX\r\n(Self-Extracting Archive) support is responsible for more than half the\r\ntotal size of the library.  Some deployments may wish to omit the SFX\r\nsupport in order to get a smaller DLL. For that you can rely on the\r\nIonic.Zip.Reduced.dll.  It provides everything the normal library does,\r\nexcept the SaveSelfExtractor() method on the ZipFile class.\r\n\r\nFor size comparisons...these approximate figures are for v1.9.1.6 of the\r\nlibrary:\r\n\r\n\r\n#### Desktop Framework:\r\n```\r\n  assembly              ~size   comment\r\n  -------------------------------------------------------\r\n  Ionic.Zlib.dll         100k   {Deflate,GZip,Zlib}Stream and ZlibCodec\r\n\r\n  Ionic.BZip2.dll         57k   BZip2{Input,Output}Stream\r\n\r\n  Ionic.Zip.dll          460k   includes ZLIB and BZIP2 compression,\r\n                                SFX, selector logic, WinZIP AES encryption,\r\n                                and the ComHelper class\r\n\r\n  Ionic.Zip.Reduced.dll  250k   includes everything in the main ZIP\r\n                                library except SFX. (ability to save\r\n                                Self-extracting archives)\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nSupport\r\n--------------------------------------------\r\n\r\nThere is no official support for this library.  I try to make a good\r\neffort to answer questions and monitor the work items raised on the\r\nproject portal at:\r\n\r\n    http://DotNetZip.codeplex.com.\r\n\r\n\r\n\r\n\r\n\r\nAbout Intellectual Property\r\n---------------------------------\r\n\r\nI am no lawyer, but before using this library in your app, it\r\nmay be worth reviewing the various licenses.\r\n\r\nThe specification for the zip format, which PKWARE owns, includes a\r\nparagraph that reads:\r\n\r\n  PKWARE is committed to the interoperability and advancement of the\r\n  .ZIP format.  PKWARE offers a free license for certain technological\r\n  aspects described above under certain restrictions and conditions.\r\n  However, the use or implementation in a product of certain technological\r\n  aspects set forth in the current APPNOTE, including those with regard to\r\n  strong encryption or patching, requires a license from PKWARE.  Please\r\n  contact PKWARE with regard to acquiring a license.\r\n\r\nContact pkware at:  zipformat@pkware.com\r\n\r\nThis library does not do strong encryption as described by PKWare, nor\r\ndoes it do patching.  But again... I am no lawyer.\r\n\r\n\r\nThis library uses a ZLIB implementation that is based on a conversion of\r\nthe jzlib project http://www.jcraft.com/jzlib/.  The license and\r\ndisclaimer required by the jzlib source license is referenced in the\r\nrelevant source files of DotNetZip, specifically in the sources for the\r\nZlib module.\r\n\r\nThis library uses a BZip2 implementation that is based on a conversion\r\nof the bzip2 implementation in the Apache Commons compression library.\r\nThe Apache license is referenced in the relevant source files of\r\nDotNetZip, specifically in the sources for the BZip2 module.\r\n\r\n\r\n\r\n\r\nLimitations\r\n---------------------------------\r\n\r\nThere are a few limitations to this library:\r\n\r\n It does not do strong encryption.\r\n\r\n The GUI tool for creating zips is functional but basic. This isn't a limitation\r\n of the library per se.\r\n\r\n ...and, I'm sure, many others\r\n\r\nBut it is a good basic library for reading and writing zipfiles\r\nin .NET applications.\r\n\r\n\r\n\r\n\r\nBuilding the Library\r\n============================================\r\n\r\nThis section is mostly interesting to developers who will work on or\r\nview the source code of DotNetZip, to extend or re-purpose it.  If you\r\nonly plan to use DotNetZip in applications of your own, you probably\r\ndon't need to concern yourself with the information that follows.\r\n\r\n\r\n\r\n\r\n\r\nPre-requisites to build DotNetZip\r\n---------------------------------\r\n\r\n.NET Framework 4.0 SDK or later\r\n  -or-\r\nVisual Studio 2010 or later\r\n\r\n  -and-\r\n\r\nILMerge - a tool from Microsoft that combines\r\nmultiple managed assemblies into a single DLL or image.  It is in\r\nsimilar in some respects to the lib tool in C toolkits.\r\n\r\nYou can get it here:\r\n  http://www.microsoft.com/downloads/details.aspx?familyid=22914587-b4ad-4eae-87cf-b14ae6a939b0\u0026displaylang=en\r\n\r\n\r\n\r\n\r\n\r\nBuilding DotNetZip with the .NET SDK\r\n-------------------------------------\r\n\r\nTo build the library using the .NET Framework SDK v4.0,\r\n\r\n1. extract the contents of the source zip into a new directory.\r\n\r\n2. be sure the .NET 4.0 SDK and runtime directories are on your\r\n   path.\r\n\r\n3. Modify the .csproj files in Zip and ZLIB and BZip2 to eliminate\r\n   mention of the Ionic.pfx and Ionic.snk files.\r\n\r\n   The various DLLs (Zip Partial, ZLIB, etc.) are signed with my private\r\n   key.  You will want to remove the mention of the private key in the\r\n   project files. I cannot distribute my private key, so don't ask me!\r\n   That would be silly.  So you have to modify the project in order to\r\n   build without the key.\r\n\r\n\r\n4. open a CMD prompt and CD to the DotNetZip directory.\r\n\r\n\r\n5. msbuild\r\n\r\n   Be sure you are using the .NET 3.5 version of MSBuild.\r\n   This builds the \"Debug\" version of the library.  To build the\r\n   \"Release\" version, do this:\r\n\r\n   msbuild /t:Release\r\n\r\n\r\n6. to clean and rebuild, do\r\n   msbuild /t:clean\r\n   msbuild\r\n\r\n\r\n7. There are two setup directories, which contain the projects necessary\r\n   to build the MSI file.  Unfortunately msbuild does not include\r\n   support for building setup projects (vdproj).  You need Visual Studio\r\n   to build the setup directories.\r\n\r\n   I am in the process of converting these from .vdproj to .wixproj, so\r\n   they can be built from the command line using msbuild. .\r\n\r\n\r\n\r\n\r\nBuilding DotNetZip with Visual Studio\r\n-------------------------------------\r\n\r\nTo build DotNetZip using Visual Studio 2010,\r\n\r\n1. Open the DotNetZip.sln file in VS2010.\r\n\r\n2. If necessary, Remove the dependencies on Ionic.pfx and Ionic.snk.\r\n\r\n   (References to these will have already been removed from the zipped\r\n   source distributions, but if you get your source from the TFS server,\r\n   then you will have to remove references to the keyfiles manually)\r\n\r\n   The various DLLs (Zip, ZLIB, etc.) are signed with my (Dino\r\n   Chiesa's) private key.  I do not distribute that key for anyone\r\n   else's use.  If you build the DotNetZip library from source, You will\r\n   want to remove the mention of the private key in the project files. I\r\n   will not distribute my private key, that would be silly.  So don't\r\n   ask me!\r\n\r\n3. Press F6 to build everything.\r\n\r\n\r\n\r\n\r\nThe Project Structure and Build approach\r\n----------------------------------------------------\r\n\r\nThe function here is grouped into three basic sets: Zip,\r\nZLIB/Deflate/GZIP, and BZip2.  The Zip group is a superset of the ZLIB\r\nand BZIP2 groups.\r\n\r\nEach group of functionality is packaged into various assemblies, one\r\nassembly per \"platform\".  The platforms supported are: .NET (Desktop).\r\n\r\nThere is also a special \"Zip Reduced\" library, available only on the\r\nDesktop platform; it is a reduced-function version of the regular\r\nDesktop Framework zip library. It provides an option of using a smaller\r\nlibrary for those zip-handling applications that don't produce\r\nSelf-extracting archives.\r\n\r\nIn a previous guise, DotNetZip relied on the ILMerge tool to combine\r\ndistinct DLLs into a single package.  This is no longer the case.\r\n\r\nBecause the ZIP projects include the ZLIB and BZIP2 function, the\r\nappropriate source modules for the ZLIB and Bzip2 are \"linked\" into each\r\nof the ZIP projects (Desktop).\r\n\r\n\r\n\r\n\r\nRegarding the missing Ionic.pfx and Ionic.snk files\r\n-------------------------------------------------------------------------\r\n\r\nThe binary DLLs shipped in the codeplex project are signed by me, Dino\r\nChiesa.  This provides a \"strong name\" for the assembly, which itself\r\nprovides some assurance as to the integrity of the library, and also\r\nallows it to be run within restricted sites, like apps running inside\r\nweb hosters.\r\n\r\nFor more on strong names, see this article:\r\nhttp://msdn.microsoft.com/en-gb/magazine/cc163583.aspx\r\n\r\nSigning is done automatically at build time in the Visual Studio project or in\r\nthe msbuild build.  There\r\nis a .pfx file that holds the crypto stuff for signing the assembly, and\r\nthat pfx file is itself protected by a password. There is also an\r\nIonic.snk file which is referenced by the project, but which I do not\r\ndistribute.\r\n\r\nPeople opening the project ask me: what's the password to this .pfx\r\nfile?  Where's the .snk file?\r\n\r\nHere's the problem; those files contain my private key. if I give\r\neveryone the password to the PFX file or the .snk file, then anyone can\r\ngo and build a modified Ionic.Zip.dll, and sign it with my key, and\r\napply any version number they like.  This means there could be multiple\r\ndistinct assemblies with the same signature.  This is obviously not\r\ngood.\r\n\r\nSince I don't release the ability to sign DLLs with my key, the DLL\r\nsigned with my key is guaranteed to be produced by me only, which is in\r\nfact the exact intent of code signing in .NET.\r\n\r\nIf anyone wants to modify the project and re-compile it, they have a\r\ncouple options:\r\n\r\n  - sign the assembly themselves, using their own key.\r\n  - produce a modified, unsigned assembly\r\n\r\nIn either case it is not the same as the assembly I am shipping,\r\ntherefore it should not be signed with the same key.\r\n\r\nAll clear?\r\n\r\nAs for those options above, here is some more detail:\r\n\r\n  1. If you want a strong-named assembly, then create your own PFX file\r\n     and .snk file and modify the appropriate projects to use those new\r\n     files.\r\n\r\n  2. If you don't need a strong-named assembly, then remove all the\r\n     signing from the various projects.\r\n\r\nIn either case, you will need to modify the \"Zip\", BZip, and the \"Zlib\"\r\nprojects.\r\n\r\n\r\n\r\n\r\nBuilding the Documentation\r\n--------------------------------------------\r\n\r\nThe documentation files are built using the Sandcastle Helpfile Builder\r\ntool, also available on CodePlex at http://www.codeplex.com/SHFB .  It\r\nis built from in-code xml documentation, augmented with some additional\r\nout-of-band html documentation.\r\n\r\nIf you want to build the help files yourself, you will need to have\r\nSandcastle from May 2008 (or later, I guess), and SHFB, from February\r\n2009.  Both are free tools available from http://codeplex.com .  I think\r\nyou can get a package download of both of these by installing v1.9.3.0\r\nof SHFB .\r\n\r\nThe helpfile projects are:\r\n\r\n  HtmlHelp1.shfbproj - to build the .chm file\r\n  MSHelp2.shfbproj - to build the MS Help 2.0 content\r\n  HelpViewer.shfbproj - to build the MS Help Viewer 1.0 content\r\n\r\n  (The MSHelp2 project is broken at the moment.)\r\n\r\nTo build the documentation in any of these formats, first build the \"zip\r\nFull DLL\" project in the source (Ionic.Zip.dll), then run:\r\n\r\n  msbuild   HtmlHelp1.shfbproj\r\n\r\n    -or-\r\n\r\n  msbuild   HelpViewer.shfbproj\r\n\r\n\r\nThe Help Viewer 1.0 content can be viewed in the help viewer that is\r\nintegrated into VS 2010, or in an alternative viewer, such as\r\nH3Viewer.exe.  See http://mshcmigrate.helpmvp.com/viewer .\r\n\r\n\r\n\r\n\r\nExamples\r\n--------------------------------------------\r\n\r\nThe source solution also includes a number of example applications\r\nshowing how to use the DotNetZip library and all its features - creating\r\nZIPs, using Unicode, passwords, comments, streams, and so on.  Most of\r\nthese will be built when you build the solution.  Some of them do not -\r\nyou will need to build them independently.\r\n\r\n\r\n\r\nTests\r\n--------------------------------------------\r\n\r\nThere are two source projects in the VS Solution that contain Unit\r\nTests: one for the zlib library, one for the bzip2 library, and another\r\nfor the Zip library.  If you develop any new tests for DotNetZip, I'd be\r\nglad to look at them.\r\n\r\n\r\n\r\n\r\n\r\n\r\nOrigins\r\n============================================\r\n\r\nThis library is mostly original code.\r\n\r\nThere is a GPL-licensed library called SharpZipLib that writes zip\r\nfiles, it can be found at\r\nhttp://www.sharpdevelop.net/OpenSource/SharpZipLib/Default.aspx\r\n\r\nThis library is not based on SharpZipLib.\r\n\r\nI think there may be a Zip library shipped as part of the Mono\r\nproject.  This library is also not based on that.\r\n\r\nNow that the Java class library is open source, there is at least one\r\nopen-source Java implementation for zip.  This implementation is not\r\nbased on a port of Sun's JDK code.\r\n\r\nThere is a zlib.net project from ComponentAce.com.  This library is not\r\nbased on that code.\r\n\r\nThis library is all new code, written by me, with these exceptions:\r\n\r\n -  the CRC32 class - see above for credit.\r\n -  the zlib library - see above for credit.\r\n -  the bzip2 compressor - see above for credit.\r\n\r\n\r\n","funding_links":[],"categories":["Compression","压缩","C#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaf%2FDotNetZip.Semverd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaf%2FDotNetZip.Semverd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaf%2FDotNetZip.Semverd/lists"}