Class CatalogueFormatDetector
- Namespace
- EncDotNet.S100.Collections.KnownSources
- Assembly
- EncDotNet.S100.Collections.dll
Recognises an online chart catalogue's format from its root element
(issue #670): EncProductCatalog (NOAA), IENC…ProductCatalog
(USACE), RncProductCatalogChartCatalogs (community lists) and
S100_ExchangeCatalogue (remote S-100 catalogues, issue #685) — and
S-100 feeds, JSON whose format is encdotnet-s100-feed
(issue #680). Only the start of the document is read.
public static class CatalogueFormatDetector
- Inheritance
-
CatalogueFormatDetector
- Inherited Members
Fields
S100ExchangeCatalogueRoot
The root element of an S-100 exchange catalogue (CATALOG.XML).
public const string S100ExchangeCatalogueRoot = "S100_ExchangeCatalogue"
Field Value
Methods
FromRootElement(string?)
The format a root element names, or null when it is not a supported catalogue.
public static KnownCatalogueFormat? FromRootElement(string? localName)
Parameters
localNamestring
Returns
Probe(Stream)
Reads the root element and header title from stream
(gzip-compressed or not). A stream that cannot seek is read in full.
public static CatalogueProbe Probe(Stream stream)
Parameters
streamStream
Returns
ProbeAsync(HttpClient, Uri, HttpClient?, CancellationToken)
Probes uri as ProbeAsync(HttpClient, Uri, CancellationToken)
does, trying it as a SECOM service with secomHttpClient:
one whose handler trusts MCP-issued server certificates (#829), which
the general client deliberately does not.
public static Task<CatalogueProbe> ProbeAsync(HttpClient httpClient, Uri uri, HttpClient? secomHttpClient, CancellationToken cancellationToken = default)
Parameters
httpClientHttpClientThe client documents are fetched with.
uriUriThe URL to probe.
secomHttpClientHttpClientThe client SECOM is asked with; null uses
httpClient.cancellationTokenCancellationTokenCancels the probe.
Returns
Exceptions
- HttpRequestException
The URL could not be fetched and is not a SECOM service.
ProbeAsync(HttpClient, Uri, CancellationToken)
Fetches the start of the document at uri and probes
it. When the URL is not a recognised document (or cannot be fetched),
it is tried as a SECOM service endpoint: a service that answers
Capability is recognised as Secom
(issue #804).
public static Task<CatalogueProbe> ProbeAsync(HttpClient httpClient, Uri uri, CancellationToken cancellationToken = default)
Parameters
httpClientHttpClienturiUricancellationTokenCancellationToken
Returns
Exceptions
- HttpRequestException
The URL could not be fetched and is not a SECOM service.