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) =>