sharpcompress
sharpcompress copied to clipboard
Unable to unRAR version 5.5 file
Going to need more detail.
Don’t believe they’ve changed the format again but I could be wrong.
The following code is used to decompress the compressed file of RAR 5.5, and an exception "file crc mismatch" is thrown
string path = @"C:\Users\Administrator\Desktop\1\1\2222.rar"; string fpath = @"C:\Users\Administrator\Desktop\1\1\2222"; using (Stream stream = File.OpenRead(path)) { var reader = ReaderFactory.Open(stream, new ReaderOptions() { Password = "cxmt1508" }); while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) { Console.WriteLine(reader.Entry.Key); reader.WriteEntryToDirectory(fpath, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } }
RAR5 decryption isn't currently implemented
okay, thank you
SharpCompress Version="0.32.2"
Likewise, getting error on unrar / decryption,
Unhandled exception. System.InvalidOperationException: TODO rar5
at SharpCompress.Common.Rar.Headers.FileHeader.get_FileCrc()
at SharpCompress.Compressors.Rar.MultiVolumeReadOnlyStream.InitializeNextFilePart()
at SharpCompress.Compressors.Rar.MultiVolumeReadOnlyStream..ctor(IEnumerable`1 parts, IExtractionListener streamListener)
at SharpCompress.Archives.Rar.RarArchiveEntry.OpenEntryStream()
at SharpCompress.Archives.IArchiveEntryExtensions.WriteTo(IArchiveEntry archiveEntry, Stream streamToWriteTo)
at SharpCompress.Archives.IArchiveEntryExtensions.<>c__DisplayClass2_0.<WriteToFile>b__0(String x, FileMode fm)
at SharpCompress.Common.ExtractionMethods.WriteEntryToFile(IEntry entry, String destinationFileName, ExtractionOptions options, Action`2 openAndWrite)
at SharpCompress.Archives.IArchiveEntryExtensions.WriteToFile(IArchiveEntry entry, String destinationFileName, ExtractionOptions options)
at SharpCompress.Common.ExtractionMethods.WriteEntryToDirectory(IEntry entry, String destinationDirectory, ExtractionOptions options, Action`2 write)
at SharpCompress.Archives.IArchiveEntryExtensions.WriteToDirectory(IArchiveEntry entry, String destinationDirectory, ExtractionOptions options)
at ConsoleApp.MediaTool.ExtractRar(String filePath) in D:\Code\CS\MediaTool\ConsoleApp\MediaTool.cs:line 104
So we think there's a 5.5 specification change?
That exception is because the RAR 5 CRC isn't implemented properly.