Output formatting

This commit is contained in:
glax 2024-01-16 04:29:26 +01:00
parent 6a200dbb64
commit 23f9581383
3 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ public class CS2GSI
if (_lastLocalGameState is not null && _allGameStates.Count > 0)
{
List<ValueTuple<CS2Event, CS2EventArgs>> generatedEvents = CS2EventGenerator.GenerateEvents(_lastLocalGameState, newState, _allGameStates.Last());
this._logger?.Log(LogLevel.Information, $"Generated {generatedEvents.Count} events:\n\t{string.Join("\n\t", generatedEvents)}");
this._logger?.Log(LogLevel.Information, $"Generated {generatedEvents.Count} event{(generatedEvents.Count > 1 ? 's' : null)}:\n- {string.Join("\n- ", generatedEvents)}");
InvokeEvents(generatedEvents);
}
this._lastLocalGameState = newState.UpdateGameStateForLocal(_lastLocalGameState);

View File

@ -44,7 +44,7 @@ internal class GSIServer
StreamReader reader = new (request.InputStream, request.ContentEncoding);
string content = await reader.ReadToEndAsync();
this.logger?.Log(LogLevel.Debug, content);
this.logger?.Log(LogLevel.Debug, $"Message Content:\n{content}");
OnMessage?.Invoke(content);
}
HttpListener.Close();

View File

@ -12,7 +12,7 @@ public abstract record GameState
string filler = GetType().GetFields().Last() != field ? "\u251c\u2500" : "\u2514\u2500";
string filler2 = GetType().GetFields().Last() != field ? "\u2502" : " ";
if (field.FieldType.BaseType == typeof(GameState))
ret += $"\b{filler}\u2510{field.Name}\n{field.GetValue(this)?.ToString()?.Replace("\b", $"\b{filler2} ")}";
ret += $"\b{filler}\u2510 {field.Name}\n{field.GetValue(this)?.ToString()?.Replace("\b", $"\b{filler2} ")}";
else
ret += $"\b{filler} {field.Name}{new string('.', field.Name.Length > 25 ? 0 : 25-field.Name.Length)}{field.GetValue(this)}\n";
}