Table of Contents

Interface IIconStore

Namespace
ZeroInstall.Store.Icons
Assembly
ZeroInstall.Store.dll

Stores icon files downloaded from the web as local files.

public interface IIconStore
Extension Methods

Remarks

Implementations of this interface are immutable and thread-safe.

Methods

Get(Icon, out bool)

Gets an icon from the cache or downloads it if not yet cached.

string Get(Icon icon, out bool shouldRefresh)

Parameters

icon Icon

The icon to get.

shouldRefresh bool

Indicates 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.

GetFresh(Icon)

Gets an icon from the cache or downloads it if not yet cached or outdated.

string GetFresh(Icon icon)

Parameters

icon Icon

The 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

void Import(Icon icon, Stream stream)

Parameters

icon Icon

Metadata about the icon.

stream Stream

The contents of the icon file.

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.

string? TryGetCached(Icon icon, out bool shouldRefresh)

Parameters

icon Icon

The icon to get.

shouldRefresh bool

Indicates 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.