diff --git a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/DataPackageHelpers.cs b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/DataPackageHelpers.cs index 37ddf5e56e..4aacd0c115 100644 --- a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/DataPackageHelpers.cs +++ b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/DataPackageHelpers.cs @@ -18,7 +18,7 @@ namespace AdvancedPaste.Helpers; internal static class DataPackageHelpers { - private static readonly HashSet ImageFileTypes = new(StringComparer.InvariantCultureIgnoreCase) { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico", ".svg" }; + private static readonly Lazy> ImageFileTypes = new(GetImageFileTypes()); private static readonly (string DataFormat, ClipboardFormat ClipboardFormat)[] DataFormats = [ @@ -57,7 +57,7 @@ internal static class DataPackageHelpers { availableFormats |= ClipboardFormat.File; - if (ImageFileTypes.Contains(file.FileType)) + if (ImageFileTypes.Value.Contains(file.FileType)) { availableFormats |= ClipboardFormat.Image; } @@ -148,4 +148,9 @@ internal static class DataPackageHelpers return null; } + + private static HashSet GetImageFileTypes() => + BitmapDecoder.GetDecoderInformationEnumerator() + .SelectMany(di => di.FileExtensions) + .ToHashSet(StringComparer.InvariantCultureIgnoreCase); }