ZipArchive, 3mf and compression

Stefan

Member
Joined
Jun 1, 2021
Messages
7
Programming Experience
1-3
Hi there,
I have a very weird problem I just can't wrap my head around and not even sure where to ask this.
Basically I'm writing a converter for CAD models to the .3mf file format.
.3mf files are renamed .zip files that have a fixed folder structure and use .xml for their internal data.

I use the official 3mf examples for testing my code and here is the problem:
If I use the windows UI to select the files and rightclick -> 'send to zip archive' everything works correctly.
If I use c# ZipFile or sharpziplib to zip the files - the .3mf throws an error.
If I use tar.exe to zip the files the Windows 3D-viewer throws an error but other CAD programs can open the file.

Hp has a filechecker to look for errors in 3mf files and it throws:
the file is in the archive and is in the right place but for some reason wont be found by the interpreter.

Is there someone that can point me in the right direction?maybe zip files have different was to store path information that is not visible to me as the user?
 

JohnH

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
1,265
Location
Norway
Programming Experience
10+
That Nuget isn't there to support .Net Framework where it's already included (just have to add reference), it's for .Net Core, .Net Standard etc.
 

NoUserHere

Well-known member
Joined
Sep 5, 2018
Messages
2,138
Programming Experience
10+
Ah yea, I just noticed the in-page link I posted is for DNC. When I googled for the introduction of the compression namespace date, it was first one to pop up and I jumped to the dates.

You will need to bare with me, I'm a bit thick today... this hot weather plays havoc with my concentration!!

Which of the uploaded files on p1/#6 are the one created using ZipFile then?

I ask because I can produce zips and decompress them without the need to edit the project config and I can do it using the code I posted regardless which method zipped them up.

I was never able to unzip my older zip files before now. My old zip files were zipped long ago using SharpZipLib. And I can do it without adding this to my project file :
C#:
<runtime>
   <AppContextSwitchOverrides value="Switch.System.IO.Compression.ZipFile.UseBackslash=false" />
</runtime>

Bizarre... whereas @Stefan needs the snipped above.

Atleast the OP got a fix out of the thread and I got back into my old zips again. ;)

Thanks @JohnH.
Signing off for the night. It's been a crazy tiring day here.

Edit : Fixed my grammar for my poor illiteracy.
 
Last edited:
Top Bottom