From 6a0e20ea7ed0963015da5863c0aca00dd313203f Mon Sep 17 00:00:00 2001 From: puchacz Date: Tue, 17 Dec 2024 22:35:45 +0100 Subject: [PATCH] 1. Injected file extension will be turned into lowered invariant version. 2. New image formats --- .../Musoq.DataSources.Os.csproj | 2 +- Musoq.DataSources.Os/OsLibrary.cs | 76 +++++++++++++------ 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/Musoq.DataSources.Os/Musoq.DataSources.Os.csproj b/Musoq.DataSources.Os/Musoq.DataSources.Os.csproj index 1be0115..79db80a 100644 --- a/Musoq.DataSources.Os/Musoq.DataSources.Os.csproj +++ b/Musoq.DataSources.Os/Musoq.DataSources.Os.csproj @@ -3,7 +3,7 @@ net8.0 true - 7.0.0 + 7.0.1 Jakub PuchaƂa Musoq https://github.com/Puchaczov/Musoq diff --git a/Musoq.DataSources.Os/OsLibrary.cs b/Musoq.DataSources.Os/OsLibrary.cs index ac8795d..8b262b5 100644 --- a/Musoq.DataSources.Os/OsLibrary.cs +++ b/Musoq.DataSources.Os/OsLibrary.cs @@ -116,22 +116,50 @@ public partial class OsLibrary : LibraryBase private static readonly HashSet IsImageSet = [ - ".bmp", - ".gif", - ".jpeg", - ".jpg", - ".png", - ".psb", - ".psd", - ".tiff", - ".webp", - ".pbm", - ".pgm", - ".ppm", - ".pnm", - ".pcx", - ".dng", - ".svg" + // Common web and general-purpose formats + ".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", + + // Raw camera formats + ".arw", // Sony + ".cr2", // Canon + ".cr3", // Canon + ".dng", // Adobe Digital Negative + ".nef", // Nikon + ".orf", // Olympus + ".raf", // Fujifilm + ".rw2", // Panasonic + + // Professional/Design formats + ".psd", // Adobe Photoshop + ".psb", // Adobe Photoshop Big + ".tiff", // Tagged Image File Format + ".tif", // Alternative extension for TIFF + + // Vector formats + ".svg", // Scalable Vector Graphics + ".ai", // Adobe Illustrator + ".eps", // Encapsulated PostScript + + // Bitmap formats + ".bmp", // Bitmap + ".ico", // Icon + + // High efficiency formats + ".heic", // High Efficiency Image Format + ".heif", // High Efficiency Image Format + + // Special purpose formats + ".pbm", // Portable Bitmap + ".pgm", // Portable Graymap + ".ppm", // Portable Pixmap + ".pnm", // Portable Anymap + + // Animation-capable formats + ".apng", // Animated PNG + + // HDR formats + ".hdr", // Radiance HDR + ".exr" // OpenEXR ]; private static readonly HashSet IsSourceSet = @@ -209,7 +237,7 @@ public partial class OsLibrary : LibraryBase /// FileInfo that must be examined whether is zip or not /// if the specified extension is zip archive; otherwise, [BindableMethod] - public bool IsZipArchive([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsZipArchiveSet.Contains(fileInfo.Extension); + public bool IsZipArchive([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsZipArchiveSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is archive. @@ -225,7 +253,7 @@ public partial class OsLibrary : LibraryBase /// FileInfo that must be examined whether is archive or not /// if the specified extension is archive; otherwise, [BindableMethod] - public bool IsArchive([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsArchiveSet.Contains(fileInfo.Extension); + public bool IsArchive([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsArchiveSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is audio. @@ -241,7 +269,7 @@ public partial class OsLibrary : LibraryBase /// The fileInfo /// True if audio; otherwise false [BindableMethod] - public bool IsAudio([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsAudioSet.Contains(fileInfo.Extension); + public bool IsAudio([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsAudioSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is book. @@ -257,7 +285,7 @@ public partial class OsLibrary : LibraryBase /// The fileInfo /// True if book; otherwise false [BindableMethod] - public bool IsBook([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsBookSet.Contains(fileInfo.Extension); + public bool IsBook([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsBookSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is document. @@ -273,7 +301,7 @@ public partial class OsLibrary : LibraryBase /// The fileInfo /// True if document; otherwise false [BindableMethod] - public bool IsDoc([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsDocSet.Contains(fileInfo.Extension); + public bool IsDoc([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsDocSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is image. @@ -289,7 +317,7 @@ public partial class OsLibrary : LibraryBase /// The fileInfo /// True if image; otherwise false [BindableMethod] - public bool IsImage([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsImageSet.Contains(fileInfo.Extension); + public bool IsImage([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsImageSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is source. @@ -305,7 +333,7 @@ public partial class OsLibrary : LibraryBase /// The fileInfo /// True if source; otherwise false [BindableMethod] - public bool IsSource([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsSourceSet.Contains(fileInfo.Extension); + public bool IsSource([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsSourceSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Determine whether the extension is video. @@ -321,7 +349,7 @@ public partial class OsLibrary : LibraryBase /// The fileInfo /// True if video; otherwise false [BindableMethod] - public bool IsVideo([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsVideoSet.Contains(fileInfo.Extension); + public bool IsVideo([InjectSpecificSource(typeof(FileEntity))] FileEntity fileInfo) => IsVideoSet.Contains(fileInfo.Extension.ToLowerInvariant()); /// /// Gets the file content