diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs index 934fb6d..b5e7022 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/ArchiveInfoPanel.xaml.cs @@ -79,21 +79,10 @@ namespace QuickLook.Plugin.ArchiveViewer { using (var stream = File.OpenRead(path)) { - // https://github.com/adamhathcock/sharpcompress/blob/master/FORMATS.md says: - // The 7Zip format doesn't allow for reading as a forward-only stream so 7Zip is only supported through the Archive API - if (Path.GetExtension(path).ToLower() == ".7z") - { - var archive = ArchiveFactory.Open(stream); + // ReaderFactory is slow... so limit its usage + string[] useReader = {".tar.gz", ".tgz", ".tar.bz2", ".tar.lz", ".tar.xz"}; - _type = archive.Type.ToString(); - - var root = new ArchiveFileEntry(Path.GetFileName(path), true); - _fileEntries.Add("", root); - - foreach (var entry in archive.Entries) - ProcessByLevel(entry); - } - else + if (useReader.Any(i => path.EndsWith(i))) { var reader = ReaderFactory.Open(stream); @@ -105,6 +94,18 @@ namespace QuickLook.Plugin.ArchiveViewer while (reader.MoveToNextEntry()) ProcessByLevel(reader.Entry); } + else + { + var archive = ArchiveFactory.Open(stream); + + _type = archive.Type.ToString(); + + var root = new ArchiveFileEntry(Path.GetFileName(path), true); + _fileEntries.Add("", root); + + foreach (var entry in archive.Entries) + ProcessByLevel(entry); + } } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs index dd1878d..c3e3ad6 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/Plugin.cs @@ -25,6 +25,7 @@ namespace QuickLook.Plugin.ArchiveViewer case ".rar": case ".zip": case ".tar": + case ".tgz": case ".gz": case ".bz2": case ".lz": @@ -39,7 +40,7 @@ namespace QuickLook.Plugin.ArchiveViewer public void Prepare(string path, ContextObject context) { - context.PreferredSize = new Size {Width = 800, Height = 600}; + context.PreferredSize = new Size {Width = 800, Height = 400}; } public void View(string path, ContextObject context)