From dd97c60725d64608476aca45c23cb89046972db8 Mon Sep 17 00:00:00 2001 From: Nekromateion <43814053+Nekromateion@users.noreply.github.com> Date: Sun, 1 Sep 2024 10:39:28 +0200 Subject: [PATCH] Add instance reset and vote kick log game log events (#894) * Add instance reset game log event * Parse vote kick output log lines --- Dotnet/LogWatcher.cs | 62 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/Dotnet/LogWatcher.cs b/Dotnet/LogWatcher.cs index cac30f01..5934ea7f 100644 --- a/Dotnet/LogWatcher.cs +++ b/Dotnet/LogWatcher.cs @@ -256,7 +256,10 @@ namespace VRCX ParseLogStringDownload(fileInfo, logContext, line, offset) || ParseLogImageDownload(fileInfo, logContext, line, offset) || ParseVoteKick(fileInfo, logContext, line, offset) || - ParseFailedToJoin(fileInfo, logContext, line, offset)) + ParseFailedToJoin(fileInfo, logContext, line, offset) || + ParseInstanceResetWarning(fileInfo, logContext, line, offset) || + ParseVoteKickInitiation(fileInfo, logContext, line, offset) || + ParseVoteKickSuccess(fileInfo, logContext, line, offset)) { } } @@ -1190,6 +1193,63 @@ namespace VRCX return true; } + private bool ParseInstanceResetWarning(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 2024.08.30 01:43:40 Log - [ModerationManager] This instance will be reset in 60 minutes due to its age. + if (!line.Contains("[ModerationManager] This instance will be reset in ")) + return false; + + int index = line.IndexOf("[ModerationManager] This instance will be reset in ") + 20; + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "event", + line[index..] + }); + + return true; + } + + private bool ParseVoteKickInitiation(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 2024.08.29 02:04:47 Log - [ModerationManager] A vote kick has been initiated against בורקס במאווררים 849d, do you agree? + if (!line.Contains("[ModerationManager] A vote kick has been initiated against ")) + return false; + + int index = line.IndexOf("[ModerationManager] A vote kick has been initiated against ") + 20; + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "event", + line[index..] + }); + + return true; + } + + private bool ParseVoteKickSuccess(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 2024.08.29 02:05:21 Log - [ModerationManager] Vote to kick בורקס במאווררים 849d succeeded + if (!line.Contains("[ModerationManager] Vote to kick ")) + return false; + + int index = line.IndexOf("[ModerationManager] Vote to kick ") + 20; + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "event", + line[index..] + }); + + return true; + } + public string[][] Get() { Update();