Files
SWCompression/Sources/7-Zip/CompressionMethod+7z.swift
2026-02-18 12:21:57 +08:00

25 lines
650 B
Swift

// Copyright (c) 2026 Timofey Solomko
// Licensed under MIT License
//
// See LICENSE for license information
extension CompressionMethod {
init(_ coderID: [UInt8]) {
if coderID == [0x00] || coderID == [0x04, 0x01, 0x00] {
self = .copy
} else if coderID == [0x04, 0x01, 0x08] {
self = .deflate
} else if coderID == [0x04, 0x01, 0x0C] || coderID == [0x04, 0x02, 0x02] {
self = .bzip2
} else if coderID == [0x21] {
self = .lzma2
} else if coderID == [0x03, 0x01, 0x01] {
self = .lzma
} else {
self = .other
}
}
}