Add isEncryptionMethod property to 7zCoder and use it in 7zFolder

This commit is contained in:
Timofey Solomko
2017-11-09 19:39:34 +03:00
parent 8f8aeadb9c
commit dd7f4b2fc8
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -13,6 +13,7 @@ class SevenZipCoder {
let id: [UInt8]
let compressionMethod: CompressionMethod
let isEncryptionMethod: Bool
let numInStreams: Int
let numOutStreams: Int
@@ -31,6 +32,7 @@ class SevenZipCoder {
let id = bitReader.bytes(count: idSize)
self.id = id
compressionMethod = CompressionMethod(id)
isEncryptionMethod = id[0] == 0x06
numInStreams = isComplex ? bitReader.szMbd() : 1
numOutStreams = isComplex ? bitReader.szMbd() : 1
+1 -1
View File
@@ -190,7 +190,7 @@ class SevenZipFolder {
try decoder.decode()
decodedData = Data(bytes: decoder.out)
default:
if coder.id[0] == 0x06 {
if coder.isEncryptionMethod {
throw SevenZipError.encryptionNotSupported
} else {
throw SevenZipError.compressionNotSupported