mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #1727 from VictoriousRaptor/FixImageCache
Fix ImageCache when loading full image
This commit is contained in:
commit
5c5dbf2d35
2 changed files with 3 additions and 8 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Flow.Launcher.Infrastructure.Image
|
namespace Flow.Launcher.Infrastructure.Image
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
||||||
|
|
||||||
public static bool CacheContainImage(string path, bool loadFullImage = false)
|
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)
|
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)
|
if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache)
|
||||||
{ // we need to get image hash
|
{ // we need to get image hash
|
||||||
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
|
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
|
||||||
if (imageResult.ImageType == ImageType.FullImageFile)
|
|
||||||
{
|
|
||||||
path = $"{path}_{ImageType.FullImageFile}";
|
|
||||||
}
|
|
||||||
if (hash != null)
|
if (hash != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -283,7 +279,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
||||||
}
|
}
|
||||||
|
|
||||||
// update cache
|
// update cache
|
||||||
ImageCache[path, false] = img;
|
ImageCache[path, loadFullImage] = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue