mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-10-06 05:38:53 +00:00
Some RARs with recovery records contain Protect Headers, I've added support for parsing them so that RARs containing them can be read, instead of an invalid-header exception being thrown. Parsing logic taken from unrar reference source.
23 lines
744 B
C#
23 lines
744 B
C#
using SharpCompress.IO;
|
|
|
|
namespace SharpCompress.Common.Rar.Headers
|
|
{
|
|
// ProtectHeader is part of the Recovery Record feature
|
|
internal class ProtectHeader : RarHeader
|
|
{
|
|
protected override void ReadFromReader(MarkingBinaryReader reader)
|
|
{
|
|
Version = reader.ReadByte();
|
|
RecSectors = reader.ReadUInt16();
|
|
TotalBlocks = reader.ReadUInt32();
|
|
Mark = reader.ReadBytes(8);
|
|
}
|
|
|
|
internal uint DataSize { get { return AdditionalSize; } }
|
|
internal byte Version { get; private set; }
|
|
internal ushort RecSectors { get; private set; }
|
|
internal uint TotalBlocks { get; private set; }
|
|
internal byte[] Mark { get; private set; }
|
|
}
|
|
}
|