SevenZipSharpライブラリを使用してマルチ ボリューム7zファイルを生成しました。
私が抱えている問題は、ファイルを抽出しようとすると、無効なキャストに関する例外が発生することです。
オブジェクトをキャストできません
タイプ「SevenZip.InMultiStreamWrapper」の「SevenZip.InStreamWrapper」タイプ。
例外をスローするメソッドはSevenZipExtractor.Check()
.
これは、抽出の問題を再現するために Vb.Net で記述されたサンプル コードですが、C# ソリューションも受け入れることができます。
Public Overridable Function Extract(ByVal sourceFilePath As String,
ByVal outputDirectorypath As String,
ByVal password As String) As String
If String.IsNullOrEmpty(password) Then
Me.extractor = New SevenZipExtractor(sourceFilePath)
Else
Me.extractor = New SevenZipExtractor(sourceFilePath, password)
End If
' Check for password matches doing an integrity check.
If Me.extractor.Check() Then
' Start the extraction.
Me.extractor.ExtractArchive(outputDirectorypath)
Else
Throw New Exception(
"Failed to extract, maybe the provided password does not match?.")
End If
Return outputDirectorypath
End Function
パスワードが設定されたマルチボリュームファイルで整合性チェックを無視すると、別の例外が発生するため、抽出できません...
おそらくソースコードのバグですが、ライブラリがマルチボリュームファイルの抽出をサポートしていないのは非常に奇妙であるため、確認してください...