mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-13 19:19:10 +00:00
Not support deb with LZMA algorithm
This commit is contained in:
@@ -19,9 +19,8 @@ using PureSharpCompress.Archives;
|
||||
using PureSharpCompress.Compressors;
|
||||
using PureSharpCompress.Compressors.BZip2;
|
||||
using PureSharpCompress.Compressors.Deflate;
|
||||
using PureSharpCompress.Compressors.Deflate64;
|
||||
using PureSharpCompress.Compressors.LZMA;
|
||||
using PureSharpCompress.Compressors.Xz;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -107,16 +106,13 @@ public class DebReader
|
||||
private static ZipCompressionMethod GetCompressionMethodFromFileName(string fileName)
|
||||
{
|
||||
fileName = fileName.ToLowerInvariant();
|
||||
if (fileName.EndsWith(".tar.gz") || fileName.EndsWith(".tgz"))
|
||||
return ZipCompressionMethod.Deflate;
|
||||
else if (fileName.EndsWith(".tar.xz"))
|
||||
return ZipCompressionMethod.Xz;
|
||||
else if (fileName.EndsWith(".tar.bz2"))
|
||||
return ZipCompressionMethod.BZip2;
|
||||
else if (fileName.EndsWith(".tar.lzma"))
|
||||
return ZipCompressionMethod.LZMA;
|
||||
else if (fileName.EndsWith(".tar.zst"))
|
||||
return ZipCompressionMethod.ZStd;
|
||||
|
||||
// Check the format from ".tar.*"
|
||||
if (fileName.EndsWith(".tar.gz")) return ZipCompressionMethod.Deflate;
|
||||
else if (fileName.EndsWith(".tar.xz")) return ZipCompressionMethod.Xz;
|
||||
else if (fileName.EndsWith(".tar.bz2")) return ZipCompressionMethod.BZip2;
|
||||
else if (fileName.EndsWith(".tar.lzma")) return ZipCompressionMethod.LZMA;
|
||||
else if (fileName.EndsWith(".tar.zst")) return ZipCompressionMethod.ZStd;
|
||||
|
||||
return ZipCompressionMethod.None;
|
||||
}
|
||||
@@ -135,16 +131,7 @@ public class DebReader
|
||||
}
|
||||
case ZipCompressionMethod.LZMA:
|
||||
{
|
||||
var reader = new BinaryReader(stream);
|
||||
reader.ReadUInt16(); //LZMA version
|
||||
var props = new byte[reader.ReadUInt16()];
|
||||
reader.Read(props, 0, props.Length);
|
||||
return new LzmaStream(
|
||||
props,
|
||||
stream,
|
||||
stream.Length - 4,
|
||||
-1
|
||||
);
|
||||
throw new NotSupportedException("Plugin NOT support deb with LZMA algorithm");
|
||||
}
|
||||
case ZipCompressionMethod.Xz:
|
||||
{
|
||||
@@ -152,8 +139,7 @@ public class DebReader
|
||||
}
|
||||
case ZipCompressionMethod.ZStd:
|
||||
{
|
||||
// Not supported for ZStd
|
||||
return default;
|
||||
throw new NotSupportedException("Plugin NOT support deb with ZStd algorithm");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,19 +149,10 @@ public class DebReader
|
||||
private enum ZipCompressionMethod
|
||||
{
|
||||
None = 0,
|
||||
Shrink = 1,
|
||||
Reduce1 = 2,
|
||||
Reduce2 = 3,
|
||||
Reduce3 = 4,
|
||||
Reduce4 = 5,
|
||||
Explode = 6,
|
||||
Deflate = 8,
|
||||
Deflate64 = 9,
|
||||
BZip2 = 12,
|
||||
LZMA = 14,
|
||||
ZStd = 93,
|
||||
Xz = 95,
|
||||
PPMd = 98,
|
||||
WinzipAes = 0x63,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user