dotnet / android-libzipsharp

A managed wrapper (and then some) around libzip (https://libzip.org/)
MIT License
30 stars 10 forks source link

Add support for libzip encryption functions #43

Open grendello opened 4 years ago

grendello commented 4 years ago

Originally libZipSharp had no use for libzip's encryption functions as Xamarin.Android doesn't use them, but now that the library is shipped in a nuget those functions may come useful. Implement the following:

Relevant upstream APIs:

Fniz commented 3 years ago

Hi, I want to propose an implementation if it's still relevant. But my Unit tests basically don't pass because it does not find the libzip.dll (System.DllNotFoundException: 'Unable to load DLL 'libzip': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'

How do you run UnitTests ? (On Windows)

image

grendello commented 3 years ago

@Fniz yes, it's still definitely relevant! We don't use it in Xamarin.Android, but if you need it and can provide an implementation we will happily accept a PR :)

Regarding running tests, I'll let @dellis1972 answer it since I don't use Windows and I don't know the answer

Thanks!

dellis1972 commented 3 years ago

@Fniz the unit tests should work on windows. This line https://github.com/xamarin/LibZipSharp/blob/master/LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj#L27 in the csproj should copy the libzip.dll from the Window build directory over to the unit test output directory.

On my Mac machine LibZipSharp.UnitTest/bin/Debug/net471 contains the libzip.dll. That should be the same on windows. My guess is build\Windows\64\lib\libzip.dll does not exist so it is not being copied. Have you built the libzip.dll ? It does need to be done as a separate step.

Our current build system uses the following commands https://github.com/xamarin/LibZipSharp/blob/master/azure-pipelines.yml#L30 to build the dll. It makes use of the vcpkg project to handle dependencies and uses cmake to handle the build process. So I suspect you will either need to run all those commands to build the dll yourself, or the easier way just grab the native dll from the latest nuget package and place it in the correct location build\Windows\64\lib\libzip.dll. You can probably find the dll in your nuget package cache which is normally in a .nuget directory in you User AppData folder.

I should probably write a helper batch file which will do all those commands like we have to unix based systems to make this easier for contributors. Both @grendello and I work on unix based systems most of the time these days.

dellis1972 commented 3 years ago

@Fniz we merged that PR, hopefully you can build the native dll's on windows now.