Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active May 16, 2019 11:21
Show Gist options
  • Select an option

  • Save unitycoder/edfc22570e93db61f83d582c98c4dff5 to your computer and use it in GitHub Desktop.

Select an option

Save unitycoder/edfc22570e93db61f83d582c98c4dff5 to your computer and use it in GitHub Desktop.

Revisions

  1. unitycoder revised this gist May 11, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion SharpCompressTest.cs
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    // unity sharpcompress example :
    // unity sharpcompress example : https://unitycoder.com/blog/2019/05/12/using-sharpcompress-in-unity/
    // https://github.com/adamhathcock/sharpcompress

    using SharpCompress.Archives;
  2. unitycoder created this gist May 11, 2019.
    27 changes: 27 additions & 0 deletions SharpCompressTest.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    // unity sharpcompress example :
    // https://github.com/adamhathcock/sharpcompress

    using SharpCompress.Archives;
    using SharpCompress.Archives.Zip;
    using System.IO;
    using UnityEngine;

    public class SharpCompressTest : MonoBehaviour
    {
    void Start()
    {
    // ZipArchive with Writing API Example: (creates zip file from source folder files)
    using (var archive = ZipArchive.Create())
    {
    string sourceFolder = "d:/data/testzip";
    archive.AddAllFromDirectory(sourceFolder);

    string outputPath = "d:/data/test.zip";
    using (FileStream fs = File.Create(outputPath))
    {
    archive.SaveTo(fs);
    }
    }

    }
    }