Class ConsoleLineClassifier
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
What a console line is about: its severity, and whether it is chat, a player event, or the app.
public static class ConsoleLineClassifier
- Inheritance
-
ConsoleLineClassifier
- Inherited Members
Remarks
The order matters, and it runs from what is certain to what is inferred. The source is certain — the app knows when it is the one talking, and the operating system knows what came out of standard error. Only the server's standard output has to be read, and only then is a mistake possible.
This is why the app's own messages are tagged where they are raised instead of being recognised
here: their text is localized, prefixes and all — [Launcher], [Error] and
[Players] live inside the resx values and are translated with them. A classifier keyed on
those markers would work in Spanish and quietly stop working in German.
Methods
Classify(string, ConsoleSource)
What a line is about, given where it came from.
public static ConsoleLineKind Classify(string text, ConsoleSource source)
Parameters
textstringsourceConsoleSource
Returns
NameBefore(string, string)
Extracts the player name right before a marker, from a real log entry only.
public static string? NameBefore(string line, string marker)
Parameters
Returns
Remarks
The name must be the only text between the log prefix and the marker, and a valid
Minecraft name. That is what stops <Bob> Alice joined the game — Bob typing the
sentence in chat — from counting as Alice joining.
Lives here rather than in the view model that used to own it, because two things now need it and both were carrying their own copy of the same regex: the player list, and this. Fixing a misread name in one of them and not the other is exactly the kind of drift that is invisible until somebody's name stops working.