mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Add isEncryptionMethod property to 7zCoder and use it in 7zFolder
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user