adoconnection / SevenZipExtractor

C# wrapper for 7z.dll
MIT License
306 stars 83 forks source link

Added support for MsLz, added tests for cab, updated net version to 6… #64

Open kammerjaeger opened 1 year ago

kammerjaeger commented 1 year ago

…, added nullable types

Changes in this PR:

I have a working linux version, these are the changes that make sense without the complete rework that is needed for linux. Please let me know what you think.

adoconnection commented 1 year ago

epic! do you think we should change target to net6? this will break compatibility with existing projects net3 and net5

kammerjaeger commented 1 year ago

I asked myself that too. For my projects it is pretty important to make sure that null checks are done properly but I'm also the person who can decided what framework we are using :-) I don't know what the user-base here is thinking. So you have to let me know if it is okay to switch to a newer net version. Net 6 was the first that supported nullable templates.

Some examples where nullable helps to stop bugs (non obvious nullable results)

Please let me know what you think. I can have a look at something like https://www.meziantou.net/how-to-use-nullable-reference-types-in-dotnet-standard-2-0-and-dotnet-.htm or https://medium.com/codex/dot-net-library-compatibility-with-core-and-framework-6c8e29cc80e0 but I'm not sure this will work. The Linux version is even more complicated if you are even interested to integrate that in the official version. I will provide the linux version as soon as I have it cleaned up a bit more.

adoconnection commented 1 year ago

well, we can put some #ifdefs for net6+ with nullables. but the code will be messy I think. What exact benefit you get out of nullables here in this lib?

kammerjaeger commented 1 year ago

For me it is:

I agree with the #ifdefs making the code messy. If you are interested in the linux adaption (hopefully it is soon finished) net core 3 will be the minimum as far as I can see. Lib loading was implemented there https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.nativelibrary?view=netcore-3.0. Not sure if other things will break. We could again add a lot of ifdefs around lib loading but that code is already not the easiest to understand. Anyways, as soon as I have the sub lib loading fixed I will provide a link to a branch.

kammerjaeger commented 1 year ago

Here is the first version of the linux port: https://github.com/kammerjaeger/SevenZipExtractor/tree/LinuxPort It also adds:

I'm not sure this is bug free yet, did not do any mayor testing outside from the test cases, yet. Also it is net 6. If find any time I may look into if it is possible to use earlier versions.

Please let me know if you are even interested in integrating this.

adoconnection commented 1 year ago

linux support is a huge step forward! Will give it a try asap! 🚀🚀🚀🎉

kammerjaeger commented 1 year ago

Some information for linux: I ran the test under WSL2 Ubuntu, proper linux tests will follow in the next week. I only tested x64, there is no x32 net runtime as far as I can see. I'm not sure if arm would work, there is an arm build of p7zip so it could work if the calling conventions are not different between the platforms.

kammerjaeger commented 5 months ago

Did you have time looking at it? I added some improvements and bugfixes to the linux port. I am thinking of adding a function to create new archives and I think it would be better to finish this first.