format all output for color keys
This commit is contained in:
parent
104d9bdc4c
commit
074e36413e
@ -80,6 +80,7 @@ namespace IW4MAdmin.Application.RConParsers
|
|||||||
|
|
||||||
public async Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command, CancellationToken token = default)
|
public async Task<string[]> ExecuteCommandAsync(IRConConnection connection, string command, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
|
command = command.FormatMessageForEngine(Configuration?.ColorCodeMapping);
|
||||||
var response = await connection.SendQueryAsync(StaticHelpers.QueryType.COMMAND, command, token);
|
var response = await connection.SendQueryAsync(StaticHelpers.QueryType.COMMAND, command, token);
|
||||||
return response.Where(item => item != Configuration.CommandPrefixes.RConResponse).ToArray();
|
return response.Where(item => item != Configuration.CommandPrefixes.RConResponse).ToArray();
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ namespace SharedLibraryCore
|
|||||||
public GameEvent Broadcast(string message, EFClient sender = null)
|
public GameEvent Broadcast(string message, EFClient sender = null)
|
||||||
{
|
{
|
||||||
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "",
|
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "",
|
||||||
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping)}");
|
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}");
|
||||||
ServerLogger.LogDebug("All-> {Message}",
|
ServerLogger.LogDebug("All-> {Message}",
|
||||||
message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping).StripColors());
|
message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping).StripColors());
|
||||||
|
|
||||||
@ -270,8 +270,6 @@ namespace SharedLibraryCore
|
|||||||
/// <param name="targetClient">EFClient to send message to</param>
|
/// <param name="targetClient">EFClient to send message to</param>
|
||||||
protected async Task Tell(string message, EFClient targetClient)
|
protected async Task Tell(string message, EFClient targetClient)
|
||||||
{
|
{
|
||||||
var engineMessage = message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping);
|
|
||||||
|
|
||||||
if (!Utilities.IsDevelopment)
|
if (!Utilities.IsDevelopment)
|
||||||
{
|
{
|
||||||
var temporalClientId = targetClient.GetAdditionalProperty<string>("ConnectionClientId");
|
var temporalClientId = targetClient.GetAdditionalProperty<string>("ConnectionClientId");
|
||||||
@ -280,7 +278,7 @@ namespace SharedLibraryCore
|
|||||||
|
|
||||||
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell,
|
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell,
|
||||||
clientNumber,
|
clientNumber,
|
||||||
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{engineMessage}");
|
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}");
|
||||||
if (targetClient.ClientNumber > -1 && message.Length > 0 &&
|
if (targetClient.ClientNumber > -1 && message.Length > 0 &&
|
||||||
targetClient.Level != Data.Models.Client.EFClient.Permission.Console)
|
targetClient.Level != Data.Models.Client.EFClient.Permission.Console)
|
||||||
{
|
{
|
||||||
@ -296,13 +294,14 @@ namespace SharedLibraryCore
|
|||||||
if (targetClient.Level == Data.Models.Client.EFClient.Permission.Console)
|
if (targetClient.Level == Data.Models.Client.EFClient.Permission.Console)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
|
var cleanMessage = message.FormatMessageForEngine(RconParser.Configuration.ColorCodeMapping)
|
||||||
|
.StripColors();
|
||||||
using (LogContext.PushProperty("Server", ToString()))
|
using (LogContext.PushProperty("Server", ToString()))
|
||||||
{
|
{
|
||||||
ServerLogger.LogInformation("Command output received: {Message}",
|
ServerLogger.LogInformation("Command output received: {Message}", cleanMessage);
|
||||||
engineMessage.StripColors());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(engineMessage.StripColors());
|
Console.WriteLine(cleanMessage);
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user