Class LibraryItemState
- Namespace
- EncDotNet.S100.Collections.Library
- Assembly
- EncDotNet.S100.Collections.dll
One library item as a host sees it now: where its data can be had (Availability), the copy that would open (EffectiveItem) and the time its data covers (ValidWindow). The viewer's Library rows and the MCP Library tools both read items through it, so they agree.
public sealed class LibraryItemState
- Inheritance
-
LibraryItemState
- Inherited Members
Remarks
Values are resolved on first access and then kept; create a new state when the item is downloaded, opened or closed.
Constructors
LibraryItemState(CollectionItem, LibrarySource, ILibraryLocalCopies?, Func<CollectionItem, LibraryLoadState>?, TimeProvider?)
Creates the state of item from source.
public LibraryItemState(CollectionItem item, LibrarySource source, ILibraryLocalCopies? copies = null, Func<CollectionItem, LibraryLoadState>? loadState = null, TimeProvider? time = null)
Parameters
itemCollectionItemThe indexed item.
sourceLibrarySourceThe source it was indexed from.
copiesILibraryLocalCopiesDownloaded copies of online items, or null when the host downloads nothing.
loadStateFunc<CollectionItem, LibraryLoadState>Whether an item is open in the host's session, or null when nothing is.
timeTimeProviderThe clock that decides whether a downloaded forecast run has ended.
Properties
Availability
Where the data can be had now.
public LibraryAvailability Availability { get; }
Property Value
CatalogueRun
The catalogue's latest run and its valid window, for a forecast (UTC).
public (DateTime Run, DateTime End)? CatalogueRun { get; }
Property Value
Credit
The source's credit for the item's data, as a layer row and pick report show it ("NOAA/NCEP GFS-Wave · Public domain"), or null when it has none (#1075).
public string? Credit { get; }
Property Value
EffectiveItem
The item as it can be opened now: an online item that has been downloaded, with its downloaded (local) location; otherwise Item.
public CollectionItem EffectiveItem { get; }
Property Value
Id
The item's id across the library: <sourceId>:<key>.
public string Id { get; }
Property Value
IsForecast
True for a dataset of one forecast run (#685).
public bool IsForecast { get; }
Property Value
IsLoadedNow
True when the item's downloaded copy is loaded now.
public bool IsLoadedNow { get; }
Property Value
IsPinnedRun
True for a pinned weather run: a copy kept beside the latest (#1075).
public bool IsPinnedRun { get; }
Property Value
IsStaleRun
True for a weather run (#1075) whose shown run — the downloaded copy's, else the listed one — is more than StaleAfter (12 hours) old: the Library marks it stale and offers to load the latest run. A pinned run never is.
public bool IsStaleRun { get; }
Property Value
Item
The indexed item.
public CollectionItem Item { get; }
Property Value
LocalRun
The run of the downloaded copy, if any.
public DateTimeOffset? LocalRun { get; }
Property Value
NotForNavigation
True when the source flags the item not for navigation.
public bool NotForNavigation { get; }
Property Value
Source
The source the item was indexed from.
public LibrarySource Source { get; }
Property Value
ValidWindow
The time the item's data covers (#711), in UTC: a forecast run's valid window (the downloaded copy's run, else the catalogue's), or a dataset's own time coverage; null for none.
public (DateTime Start, DateTime End)? ValidWindow { get; }
Property Value
Methods
FormatId(Guid, string)
Formats an item id: <sourceId>:<key>.
public static string FormatId(Guid sourceId, string key)
Parameters
Returns
Matches(string)
True when the item matches a free-text filter (name, title, spec, or a property value such as a state code), case-insensitively.
public bool Matches(string filter)
Parameters
filterstring
Returns
TimeCoverage(CollectionItem)
A dataset's own time coverage, as a local index records it (timeStart/timeEnd).
public static (DateTime Start, DateTime End)? TimeCoverage(CollectionItem item)
Parameters
itemCollectionItem
Returns
TryParseId(string, out Guid, out string)
Parses an item id (<sourceId>:<key>).
public static bool TryParseId(string itemId, out Guid sourceId, out string key)