public Image AliasFolder()
        {
            if (IconCache.TryGetIcon("path:folder", out Bitmap image, "alias"))
            {
                return(image);
            }

            var baseImage = GetFileIcon(default, true, true, false);
Пример #2
0
        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);
        }
Пример #4
0
 public IconProvider(IconCache iconCache, IIconProviderImageSource imageSource)
 {
     IconCache   = iconCache;
     ImageSource = imageSource;
 }
Пример #5
0
 public IconIconProvider(IconCache iconCache, IIconProviderImageSource imageSource) : base(iconCache, imageSource)
 {
 }
 public WinFormsIconProvider(ProtocolFactory protocols, ProfileListObserver profileListObserver, IconCache iconCache, IIconProviderImageSource imageSource) : base(iconCache, imageSource)
 {
     this.protocols = protocols;
     BuildProtocolImageList();
     profileListObserver.ProfilesChanged += ProfileListObserver_ProfilesChanged;
 }
Пример #7
0
 public override BitmapSource GetDisk(Protocol protocol, int size)
 => IconCache.TryGetIcon(protocol, size, out BitmapSource image, "Disk")
Пример #8
0
 public WpfIconProvider(IconCache cache, IIconProviderImageSource imageSource) : base(cache, imageSource)
 {
 }