public Image AliasFolder() { if (IconCache.TryGetIcon("path:folder", out Bitmap image, "alias")) { return(image); } var baseImage = GetFileIcon(default, true, true, false);
private Icon Get(object key, string path, string classifier) { if (IconCache.TryGetIcon(key, out Icon image, classifier)) { return(image); } using var stream = GetStream(path); Icon icon = new(stream); IconCache.CacheIcon(key, 0, icon, classifier); return(icon); }
private IEnumerable <Image> Get(object key, string path, string classifier, bool returnDefault, out Image @default) { Image image = default; var images = IconCache.Filter <Image>(((object key, string classifier, int)f) => Equals(key, f.key) && Equals(classifier, f.classifier)); if (!images.Any()) { bool isDefault = !IconCache.TryGetIcon <Image>(key, out _, classifier); Stream stream = default; bool dispose = true; try { stream = GetStream(path); images = GetImages(stream, (c, s) => c.TryGetIcon <Image>(key, out _, classifier), (c, s, i) => { if (isDefault) { isDefault = false; if (returnDefault) { image = i; } IconCache.CacheIcon <Image>(key, s, classifier); } IconCache.CacheIcon(key, s, i, classifier); }, out dispose); } finally { if (dispose && stream != null) { stream.Dispose(); } } } @default = image; return(images); }
public override BitmapSource GetDisk(Protocol protocol, int size) => IconCache.TryGetIcon(protocol, size, out BitmapSource image, "Disk")