From fff0463c4186b13147426e636d583842c6cbcb72 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Sun, 22 Dec 2024 23:11:41 +0100 Subject: [PATCH] Added HarmonyX version to ModTek log headers. Small code formatting. --- ModTek/Features/Logging/AppenderFile.cs | 2 +- ModTek/Features/Logging/FastBuffer.cs | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ModTek/Features/Logging/AppenderFile.cs b/ModTek/Features/Logging/AppenderFile.cs index bbb9250..1925d36 100644 --- a/ModTek/Features/Logging/AppenderFile.cs +++ b/ModTek/Features/Logging/AppenderFile.cs @@ -23,7 +23,7 @@ internal AppenderFile(string path, AppenderSettings settings) MTLoggerMessageDto.GetTimings(out var stopwatchTimestamp, out var dateTime, out var unityStartupTime); Write( $""" - ModTek v{GitVersionInformation.InformationalVersion} ({GitVersionInformation.CommitDate}) + ModTek v{GitVersionInformation.InformationalVersion} ({GitVersionInformation.CommitDate}) ; HarmonyX {typeof(Harmony).Assembly.GetName().Version} {Environment.OSVersion} ; BattleTech {Application.version} ; Unity {Application.unityVersion} ; CLR {Environment.Version} ; {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}" {dateTime.ToLocalTime().ToString("o", CultureInfo.InvariantCulture)} ; Startup {unityStartupTime.ToString(null, CultureInfo.InvariantCulture)} ; Ticks {stopwatchTimestamp} {new string('-', 80)} diff --git a/ModTek/Features/Logging/FastBuffer.cs b/ModTek/Features/Logging/FastBuffer.cs index 9d17370..1109ed1 100644 --- a/ModTek/Features/Logging/FastBuffer.cs +++ b/ModTek/Features/Logging/FastBuffer.cs @@ -100,7 +100,7 @@ internal void Append(string value) SetAscii(positionIterPtr, charsIterPtr, 5, out var a5); SetAscii(positionIterPtr, charsIterPtr, 6, out var a6); SetAscii(positionIterPtr, charsIterPtr, 7, out var a7); - if ( + if (!( a0 && a1 && a2 && @@ -109,13 +109,10 @@ internal void Append(string value) a5 && a6 && a7 - ) { - _length += IterSize; - } - else - { + )) { goto Utf8Fallback; } + _length += IterSize; positionIterPtr = _bufferPtr + _length; charsIterPtr += IterSize; } @@ -127,16 +124,13 @@ internal void Append(string value) { SetAscii(positionIterPtr, charsIterPtr, 0, out var a0); SetAscii(positionIterPtr, charsIterPtr, 1, out var a1); - if ( + if (!( a0 && a1 - ) { - _length += IterSize; - } - else - { + )) { goto Utf8Fallback; } + _length += IterSize; positionIterPtr = _bufferPtr + _length; charsIterPtr += IterSize; } @@ -146,14 +140,11 @@ internal void Append(string value) { const int IterSize = 1; SetAscii(positionIterPtr, charsIterPtr, 0, out var a0); - if (a0) - { - _length += IterSize; - } - else + if (!a0) { goto Utf8Fallback; } + _length += IterSize; } return;