Class IconStore
- Namespace
- ZeroInstall.Store.Icons
- Assembly
- ZeroInstall.Store.dll
Stores icon files downloaded from the web as local files.
public sealed class IconStore : IIconStore
- Inheritance
-
IconStore
- Implements
- Inherited Members
- Extension Methods
Remarks
This class is immutable and thread-safe.
Constructors
IconStore(string, Config, ITaskHandler)
Stores icon files downloaded from the web as local files.
public IconStore(string path, Config config, ITaskHandler handler)
Parameters
path
stringconfig
Confighandler
ITaskHandler
Remarks
This class is immutable and thread-safe.
Methods
Get(Icon, out bool)
Gets an icon from the cache or downloads it if not yet cached.
public string Get(Icon icon, out bool shouldRefresh)
Parameters
icon
IconThe icon to get.
shouldRefresh
boolIndicates whether the returned file is outdated and EffectiveNetworkUse is Full.
Returns
- string
The file path of the icon in the cache.
Exceptions
- OperationCanceledException
The user canceled the task.
- IOException
A problem occurred while adding the icon to the cache.
- UnauthorizedAccessException
Read or write access to the cache is not permitted.
- WebException
A problem occurred while downloading the icon.
- InvalidDataException
The icon does not have a valid format.
GetFileName(Icon)
Gets a file name suitable for storing an Icon on the disk.
public static string GetFileName(Icon icon)
Parameters
icon
Icon
Returns
GetFresh(Icon)
Gets an icon from the cache or downloads it if not yet cached or outdated.
public string GetFresh(Icon icon)
Parameters
icon
IconThe icon to get.
Returns
- string
The file path of the icon in the cache.
Exceptions
- OperationCanceledException
The user canceled the task.
- IOException
A problem occurred while adding the icon to the cache.
- UnauthorizedAccessException
Read or write access to the cache is not permitted.
- WebException
A problem occurred while downloading the icon.
- InvalidDataException
The icon does not have a valid format.
Import(Icon, Stream)
Imports an icon into the cache
public void Import(Icon icon, Stream stream)
Parameters
Exceptions
- OperationCanceledException
The user canceled the task.
- IOException
A problem occurred while adding the icon to the cache.
- UnauthorizedAccessException
Read or write access to the cache is not permitted.
- InvalidDataException
The icon does not have a valid format.
TryGetCached(Icon, out bool)
Tries to get an icon that is already cached.
public string? TryGetCached(Icon icon, out bool shouldRefresh)
Parameters
icon
IconThe icon to get.
shouldRefresh
boolIndicates whether the returned file is outdated and EffectiveNetworkUse is Full.
Returns
- string
The file path of the icon in the cache;
null
if the icon is not cached yet.