Merge pull request #1727 from VictoriousRaptor/FixImageCache

Fix ImageCache when loading full image
This commit is contained in:
VictoriousRaptor 2022-12-30 00:42:49 +08:00 committed by GitHub
commit 5c5dbf2d35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View file

@ -1,9 +1,8 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
namespace Flow.Launcher.Infrastructure.Image

View file

@ -248,7 +248,7 @@ namespace Flow.Launcher.Infrastructure.Image
public static bool CacheContainImage(string path, bool loadFullImage = false)
{
return ImageCache.ContainsKey(path, false) && ImageCache[path, loadFullImage] != null;
return ImageCache.ContainsKey(path, loadFullImage);
}
public static bool TryGetValue(string path, bool loadFullImage, out ImageSource image)
@ -264,10 +264,6 @@ namespace Flow.Launcher.Infrastructure.Image
if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache)
{ // we need to get image hash
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
if (imageResult.ImageType == ImageType.FullImageFile)
{
path = $"{path}_{ImageType.FullImageFile}";
}
if (hash != null)
{
@ -283,7 +279,7 @@ namespace Flow.Launcher.Infrastructure.Image
}
// update cache
ImageCache[path, false] = img;
ImageCache[path, loadFullImage] = img;
}
return img;