mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
20 lines
480 B
C#
20 lines
480 B
C#
using System.IO;
|
|
using System.IO.Compression;
|
|
using System.Linq;
|
|
|
|
namespace API.Extensions;
|
|
#nullable enable
|
|
|
|
public static class ZipArchiveExtensions
|
|
{
|
|
/// <summary>
|
|
/// Checks if archive has one or more files. Excludes directory entries.
|
|
/// </summary>
|
|
/// <param name="archive"></param>
|
|
/// <returns></returns>
|
|
public static bool HasFiles(this ZipArchive archive)
|
|
{
|
|
return archive.Entries.Any(x => Path.HasExtension(x.FullName));
|
|
}
|
|
}
|