Class ExchangeSet
- Namespace
- EncDotNet.S100.ExchangeSets
- Assembly
- EncDotNet.S100.ExchangeSets.dll
An exchange set backed by an IAssetSource.
public sealed class ExchangeSet : IDisposable
- Inheritance
-
ExchangeSet
- Implements
- Inherited Members
Constructors
ExchangeSet(IAssetSource, ExchangeCatalogue)
Initializes a new instance of ExchangeSet with the given source and catalogue.
public ExchangeSet(IAssetSource source, ExchangeCatalogue catalogue)
Parameters
sourceIAssetSourceThe asset source used to fetch referenced files.
catalogueExchangeCatalogueThe parsed exchange catalogue.
Properties
Catalogue
Gets the parsed exchange catalogue metadata.
public ExchangeCatalogue Catalogue { get; }
Property Value
Source
Gets the asset source backing this exchange set. Exposed so callers (e.g. bulk loaders) can pass it directly to per-spec dataset processors that accept an IAssetSource.
public IAssetSource Source { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FetchCatalogueFileAsync(CatalogueDiscoveryMetadata, CancellationToken)
Fetches the content of a sub-catalogue file referenced by the catalogue.
public Task<Stream> FetchCatalogueFileAsync(CatalogueDiscoveryMetadata catalogueFile, CancellationToken cancellationToken = default)
Parameters
catalogueFileCatalogueDiscoveryMetadatacancellationTokenCancellationToken
Returns
FetchDatasetAsync(DatasetDiscoveryMetadata, CancellationToken)
Fetches the content of a dataset file referenced by the catalogue.
public Task<Stream> FetchDatasetAsync(DatasetDiscoveryMetadata dataset, CancellationToken cancellationToken = default)
Parameters
datasetDatasetDiscoveryMetadatacancellationTokenCancellationToken
Returns
FetchSupportFileAsync(SupportFileDiscoveryMetadata, CancellationToken)
Fetches the content of a support file referenced by the catalogue.
public Task<Stream> FetchSupportFileAsync(SupportFileDiscoveryMetadata supportFile, CancellationToken cancellationToken = default)
Parameters
supportFileSupportFileDiscoveryMetadatacancellationTokenCancellationToken
Returns
NormalizeFileName(string)
Normalizes a catalogue-declared file name into a source-relative path:
strips the file:/ (or relative file:) URI prefix, converts Windows-style
backslash separators to forward slashes, and removes any leading
slashes (which S-100 catalogues occasionally use to denote
"from the exchange set root" but which would otherwise be treated
as an absolute path by the underlying asset source).
public static string NormalizeFileName(string fileName)
Parameters
fileNamestring
Returns
Remarks
S-100 Edition 5.2.1 Part 17.
OpenAsync(IAssetSource, string, CancellationToken)
Opens an ExchangeSet by reading the catalogue from the given source.
public static Task<ExchangeSet> OpenAsync(IAssetSource source, string cataloguePath = "CATALOG.XML", CancellationToken cancellationToken = default)
Parameters
sourceIAssetSourceThe asset source containing the exchange set.
cataloguePathstringThe relative path to the catalogue XML file within the source.
cancellationTokenCancellationTokenA cancellation token.
Returns
ResolveRelativePath(string?, string)
Resolves the source-relative path of a catalogue entry from its
optional filePath directory and its fileName.
public static string ResolveRelativePath(string? filePath, string fileName)
Parameters
filePathstringThe directory of the file relative to the exchange set root, as declared by the catalogue's
filePathelement. May be null, empty, Windows-separated, or carry a leading slash. When absent, the file is assumed to live at the root (or thefileNameitself carries the path).fileNamestringThe catalogue-declared file name.
Returns
- string
A normalized, forward-slashed, root-relative path.
Remarks
S-100 Edition 5.2.1 Part 17. Some producers (e.g. UKHO S-101,
NOAA S-102) place datasets in sub-directories and declare the
directory separately via filePath while fileName
carries only the bare file name; others fold the whole path into
fileName. Both forms resolve here.