diff --git a/src/SharpCompress/Common/SevenZip/ArchiveReader.cs b/src/SharpCompress/Common/SevenZip/ArchiveReader.cs index 83eae537..d2d05b54 100644 --- a/src/SharpCompress/Common/SevenZip/ArchiveReader.cs +++ b/src/SharpCompress/Common/SevenZip/ArchiveReader.cs @@ -996,6 +996,11 @@ internal class ArchiveReader numFiles, delegate(int i, uint? attr) { + // Keep the original attribute value because it could potentially get + // modified in the logic that follows. Some callers of the library may + // find the original value useful. + db._files[i].ExtendedAttrib = attr; + // Some third party implementations established an unofficial extension // of the 7z archive format by placing posix file attributes in the high // bits of the windows file attributes. This makes use of the fact that @@ -1458,7 +1463,7 @@ internal class ArchiveReader #if DEBUG Log.WriteLine(_db._files[index].Name); #endif - if (_db._files[index].CrcDefined) + if (_db._files[index].Crc.HasValue) { _stream = new CrcCheckStream(_db._files[index].Crc.Value); } diff --git a/src/SharpCompress/Common/SevenZip/CFileItem.cs b/src/SharpCompress/Common/SevenZip/CFileItem.cs index c6509ee0..254a444f 100644 --- a/src/SharpCompress/Common/SevenZip/CFileItem.cs +++ b/src/SharpCompress/Common/SevenZip/CFileItem.cs @@ -8,18 +8,13 @@ internal class CFileItem { public long Size { get; internal set; } public uint? Attrib { get; internal set; } + public uint? ExtendedAttrib { get; internal set; } public uint? Crc { get; internal set; } public string Name { get; internal set; } public bool HasStream { get; internal set; } public bool IsDir { get; internal set; } - public bool CrcDefined => Crc != null; - - public bool AttribDefined => Attrib != null; - - public void SetAttrib(uint attrib) => Attrib = attrib; - public DateTime? CTime { get; internal set; } public DateTime? ATime { get; internal set; } public DateTime? MTime { get; internal set; } diff --git a/src/SharpCompress/Common/SevenZip/SevenZipEntry.cs b/src/SharpCompress/Common/SevenZip/SevenZipEntry.cs index fbcb3d00..79df43a0 100644 --- a/src/SharpCompress/Common/SevenZip/SevenZipEntry.cs +++ b/src/SharpCompress/Common/SevenZip/SevenZipEntry.cs @@ -38,5 +38,8 @@ public class SevenZipEntry : Entry public override int? Attrib => FilePart.Header.Attrib.HasValue ? (int?)FilePart.Header.Attrib.Value : null; + public int? ExtendedAttrib => + FilePart.Header.ExtendedAttrib.HasValue ? (int?)FilePart.Header.ExtendedAttrib.Value : null; + internal override IEnumerable Parts => FilePart.AsEnumerable(); }