Class ExternalTextFileResolver
Resolves the textual content of an externally referenced text file (named
by an S-100 fileReference attribute — S-101 Feature Catalogue, alias
TXTDSC / NTXTDS) from the dataset's exchange-set
IAssetSource. When the exchange-set catalogue's
supportFileDiscoveryMetadata is supplied, the referenced file is
located through it first (the canonical ECDIS mechanism); otherwise the
file is looked up relative to the dataset's own directory, then at the
exchange-set root, then under a sibling SUPPORT_FILES /
support directory (the S100_ROOT exchange-set layout).
public sealed class ExternalTextFileResolver
- Inheritance
-
ExternalTextFileResolver
- Inherited Members
Remarks
Resolution is synchronous because the pick / object-info path that consumes
it is synchronous; support text files are small and the underlying
FileSystemAssetSource / ZipAssetSource reads are memory-backed
(no network I/O), so the awaiter-result bridge is bounded.
Content is decoded as UTF-8 when valid, otherwise as ISO/IEC 8859-1
(Latin-1), which is the legacy character set most S-57/S-101 producers use
for support text files. Missing, oversized, or unreadable files resolve to
null so the pick report keeps showing the bare file name.
Constructors
ExternalTextFileResolver(IAssetSource, string?, IReadOnlyDictionary<string, string>?)
Initializes a new ExternalTextFileResolver.
public ExternalTextFileResolver(IAssetSource source, string? datasetRelativePath = null, IReadOnlyDictionary<string, string>? supportFiles = null)
Parameters
sourceIAssetSourceThe asset source backing the dataset's exchange set (folder or ZIP).
datasetRelativePathstringThe source-relative path of the dataset whose features carry the file references; its directory is used as the primary lookup location. May be
nullor a bare file name, in which case only the exchange-set root is searched.supportFilesIReadOnlyDictionary<string, string>Optional map of support-file name (case-insensitive) to its source-relative path, as declared by the exchange-set catalogue's
supportFileDiscoveryMetadata(S-100 Edition 5.2.1 Part 17). When supplied, a referenced file is located via the catalogue first — the canonical ECDIS mechanism — before falling back to directory probing.
Fields
MaxFileSizeBytes
Upper bound on the size of a referenced text file that will be read into memory. Support text files are short; anything larger is treated as unresolvable to bound the cost of a pick gesture.
public const long MaxFileSizeBytes = 4194304
Field Value
Methods
AsDelegate()
Returns a Func<T, TResult> view of this resolver, suitable for passing to ResolveFileReferences(IReadOnlyList<PickAttribute>, Func<string, string?>).
public Func<string, string?> AsDelegate()
Returns
Resolve(string)
Resolves the textual content of the file named fileName,
or null when it cannot be located or read within the size bound.
public string? Resolve(string fileName)
Parameters
fileNamestring