mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Add UserId parsing on player joined or left (#943)
This commit is contained in:
+28
-4
@@ -455,6 +455,8 @@ namespace VRCX
|
|||||||
// 2021.12.12 11:47:22 Log - [Behaviour] OnPlayerJoined:Unnamed
|
// 2021.12.12 11:47:22 Log - [Behaviour] OnPlayerJoined:Unnamed
|
||||||
// 2021.12.12 11:53:14 Log - [Behaviour] OnPlayerLeftRoom
|
// 2021.12.12 11:53:14 Log - [Behaviour] OnPlayerLeftRoom
|
||||||
|
|
||||||
|
// Future logs will be formatted like this: [Behaviour] OnPlayerJoined Natsumi-sama (usr_032383a7-748c-4fb2-94e4-bcb928e5de6b)
|
||||||
|
|
||||||
if (line.Contains("[Behaviour] OnPlayerJoined") && !line.Contains("] OnPlayerJoined:"))
|
if (line.Contains("[Behaviour] OnPlayerJoined") && !line.Contains("] OnPlayerJoined:"))
|
||||||
{
|
{
|
||||||
var lineOffset = line.LastIndexOf("] OnPlayerJoined");
|
var lineOffset = line.LastIndexOf("] OnPlayerJoined");
|
||||||
@@ -464,14 +466,15 @@ namespace VRCX
|
|||||||
if (lineOffset > line.Length)
|
if (lineOffset > line.Length)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var userDisplayName = line.Substring(lineOffset);
|
var userInfo = ParseUserInfo(line.Substring(lineOffset));
|
||||||
|
|
||||||
AppendLog(new[]
|
AppendLog(new[]
|
||||||
{
|
{
|
||||||
fileInfo.Name,
|
fileInfo.Name,
|
||||||
ConvertLogTimeToISO8601(line),
|
ConvertLogTimeToISO8601(line),
|
||||||
"player-joined",
|
"player-joined",
|
||||||
userDisplayName
|
userInfo.DisplayName,
|
||||||
|
userInfo.UserId
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -486,14 +489,15 @@ namespace VRCX
|
|||||||
if (lineOffset > line.Length)
|
if (lineOffset > line.Length)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var userDisplayName = line.Substring(lineOffset);
|
var userInfo = ParseUserInfo(line.Substring(lineOffset));
|
||||||
|
|
||||||
AppendLog(new[]
|
AppendLog(new[]
|
||||||
{
|
{
|
||||||
fileInfo.Name,
|
fileInfo.Name,
|
||||||
ConvertLogTimeToISO8601(line),
|
ConvertLogTimeToISO8601(line),
|
||||||
"player-left",
|
"player-left",
|
||||||
userDisplayName
|
userInfo.DisplayName,
|
||||||
|
userInfo.UserId
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1285,6 +1289,26 @@ namespace VRCX
|
|||||||
return new string[][] { };
|
return new string[][] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static (string DisplayName, string UserId) ParseUserInfo(string userInfo)
|
||||||
|
{
|
||||||
|
string userDisplayName;
|
||||||
|
string userId;
|
||||||
|
|
||||||
|
int pos = userInfo.LastIndexOf(" (");
|
||||||
|
if (pos >= 0)
|
||||||
|
{
|
||||||
|
userDisplayName = userInfo.Substring(0, pos);
|
||||||
|
userId = userInfo.Substring(pos + 2, userInfo.LastIndexOf(')') - (pos + 3));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
userDisplayName = userInfo;
|
||||||
|
userId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (userDisplayName, userId);
|
||||||
|
}
|
||||||
|
|
||||||
private class LogContext
|
private class LogContext
|
||||||
{
|
{
|
||||||
public bool AudioDeviceChanged;
|
public bool AudioDeviceChanged;
|
||||||
|
|||||||
+1
-1
@@ -11245,7 +11245,7 @@ speechSynthesis.getVoices();
|
|||||||
var joinTime = Date.parse(gameLog.dt);
|
var joinTime = Date.parse(gameLog.dt);
|
||||||
var userMap = {
|
var userMap = {
|
||||||
displayName: gameLog.displayName,
|
displayName: gameLog.displayName,
|
||||||
userId,
|
userId : gameLog.userId,
|
||||||
joinTime,
|
joinTime,
|
||||||
lastAvatar: ''
|
lastAvatar: ''
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ class GameLogService {
|
|||||||
|
|
||||||
case 'player-joined':
|
case 'player-joined':
|
||||||
gameLog.displayName = args[0];
|
gameLog.displayName = args[0];
|
||||||
|
gameLog.userId = args[1];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'player-left':
|
case 'player-left':
|
||||||
gameLog.displayName = args[0];
|
gameLog.displayName = args[0];
|
||||||
|
gameLog.userId = args[1];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'notification':
|
case 'notification':
|
||||||
|
|||||||
Reference in New Issue
Block a user