diff --git a/CHANGELOG.md b/CHANGELOG.md index 30ad9e9..8ce2f2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.3.5-preview] - 2024-01-09 + +### Added +* doc: add "How to Use" section +* doc: add Installation page + ## [1.3.4-preview] - 2023-04-07 ### Added diff --git a/Documentation~/Installation.md b/Documentation~/Installation.md new file mode 100644 index 0000000..c921c12 --- /dev/null +++ b/Documentation~/Installation.md @@ -0,0 +1,14 @@ +# Installation + +Follow the following steps to install `com.unity.sharp-zip-lib` package: + +1. Make sure git is installed in the system. +1. Open [Package Manager](https://docs.unity3d.com/Manual/upm-ui.html) +1. Click the **+** button, and choose **Add package from git URL** + ![](images/PackageManager.png) +1. Type in `com.unity.sharp-zip-lib` and click **Add**. + We can also specify a particular version by appending `@`, for example: `com.unity.sharp-zip-lib@1.3.5-preview` + + + + diff --git a/Documentation~/TableOfContents.md b/Documentation~/TableOfContents.md new file mode 100644 index 0000000..ebc342b --- /dev/null +++ b/Documentation~/TableOfContents.md @@ -0,0 +1,2 @@ +* [SharpZipLib](index.md) +* [Installation](Installation.md) diff --git a/Documentation~/images/PackageManager.png b/Documentation~/images/PackageManager.png new file mode 100644 index 0000000..85420c5 Binary files /dev/null and b/Documentation~/images/PackageManager.png differ diff --git a/Documentation~/index.md b/Documentation~/index.md index 578b99a..3b3c092 100644 --- a/Documentation~/index.md +++ b/Documentation~/index.md @@ -1,12 +1,58 @@ # com.unity.sharp-zip-lib `com.unity.sharp-zip-lib` is a package that wraps [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) to be used inside Unity, -and provides various compression/extraction utility functions. +and provides various compression/uncompression utility functions. -Currently, this packages uses [SharpZipLib v1.3.1](https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.3.1). +Currently, this package uses [SharpZipLib v1.3.1](https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.3.1). +Please refer to the [installation](Installation.md) page to install this package. > The version numbering of this package itself and the version of SharpZipLib used in the package may look similar, but they are not related. +## How to Use +* All [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) APIs are available under `Unity.SharpZipLib` namespace. For example: + ```csharp + using System.IO; + using Unity.SharpZipLib.GZip; + + ... + + public void Foo() { + MemoryStream ms = new MemoryStream(); + GZipOutputStream outStream = new GZipOutputStream(ms); + ... + } + + ``` + + Please refer to the API documentation of the [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) version used + in this package for more details. + +* In addition, `com.unity.sharp-zip-lib` also provides additional utility APIs: + * `ZipUtility.CompressFolderToZip()`: Compresses the files in the nominated folder, and creates a zip file on disk. + * `ZipUtility.UncompressFromZip()`: Uncompress the contents of a zip file into the specified folder. + + As an example: + ```csharp + + [Test] + public void Foo() { + //Compress + string tempZipPath = FileUtil.GetUniqueTempPathInProject(); + string folderToCompress ="Bar"; + ZipUtility.CompressFolderToZip(tempZipPath,null, folderToCompress); + + //Uncompress + string tempExtractPath = FileUtil.GetUniqueTempPathInProject(); + Directory.CreateDirectory(tempExtractPath); + ZipUtility.UncompressFromZip(tempZipPath, null, tempExtractPath); + + } + ``` + + +## Supported Unity Versions + +* Unity `2018.4.36` or higher. diff --git a/README.md b/README.md index c1fdfc0..ea2a33c 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,61 @@ # com.unity.sharp-zip-lib `com.unity.sharp-zip-lib` is a package that wraps [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) to be used inside Unity, -and provides various compression/extraction utility functions. +and provides various compression/uncompression utility functions. -Currently, this packages uses [SharpZipLib v1.3.1](https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.3.1). +Currently, this package uses [SharpZipLib v1.3.1](https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.3.1). +Please refer to the [installation](Documentation~/Installation.md) page to install this package. > The version numbering of this package itself and the version of SharpZipLib used in the package may look similar, but they are not related. -EOF + + +## How to Use + +* All [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) APIs are available under `Unity.SharpZipLib` namespace. For example: + ```csharp + using System.IO; + using Unity.SharpZipLib.GZip; + + ... + + public void Foo() { + MemoryStream ms = new MemoryStream(); + GZipOutputStream outStream = new GZipOutputStream(ms); + ... + } + + ``` + + Please refer to the API documentation of the [SharpZipLib](https://github.com/icsharpcode/SharpZipLib) version used + in this package for more details. + +* In addition, `com.unity.sharp-zip-lib` also provides additional utility APIs: + * `ZipUtility.CompressFolderToZip()`: Compresses the files in the nominated folder, and creates a zip file on disk. + * `ZipUtility.UncompressFromZip()`: Uncompress the contents of a zip file into the specified folder. + + As an example: + ```csharp + + [Test] + public void Foo() { + //Compress + string tempZipPath = FileUtil.GetUniqueTempPathInProject(); + string folderToCompress ="Bar"; + ZipUtility.CompressFolderToZip(tempZipPath,null, folderToCompress); + + //Uncompress + string tempExtractPath = FileUtil.GetUniqueTempPathInProject(); + Directory.CreateDirectory(tempExtractPath); + ZipUtility.UncompressFromZip(tempZipPath, null, tempExtractPath); + + } + ``` + + +## Supported Unity Versions + +* Unity `2018.4.36` or higher. ## Steps to update SharpZipLib ### Windows @@ -37,4 +85,4 @@ EOF -*Auto-generated on Wed Jul 6 14:13:09 UTC 2022* +*Auto-generated on Tue Jan 9 09:37:14 UTC 2024* diff --git a/package.json b/package.json index 9b98873..352be15 100644 --- a/package.json +++ b/package.json @@ -2,22 +2,22 @@ "displayName": "SharpZipLib", "name": "com.unity.sharp-zip-lib", "unity": "2018.4", - "version": "1.3.4-preview", + "version": "1.3.5-preview", "dependencies": {}, "description": "A package that wraps SharpZipLib (https://github.com/icsharpcode/SharpZipLib) to be used inside Unity", "contributors": [ "Sindharta Tanuwijaya (https://github.com/sindharta)" ], "_upm": { - "changelog": "### Added\n* internal: analytics" + "changelog": "### Added\n* doc: add \"How to Use\" section\n* doc: add Installation page" }, "upmCi": { - "footprint": "e465b74e38c1e8ee006b84c4e09831805e4443c9" + "footprint": "df804c9234c1ba5e98093a0b6292417aafb38b90" }, "documentationUrl": "https://docs.unity3d.com/Packages/com.unity.sharp-zip-lib@1.3/manual/index.html", "repository": { "url": "https://github.com/Unity-Technologies/SharpZipLib.git", "type": "git", - "revision": "2365f2b7a8ab263a891a9932f7d53d465133b59d" + "revision": "9fc656c1c2a19eed9b5f26574dbb06023f47773b" } }