Table of Contents

Class LibraryCatalogueScope

Namespace
EncDotNet.S100.Collections.Library
Assembly
EncDotNet.S100.Collections.dll

What part of an online catalogue a new Library source includes (#792): the catalogue as read, its choices, what the ticked choices amount to, and the source they make. One per catalogue kind; the viewer's Add-to-Library dialog and headless hosts share them.

public abstract class LibraryCatalogueScope
Inheritance
LibraryCatalogueScope
Derived
Inherited Members

Constructors

LibraryCatalogueScope(Uri)

Creates a scope for the catalogue at catalogUri.

protected LibraryCatalogueScope(Uri catalogUri)

Parameters

catalogUri Uri

The catalogue's URL.

Properties

CanBuild

True when the source can be built (by default, once the catalogue is read).

public virtual bool CanBuild { get; }

Property Value

bool

CatalogUri

The catalogue's URL.

public Uri CatalogUri { get; }

Property Value

Uri

CatalogueDate

The date the catalogue declares, once read.

public DateOnly? CatalogueDate { get; protected set; }

Property Value

DateOnly?

Choices

Every choice across the groups.

public IEnumerable<LibraryChoice> Choices { get; }

Property Value

IEnumerable<LibraryChoice>

EverythingSummary

"12,345 cells · 1.2 GB" for the whole catalogue.

public abstract string EverythingSummary { get; }

Property Value

string

Groups

The choice groups, once the catalogue has been read.

public abstract IReadOnlyList<LibraryChoiceGroup> Groups { get; }

Property Value

IReadOnlyList<LibraryChoiceGroup>

IncludeAll

True to include the whole catalogue whatever is ticked (the default); false to include only the ticked choices.

public bool IncludeAll { get; set; }

Property Value

bool

IsEverything

True when the source will include everything: the suggested name is then the catalogue's alone.

public virtual bool IsEverything { get; }

Property Value

bool

IsLoaded

True once the catalogue has been read.

public abstract bool IsLoaded { get; }

Property Value

bool

IsUnscoped

True when nothing is ticked (the selection means the whole catalogue).

public bool IsUnscoped { get; }

Property Value

bool

Name

The catalogue's own name, when it has one (a manifest's title); otherwise null.

public virtual string? Name { get; }

Property Value

string

ScopeSummary

The summary under the choices: what is included, that ticks are kept, or a prompt to tick something.

public virtual string ScopeSummary { get; }

Property Value

string

SelectedCount

How many choices are ticked.

public int SelectedCount { get; }

Property Value

int

SelectionSummary

What the ticked choices (or, with none, the whole catalogue) amount to, e.g. "12 cells · 3 MB".

public abstract string SelectionSummary { get; }

Property Value

string

SingleEntry

The catalogue's only download, when it lists just one (there is nothing to choose); otherwise null.

public abstract LibraryChoice? SingleEntry { get; }

Property Value

LibraryChoice

Methods

Build(Guid, string?)

The source the scope describes.

public abstract CollectionSource Build(Guid id, string? name)

Parameters

id Guid

The new source's id.

name string

The source's name when everything is included (the catalogue's name); a selection names it after the selection. A manifest source always takes it.

Returns

CollectionSource

DescribeSelection()

Describes the ticked choices ("Alaska, Hawaii"), or null when nothing is ticked.

public abstract string? DescribeSelection()

Returns

string

LoadAsync(CancellationToken)

Reads the catalogue and creates its choices.

public abstract Task<string?> LoadAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels the read.

Returns

Task<string>

Why the catalogue could not be read, or null when it was.

OnChanged()

Raises Changed.

protected void OnChanged()

Size(long?)

"Download (1.7 MB)"-style size text for a single entry, or empty when unknown.

protected static string Size(long? bytes)

Parameters

bytes long?

Returns

string

TryLoadAsync(Func<Task>)

Runs load, turning the expected failures of reading a catalogue into a message.

protected static Task<string?> TryLoadAsync(Func<Task> load)

Parameters

load Func<Task>

Returns

Task<string>

Events

Changed

Raised when something the scope shows changed on its own (sizes arriving after a listing).

public event EventHandler? Changed

Event Type

EventHandler