From c389f2769a150f59893e1537e5728b1902ff485f Mon Sep 17 00:00:00 2001 From: Antoine Aflalo Date: Sun, 7 Apr 2024 12:53:04 -0400 Subject: [PATCH] fix(device:icon): Force max size of 32px instead of what's available as large --- .../Framework/Audio/Icon/AudioDeviceIconExtractor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SoundSwitch.Common/Framework/Audio/Icon/AudioDeviceIconExtractor.cs b/SoundSwitch.Common/Framework/Audio/Icon/AudioDeviceIconExtractor.cs index 725e29deff..f9375cdacb 100644 --- a/SoundSwitch.Common/Framework/Audio/Icon/AudioDeviceIconExtractor.cs +++ b/SoundSwitch.Common/Framework/Audio/Icon/AudioDeviceIconExtractor.cs @@ -55,7 +55,7 @@ public static System.Drawing.Icon ExtractIconFromPath(string path, DataFlow data var iconInfo = path.Split(','); var dllPath = iconInfo[0]; var iconIndex = int.Parse(iconInfo[1]); - return System.Drawing.Icon.ExtractIcon(dllPath, iconIndex, !largeIcon); + return System.Drawing.Icon.ExtractIcon(dllPath, iconIndex, largeIcon ? 32 : 16); } var key = $"{path}-${largeIcon}"; @@ -70,9 +70,10 @@ public static System.Drawing.Icon ExtractIconFromPath(string path, DataFlow data { throw new ArgumentException("Can't find icon"); } + using var entry = IconCache.CreateEntry(key); entry.SetValue(icon) - .SetSize(largeIcon? 2 : 1) + .SetSize(largeIcon ? 2 : 1) .SetSlidingExpiration(TimeSpan.FromMinutes(30)) .SetPriority(largeIcon ? CacheItemPriority.High : CacheItemPriority.Low) .RegisterPostEvictionCallback((o, value, reason, state) =>