From b40ff9ef667f904f887d78f970c04b6af862f74e Mon Sep 17 00:00:00 2001 From: Yeechan Lu Date: Thu, 20 Mar 2014 14:18:48 +0800 Subject: [PATCH] Fix some icon issues of some file types --- Wox/ImagePathConverter.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Wox/ImagePathConverter.cs b/Wox/ImagePathConverter.cs index 3db4550b5b..0879cf78a4 100644 --- a/Wox/ImagePathConverter.cs +++ b/Wox/ImagePathConverter.cs @@ -15,6 +15,11 @@ namespace Wox { private static Dictionary imageCache = new Dictionary(); private static List imageExts = new List() { ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico" }; + private static List selfExts = new List() { + ".exe", ".lnk", + ".ani", ".cur", + ".sln" + }; private static ImageSource GetIcon(string fileName) { @@ -42,7 +47,7 @@ namespace Wox { return imageCache[fullPath]; } - if (imageCache.ContainsKey(ext)) + if (!selfExts.Contains(ext) && imageCache.ContainsKey(ext)) { return imageCache[ext]; } @@ -56,9 +61,10 @@ namespace Wox { resolvedPath = fullPath; } + string extn = Path.GetExtension(resolvedPath).ToLower(); var cacheKey = fullPath; - if (resolvedPath.ToLower().EndsWith(".exe") || resolvedPath.ToLower().EndsWith(".lnk")) + if (selfExts.Contains(extn)) { img = GetIcon(resolvedPath); } @@ -69,7 +75,7 @@ namespace Wox else { img = GetIcon(resolvedPath); - cacheKey = ext; + if (!selfExts.Contains(ext)) cacheKey = ext; } if (img != null)