[Peek]Upgrade SharpCompress and minor ArchivePreviewer changes (#32637)

This commit is contained in:
Davide Giacometti 2024-05-07 23:17:18 +02:00 committed by GitHub
parent 77d3071fb3
commit 3046d1e3e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 9 deletions

View File

@ -58,7 +58,7 @@
<PackageVersion Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageVersion Include="NLog.Schema" Version="5.2.8" />
<PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" />
<PackageVersion Include="SharpCompress" Version="0.33.0" />
<PackageVersion Include="SharpCompress" Version="0.37.2" />
<PackageVersion Include="StreamJsonRpc" Version="2.14.24" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<!-- Package System.CodeDom added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Management but the 8.0.1 version wasn't published to nuget. -->
@ -97,4 +97,4 @@
<PackageVersion Include="Microsoft.VariantAssignment.Client" Version="2.4.17140001" />
<PackageVersion Include="Microsoft.VariantAssignment.Contract" Version="3.0.16990001" />
</ItemGroup>
</Project>
</Project>

View File

@ -1343,7 +1343,7 @@ EXHIBIT A -Mozilla Public License.
- NLog.Extensions.Logging 5.3.8
- NLog.Schema 5.2.8
- ScipBe.Common.Office.OneNote 3.0.1
- SharpCompress 0.33.0
- SharpCompress 0.37.2
- StreamJsonRpc 2.14.24
- StyleCop.Analyzers 1.2.0-beta.556
- System.CodeDom 8.0.0

View File

@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
@ -28,6 +27,8 @@ namespace Peek.FilePreviewer.Previewers.Archives
{
public partial class ArchivePreviewer : ObservableObject, IArchivePreviewer
{
private static readonly char[] _keySeparators = { '/', '\\' };
private readonly IconCache _iconCache = new();
private int _directoryCount;
private int _fileCount;
@ -125,10 +126,12 @@ namespace Peek.FilePreviewer.Previewers.Archives
{
ArgumentNullException.ThrowIfNull(entry, nameof(entry));
var levels = entry!.Key
.Split('/', '\\')
.Where(l => !string.IsNullOrWhiteSpace(l))
.ToArray();
if (entry.Key == null)
{
return;
}
var levels = entry.Key.Split(_keySeparators, StringSplitOptions.RemoveEmptyEntries);
ArchiveItem? parent = null;
for (var i = 0; i < levels.Length; i++)
@ -209,7 +212,7 @@ namespace Peek.FilePreviewer.Previewers.Archives
private static readonly HashSet<string> _supportedFileTypes = new()
{
".zip", ".rar", ".7z", ".tar", ".nupkg", ".jar", ".gz", ".tar", ".tar.gz", ".tgz",
".zip", ".rar", ".7z", ".tar", ".nupkg", ".jar", ".gz", ".tar.gz", ".tgz",
};
}
}