Class MessageManager
Manages messages between multiple clients using a mapping file.
public sealed class MessageManager : IMessageManager
- Inheritance
-
MessageManager
- Implements
Constructors
MessageManager(string?, ILoggerFactory?)
Manages messages between multiple clients using a mapping file.
public MessageManager(string? filePath = null, ILoggerFactory? loggerFactory = null)
Parameters
filePath
stringloggerFactory
ILoggerFactory
Properties
Available
Gets whether message information is available.
public bool Available { get; }
Property Value
Fetch
Whether to fetch the message map file from the xabbo/messages GitHub repo upon initialization if it does not exist locally.
public bool Fetch { get; set; }
Property Value
MaxAge
The maximum age of the message map file after which it is invalidated.
public TimeSpan MaxAge { get; set; }
Property Value
Methods
Clear()
public void Clear()
InitializeAsync(CancellationToken)
Initializes the message manager.
public Task InitializeAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationToken
Returns
Is(Header, ReadOnlySpan<Identifier>)
Gets whether the header matches any of the specified identifiers.
public bool Is(Header header, ReadOnlySpan<Identifier> identifiers)
Parameters
header
Headeridentifiers
ReadOnlySpan<Identifier>
Returns
LoadMessages(IEnumerable<ClientMessage>)
Loads the specified client messages.
public void LoadMessages(IEnumerable<ClientMessage> messages)
Parameters
messages
IEnumerable<ClientMessage>
Resolve(ReadOnlySpan<Identifier>)
Resolves the specified identifiers to an array of headers.
public Headers Resolve(ReadOnlySpan<Identifier> identifiers)
Parameters
identifiers
ReadOnlySpan<Identifier>
Returns
Exceptions
- ArgumentException
If no identifiers were specified.
- UnresolvedIdentifiersException
If any of the identifiers could not be resolved.
Resolve(Identifier)
Resolves the specified identifier to a header.
public Header Resolve(Identifier identifier)
Parameters
identifier
Identifier
Returns
Exceptions
- UnresolvedIdentifiersException
If the identifier could not be resolved.
TryGetHeader(Identifier, out Header)
Attempts to get a header by its identifier.
public bool TryGetHeader(Identifier identifier, out Header header)
Parameters
identifier
Identifierheader
Header
Returns
TryGetNames(Header, out MessageNames)
Attempts to get the associated message names for the specified header.
public bool TryGetNames(Header header, out MessageNames identifiers)
Parameters
header
Headeridentifiers
MessageNames
Returns
TryGetNames(Identifier, out MessageNames)
Attempts to get the associated message names for the specified identifier.
public bool TryGetNames(Identifier identifier, out MessageNames names)
Parameters
identifier
Identifiernames
MessageNames
Returns
TryResolve(ReadOnlySpan<Identifier>, out Headers?, out Identifiers?)
Attempts to resolve the specified identifiers to an array of headers.
public bool TryResolve(ReadOnlySpan<Identifier> identifiers, out Headers? headers, out Identifiers? unresolved)
Parameters
identifiers
ReadOnlySpan<Identifier>headers
Headersunresolved
Identifiers
Returns
Exceptions
- ArgumentException
If no identifiers were specified.
Events
Loaded
Notifies listeners when messages have been loaded.
public event Action? Loaded