Table of Contents

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

source IAssetSource

The asset source used to fetch referenced files.

catalogue ExchangeCatalogue

The parsed exchange catalogue.

Properties

Catalogue

Gets the parsed exchange catalogue metadata.

public ExchangeCatalogue Catalogue { get; }

Property Value

ExchangeCatalogue

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

IAssetSource

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

catalogueFile CatalogueDiscoveryMetadata
cancellationToken CancellationToken

Returns

Task<Stream>

FetchDatasetAsync(DatasetDiscoveryMetadata, CancellationToken)

Fetches the content of a dataset file referenced by the catalogue.

public Task<Stream> FetchDatasetAsync(DatasetDiscoveryMetadata dataset, CancellationToken cancellationToken = default)

Parameters

dataset DatasetDiscoveryMetadata
cancellationToken CancellationToken

Returns

Task<Stream>

FetchSupportFileAsync(SupportFileDiscoveryMetadata, CancellationToken)

Fetches the content of a support file referenced by the catalogue.

public Task<Stream> FetchSupportFileAsync(SupportFileDiscoveryMetadata supportFile, CancellationToken cancellationToken = default)

Parameters

supportFile SupportFileDiscoveryMetadata
cancellationToken CancellationToken

Returns

Task<Stream>

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

fileName string

Returns

string

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

source IAssetSource

The asset source containing the exchange set.

cataloguePath string

The relative path to the catalogue XML file within the source.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<ExchangeSet>

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

filePath string

The directory of the file relative to the exchange set root, as declared by the catalogue's filePath element. May be null, empty, Windows-separated, or carry a leading slash. When absent, the file is assumed to live at the root (or the fileName itself carries the path).

fileName string

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