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
ageTimeSpanThe age.
Returns
Bytes(long)
A byte count for display, e.g. 1.6 MB.
public static string Bytes(long bytes)
Parameters
byteslongThe byte count.
Returns
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
valuedoubleThe value in decimal degrees.
positivecharThe hemisphere letter for a positive value.
negativecharThe hemisphere letter for a negative value.
degreeWidthintThe digits the degrees are padded to (2 for latitude, 3 for longitude).
Returns
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
Returns
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
feedUriUriThe feed URL.
Returns
PackageTitle(string)
A community-list package's description without its leading timestamp ("23.10.2025 15:17 - …").
public static string PackageTitle(string title)
Parameters
titlestringThe package's title.
Returns
Product(CollectionItem)
"S-57 · ENC cell", "S-101 · Electronic Navigational Chart (2.0.0)".
public static string Product(CollectionItem item)
Parameters
itemCollectionItemThe item.
Returns
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
keystringThe property key.
Returns
Run(DateTimeOffset)
A forecast run time in UTC: the culture's short date and HH:mmZ.
public static string Run(DateTimeOffset time)
Parameters
timeDateTimeOffsetThe run time.
Returns
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
timeDateTimeOffsetThe run time.
formatLibraryTimeFormatWhether to show local time or UTC.
zoneTimeZoneInfoThe user's time zone.
Returns
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
minimumint?The minimum display scale denominator.
maximumint?The maximum display scale denominator.
Returns
ShortUrl(Uri)
"ienccloud.us · U37IL257.zip": the host and file of a download URL.
public static string ShortUrl(Uri uri)
Parameters
uriUriThe URL.
Returns
TimeLeft(DateTimeOffset, DateTimeOffset)
"39 h left", or "Ended 9 h ago".
public static string TimeLeft(DateTimeOffset end, DateTimeOffset now)
Parameters
endDateTimeOffsetThe end of the window.
nowDateTimeOffsetThe current time.
Returns
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
spanTimeSpanThe time left.
Returns
When(DateTimeOffset)
The time when when is today (local), else the date.
public static string When(DateTimeOffset when)
Parameters
whenDateTimeOffsetThe local time.