Hey,
I've been trying and looking for a while now but I can't seem to find a way to zip or compress a whole directory or folder with C# in .net framework 2.0, Without using any external DLL's or COM references.
I'm not asking to be spoonfed, Just a point in the right direction or what I could take a look at would be greatly appreciated 🤝
I've already tried:
- Shell32 (creates & requires external dll Interop.Shell32.dll)
- GZipStream
- System.IO.Compression (.net 4.5)
Mar 17, 2017 08:52 AM
(This post was last modified: Mar 17, 2017 08:55 AM by eithan1231.)
Make your own ZIP lib.
things you'll need:
1) A 'class' to parse the Headers. This will be a cunt to do, As you'll need to do it with .ZIP, .RAR, .7z, etc.. Here's a sample of what parsing the PE headers looks like. Click Me(I bodged this together, Rushed it C:)
2) different encryption/compression/other methods. (Just port them from someones C++ programs, Will without a doubt take a lot of work)
3) Then add them together in to a class, Walah.
p.s. I over simplified this, Would take a lot of work to do.
Mar 17, 2017 10:18 AM
(This post was last modified: Mar 17, 2017 10:41 AM by Pim Fortuyn.)
(Mar 17, 2017 08:57 AM)Secret Agent Wrote: Check out http://github.com/jaime-olivares/zipstorer
Damn not sure how I didn't find that. I was searching on google a lot.
Thanks for providing the link, I'll check it out 🤝
Edit:
Doesn't seem to be working to zip a folder/directory (with sub directories) unfortunately. still looking for alternatives.
(Mar 17, 2017 08:52 AM)eithan1231 Wrote: Make your own ZIP lib.
things you'll need:
1) A 'class' to parse the Headers. This will be a cunt to do, As you'll need to do it with .ZIP, .RAR, .7z, etc.. Here's a sample of what parsing the PE headers looks like. Click Me(I bodged this together, Rushed it C:)
2) different encryption/compression/other methods. (Just port them from someones C++ programs, Will without a doubt take a lot of work)
3) Then add them together in to a class, Walah.
p.s. I over simplified this, Would take a lot of work to do.
Seems to be way too much work just to zip a folder that has subdirectories.
But adding it as a class.cs might work just fine actually. If theres an opensource Zip DLL, Just instead of adding the .DLL add the class directly, Haven't found any yet though.
Have you tried this?:
https://hackforums.net/showthread.php?tid=5490927
Lol, just noticed is your own post 🤣
(Mar 17, 2017 12:11 PM)Zilog80 Wrote: Have you tried this?:
https://hackforums.net/showthread.php?tid=5490927
Lol, just noticed is your own post 🤣
Yeah. That works in .net framework 4.0, I need something for .net 2.0 😝
DO NOT DEAL WITH THIS MEMBER
What I would actually do in your case, is to actually develop my own compression algorithm.
I recommend trying stackoverflow, they have great tutorials and you can also ask them since 99% of them are professional c# programmers.
DO NOT DEAL WITH THIS MEMBER
(Mar 17, 2017 02:47 PM)i6FsHaN Wrote: I recommend trying stackoverflow, they have great tutorials and you can also ask them since 99% of them are professional c# programmers.
lol don't know about that
SharpZipLib is out there and they seem to have a version that even runs on .NET 1.1. It's MIT licensed, so that means you can basically do whatever you want with it as long as you include the copyright and license file upon deployment of your application. This also includes using the source code directly and put it into your own project. The only thing is that it's not just one file though. It's an entire library, as per with pretty much any zip file reader. Have to ask though, what is the problem with having one dll file?
Given the odd requirements, I have a feeling you need this for malicious software development. If so, please don't use SharpZipLib. If not, my mistake and consider this remark as not present at all.
Looks like there's a new coming features on your logger ha.
My tips is: Use those external library, bind it to your stub.
Profit.
Developing a Compression Algorithm is an Interesting Problem that requires deep knowledge of Computer Science to be solved.
Is it worth it to invest your Time in it, just to avoid an external library?
Maybe :)
But why reinvent the wheel? DotNetZip sounds interesting and has 2.0 support.
.NET 2.0 is Old, unless you want to target Windows XP.
I Personally would target 3.0-4.0 because most people have it installed.
Mar 18, 2017 10:49 AM
(This post was last modified: Mar 18, 2017 10:52 AM by Pim Fortuyn.)
(Mar 18, 2017 08:06 AM)Rhez Wrote: Looks like there's a new coming features on your logger ha.
My tips is: Use those external library, bind it to your stub.
Profit.
Nah, not really a new feature. More like a downgrade down to .net 2.0 😝
Would like to avoid any external libraries.
(Mar 18, 2017 08:27 AM)iNCEPTiON_V Wrote: Developing a Compression Algorithm is an Interesting Problem that requires deep knowledge of Computer Science to be solved.
Is it worth it to invest your Time in it, just to avoid an external library?
Maybe :)
But why reinvent the wheel? DotNetZip sounds interesting and has 2.0 support.
.NET 2.0 is Old, unless you want to target Windows XP.
I Personally would target 3.0-4.0 because most people have it installed.
Yeah I'm not looking forward to make my own compression algorithm. I would like to use .zip hehe.
.net framework is backwards compatible. So if you have like 4.0, an application with framework 2.0 will work fine aswell.
I will develop a custom .zip function and then just bind it as .dll
Thanks for the suggestions though 🤝
|