- Home /
The question is answered, right answer was accepted
Manage zip with unity
Hello, I'm trying to get a zip to save and read. I need to protect this zip with some password. I found DotNetZip, I made some test console app it works like I want. Then I tried to transfer that code to Unity. I get correct import, scripts can get content of the dll. But i get this error:
 NullReferenceException: Object reference not set to an instance of an object
 Ionic.Zip.ZipEntry.GetEncodedFileNameBytes () (at <92c46b229f654faaafd572a1bd450a33>:0)
 Ionic.Zip.ZipEntry.WriteHeader (System.IO.Stream s, System.Int32 cycle) (at <92c46b229f654faaafd572a1bd450a33>:0)
 Ionic.Zip.ZipEntry.Write (System.IO.Stream s) (at <92c46b229f654faaafd572a1bd450a33>:0)
 Ionic.Zip.ZipFile.Save () (at <92c46b229f654faaafd572a1bd450a33>:0)
 Ionic.Zip.ZipFile.Save (System.String fileName) (at <92c46b229f654faaafd572a1bd450a33>:0)
I tried to add some dependency from DotNetZip but it doesn't work. Can someone help me ?
Any other methods will be appreciated. Thanks in advance.
My test code:
     public static void MakeZip(string sourceDirectoryPath, string password, string destinyPath, string fileName = "package")
     {
         string extension = ".ext";
         using (ZipFile zip = new ZipFile())
         {
             zip.Password = password;
             zip.AddDirectory(sourceDirectoryPath);
             zip.Save(destinyPath + fileName + extension);
         }
     }
 
     public static void GetDataFromZip(string sourcePackagePath, string password, string destinyPath)
     {
         using (ZipFile zip = ZipFile.Read(sourcePackagePath))
         {
             zip.Password = password;
             zip.ExtractAll(destinyPath, ExtractExistingFileAction.DoNotOverwrite);
         }
     }
[INFO] Unity 2019.4.8f1
Have you tried different assemblies and plugins folder?
Answer by tomaszekszym · Sep 04, 2020 at 12:45 PM
I get DotNetZip.dll, i should get Ionic.Zip.dll and thats the answer
Follow this Question
Related Questions
Script to Zip files on Build? 0 Answers
DotNetZip in Webplayer 2 Answers
Vertex compression - position snaps vertices 0 Answers
What's the best way to implement file compression? 9 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                