Table of Contents

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 string
config Config
handler 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 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.

GetFileName(Icon)

Gets a file name suitable for storing an Icon on the disk.

public static string GetFileName(Icon icon)

Parameters

icon Icon

Returns

string

GetFresh(Icon)

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

public 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

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

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