0

I'm doing a project related to stenography. I need to hide multiple files inside a single image. I managed to bring all the files required to hide into a single folder. Now I need to zip this file and convert it to byte array so that I can pick bit by bit and hide it in LSB bit of an image.

How can I zip a folder in vb and convert it to byte array. Also which compression mode should I use? Time is not a big factor for me, but I need the data exactly as before it was zipped. I must not loose a single bit.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
  • https://msdn.microsoft.com/en-us/library/system.io.compression.zipfile(v=vs.110).aspx – Trevor_G Feb 25 '17 at 13:34
  • I tried ZipFile CreateFromDirectory, but it says ZipFile not declared. –  Feb 25 '17 at 16:00
  • YOu need to reference and import System.IO.Compression – Trevor_G Feb 25 '17 at 17:09
  • I can't find System.IO.Compression in reference tab. I'm using vb 2010, Is it available in 2010 –  Feb 25 '17 at 17:30
  • Select dot net framework 4.5 – Trevor_G Feb 25 '17 at 17:32
  • @Trevor : You can only use .NET 4.0 in VS2010. – Visual Vincent Feb 26 '17 at 00:43
  • @E.J : To use the `ZipFile` class in VS2010 you need to add a reference to the `System.IO.Compression.FileSystem.dll` file, which is located in some sub-folder of: `%SystemRoot%\Microsoft.NET\assembly\GAC_MSIL` - search for it there using Windows's search function and you should be able to find it. – Visual Vincent Feb 26 '17 at 00:50
  • [**In my case**](http://stackoverflow.com/questions/37058709/how-to-create-self-extracted-exe-c-sharp-net-4-0#comment61772833_37058709) the file can be found in `%SystemRoot%\Microsoft.NET\assembly\GAC_MSIL\System.IO.Compr‌​ession.FileSystem\v4‌​.0_4.0.0.0__b77a5c56‌​1934e089\System.IO.C‌​ompression.FileSyste‌​m.dll` – Visual Vincent Feb 26 '17 at 00:52
  • Reference was sucessfully added. When I tried to execute ZipFile.CreateFromDirectory(startPath, zipPath) Dim startPath As String = "C:\Users\Eldhose\Desktop\STEG\Source" Dim zipPath As String = "C:\Users\Eldhose\Desktop\STEG\Dest\result.zip" It says "Could not find a part of the path 'C:\Users\Eldhose\Desktop\STEG\Dest\result.zip'.", How to automatically create it –  Feb 27 '17 at 15:17
  • `If Directory.Exists(Path.GetDirectoryName(zipPath)) = False Then Directory.CreateDirectory(Path.GetDirectoryName(zipPath))` – Visual Vincent Feb 27 '17 at 21:29
  • @visual Vincent Thanks –  Feb 28 '17 at 18:46

0 Answers0