This is the code i'm using for writing the file for solid archives. it is giving me the error for non solid archives when it reaches the last file. Plus I don't think that it is extracting the files correctly anyway when using a non-solid archive.
I want to do the same thing for non solid archives if possible.
I want to do the same thing for non solid archives if possible.
For Each entry In Archive.Entries
' make sure sample does not appear in the file name
If InStr(entry.FilePath, "sample") = 0 And entry.IsComplete Then
Try
If Not File.Exists(strOutputDir & "\" & entry.FilePath) Then
entry.WriteToDirectory(strOutputDir, SharpCompress.Common.ExtractOptions.None)
WriteToLog("Extracting " & entry.FilePath & " completed.")
Else
WriteToLog(strOutputDir & "\" & entry.FilePath & " already exists - skipping.")
End If
ErrorNumber = ReturnCodes.OK
Catch ex As Exception
WriteToLog("Error extracting files - " & ex.Message)
ErrorNumber = ReturnCodes.ErrorExtractingRar
Exit For
End Try
Else
WriteToLog(ReturnMessages(ReturnCodes.SampleFileSkipped))
End If
Next
all I have at the moment is If Not Archive.IsSolidArchive Then
Dim _stream = File.OpenRead(FileName)
Dim _reader = SharpCompress.Reader.ReaderFactory.Open(_stream)
While _reader.MoveToNextEntry()
If Not _reader.Entry.IsDirectory Then
'write the file
End If
End While
End If