Table of Contents

Class LibraryTextFormat

Namespace
EncDotNet.S100.Collections.Library
Assembly
EncDotNet.S100.Collections.dll

Formats the values the Library shows (sizes, positions, run times, ages, property labels, URLs) the same way in every host (#792).

public static class LibraryTextFormat
Inheritance
LibraryTextFormat
Inherited Members

Methods

Age(TimeSpan)

"12 min", "2 h", "3 days".

public static string Age(TimeSpan age)

Parameters

age TimeSpan

The age.

Returns

string

Bytes(long)

A byte count for display, e.g. 1.6 MB.

public static string Bytes(long bytes)

Parameters

bytes long

The byte count.

Returns

string

DegreesMinutes(double, char, char, int)

A latitude or longitude in degrees and decimal minutes, e.g. 37°48.500'N.

public static string DegreesMinutes(double value, char positive, char negative, int degreeWidth)

Parameters

value double

The value in decimal degrees.

positive char

The hemisphere letter for a positive value.

negative char

The hemisphere letter for a negative value.

degreeWidth int

The digits the degrees are padded to (2 for latitude, 3 for longitude).

Returns

string

LatLon(double, double)

A position in degrees and decimal minutes, e.g. 37°48.500'N 122°24.000'W.

public static string LatLon(double latitude, double longitude)

Parameters

latitude double

Latitude in decimal degrees.

longitude double

Longitude in decimal degrees.

Returns

string

MaskToken(Uri)

A shared feed's URL with its access token (the path before feed.json) masked to its last four characters: http://bridge-pc:8100/••••3f9a/feed.json.

public static string MaskToken(Uri feedUri)

Parameters

feedUri Uri

The feed URL.

Returns

string

PackageTitle(string)

A community-list package's description without its leading timestamp ("23.10.2025 15:17 - …").

public static string PackageTitle(string title)

Parameters

title string

The package's title.

Returns

string

Product(CollectionItem)

"S-57 · ENC cell", "S-101 · Electronic Navigational Chart (2.0.0)".

public static string Product(CollectionItem item)

Parameters

item CollectionItem

The item.

Returns

string

PropertyLabel(string)

A readable label for an item property key: curated, else the camelCase key split into words.

public static string PropertyLabel(string key)

Parameters

key string

The property key.

Returns

string

Run(DateTimeOffset)

A forecast run time in UTC: the culture's short date and HH:mmZ.

public static string Run(DateTimeOffset time)

Parameters

time DateTimeOffset

The run time.

Returns

string

Run(DateTimeOffset, LibraryTimeFormat, TimeZoneInfo)

A forecast run time as the user reads it: their Local/UTC setting (#730).

public static string Run(DateTimeOffset time, LibraryTimeFormat format, TimeZoneInfo zone)

Parameters

time DateTimeOffset

The run time.

format LibraryTimeFormat

Whether to show local time or UTC.

zone TimeZoneInfo

The user's time zone.

Returns

string

Scales(int?, int?)

"1:22,000 – 1:90,000", "≤ 1:90,000", "≥ 1:22,000", or null for neither.

public static string? Scales(int? minimum, int? maximum)

Parameters

minimum int?

The minimum display scale denominator.

maximum int?

The maximum display scale denominator.

Returns

string

ShortUrl(Uri)

"ienccloud.us · U37IL257.zip": the host and file of a download URL.

public static string ShortUrl(Uri uri)

Parameters

uri Uri

The URL.

Returns

string

TimeLeft(DateTimeOffset, DateTimeOffset)

"39 h left", or "Ended 9 h ago".

public static string TimeLeft(DateTimeOffset end, DateTimeOffset now)

Parameters

end DateTimeOffset

The end of the window.

now DateTimeOffset

The current time.

Returns

string

TimeLeft(TimeSpan)

"39 h left" (or days past 72 h), or "Ended 9 h ago" for a negative span.

public static string TimeLeft(TimeSpan span)

Parameters

span TimeSpan

The time left.

Returns

string

When(DateTimeOffset)

The time when when is today (local), else the date.

public static string When(DateTimeOffset when)

Parameters

when DateTimeOffset

The local time.

Returns

string