У меня есть .zip-папка в ресурсах .exe, и мне нужно ее переместить, а затем извлечь в папку. В настоящее время я перемещаю .zip в System.IO.File.WriteAllByte и разархивирую его. Есть ли вообще, чтобы распаковать прямо из ресурсов в папку?Извлечение из ваших ресурсов VB.net
Me.Cursor = Cursors.WaitCursor
'Makes the program look like it's loading.
Dim FileName As FileInfo
Dim Dir_ExtractPath As String = Me.tb_Location.Text
'This is where the FTB folders are located on the drive.
If Not System.IO.Directory.Exists("C:\Temp") Then
System.IO.Directory.CreateDirectory("C:\Temp")
End If
'Make sure there is a temp folder.
Dim Dir_Temp As String = "C:\Temp\Unleashed.zip"
'This is where the .zip file is moved to.
Dim Dir_FTBTemp As String = Dir_ExtractPath & "\updatetemp"
'This is where the .zip is extracted to.
System.IO.File.WriteAllBytes(Dir_Temp, My.Resources.Unleashed)
'This moves the .zip file from the resorces to the Temp file.
Dim UnleashedZip As ZipEntry
Using Zip As ZipFile = ZipFile.Read(Dir_Temp)
For Each UnleashedZip In Zip
UnleashedZip.Extract(Dir_FTBTemp, ExtractExistingFileAction.DoNotOverwrite)
Next
End Using
'Extracts the .zip to the temp folder.
вы можете посмотреть [Assembly.GetManifestResourceStream ] (http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getmanifestresourcestream.aspx), чтобы загрузить ресурс непосредственно в поток, а затем использовать библиотеку распаковки, которая поддерживает распаковку из потока. –