SevenZipSharp
SevenZipSharp copied to clipboard
Uzipping 7z files from resources
I am trying to store the 7z.dll(s) in my resources. I used to use the ionic.dll library and was able to unzip files from resources in memory, but I am having a hard time figuring out how to do the same with a 7z files. I tried
Dim currentAssembly = Reflection.Assembly.GetEntryAssembly()
Dim currentDirectory = New FileInfo(currentAssembly.Location).DirectoryName.ToString
Dim path As String = currentDirectory + "My.Resources\" And If(IntPtr.Size = 4, "7z86.dll", "7z64.dll")
Using extractor = New SevenZipExtractor("My.Resources.Source.7z", "Pass1")
For i = 0 To extractor.ArchiveFileData.Count - 1
If extractor.ArchiveFileData(i).tostring.contains(Desired_File_Name) then
extractor.ExtractFiles(OutputDirectory, extractor.ArchiveFileData(i).Index)
'unzip file in memory and load to richtextbox
'Richtext1.LoadFile(msss, RichTextBoxStreamType.RichText)
Exit For
End If
Next
End Using
I know the code above doesn't work, I have been trying to go through the tests to make work with no success. I am trying to access the encrypted file, locate the file based on its name, unzip the file in memory and load it to a richtextbox. Do you think that is possible with this library?
Thanks in advance, Beho