From d8c547f7ef3a640b613778713508a9b111c90ab6 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 28 Feb 2025 18:10:58 +0800 Subject: [PATCH] Improve code quality --- Flow.Launcher/Helper/WallpaperPathRetrieval.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Helper/WallpaperPathRetrieval.cs b/Flow.Launcher/Helper/WallpaperPathRetrieval.cs index eedc78eca..a3bd83a97 100644 --- a/Flow.Launcher/Helper/WallpaperPathRetrieval.cs +++ b/Flow.Launcher/Helper/WallpaperPathRetrieval.cs @@ -15,9 +15,9 @@ namespace Flow.Launcher.Helper; public static class WallpaperPathRetrieval { private static readonly int MAX_PATH = 260; + private static readonly int MAX_CACHE_SIZE = 3; private static readonly Dictionary<(string, DateTime), ImageBrush> wallpaperCache = new(); - private const int MaxCacheSize = 3; public static Brush GetWallpaperBrush() { @@ -54,7 +54,7 @@ public static class WallpaperPathRetrieval wallpaperBrush.Freeze(); // Make the brush thread-safe // Manage cache size - if (wallpaperCache.Count >= MaxCacheSize) + if (wallpaperCache.Count >= MAX_CACHE_SIZE) { // Remove the oldest wallpaper from the cache var oldestCache = wallpaperCache.Keys.OrderBy(k => k.Item2).FirstOrDefault();