Class NotificationCatalog
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
What each kind of notification looks like: its level, and the emoji that identifies it.
public static class NotificationCatalog
- Inheritance
-
NotificationCatalog
- Inherited Members
Remarks
Built like ServerTypeCatalog, and for the same reason: the table holds data and nothing from any UI framework, so it can be read by a test, and adding a kind is a row rather than an edit in three files. The colours themselves are not here — they are a user setting, and live in NotificationSettings.
Emoji rather than an icon font, exactly as in FamilyEmoji(ServerFamily): the point of the marks is that "somebody joined" and "the server crashed" can be told apart without reading, and shape does that where colour alone leaves out anybody who cannot separate red from green. There is also a practical reason — a toast is built in code, and the headless test harness cannot create the icon typeface at all.
Fields
All
Every kind, with its level and mark.
public static readonly IReadOnlyList<NotificationCatalog.Entry> All
Field Value
Remarks
The levels answer one question: is the server serving players, or is it not? Green when it is (somebody arrived, it woke up), grey when nothing changed either way (somebody left or died), amber when it is down on purpose, red when it is down and did not mean to be. The escalation from amber to red is the one worth having: a server that stopped itself because nobody was on it and a server that crashed are both "not running", and they need completely different reactions.
The marks are written as escapes rather than pasted in, the same convention the server-type emoji follow: an emoji in a source file survives a careless encoding change far less well than six characters of ASCII, and this file is read by tests that compare exact strings.
Methods
EmojiOf(NotificationKind)
The mark shown beside a kind.
public static string EmojiOf(NotificationKind kind)
Parameters
kindNotificationKind
Returns
For(NotificationKind)
The entry for a kind. Falls back to a neutral one rather than throwing.
public static NotificationCatalog.Entry For(NotificationKind kind)
Parameters
kindNotificationKind
Returns
Remarks
A notification that cannot be styled is still a notification worth showing: refusing to
display "the server crashed" because nobody added it to this table would be the worst
possible trade. EveryKindIsInTheCatalogue is what stops it silently coming to that.
LevelOf(NotificationKind)
The level a kind is shown at.
public static NotificationLevel LevelOf(NotificationKind kind)
Parameters
kindNotificationKind