// 定義變量存儲最新登錄信息
string latestLoginUser = string.Empty;
// 解析用戶信息,這里簡單地從消息中提取用戶名
// 不同系統的事件消息格式可能略有不同,需根據實際情況調整解析邏輯
string message = entry.Message;
int startIndex = message.IndexOf("user name: ") + "user name: ".Length;
int endIndex = message.IndexOf(Environment.NewLine, startIndex);
if (startIndex > 0 && endIndex > startIndex)
{
latestLoginUser = message.Substring(startIndex, endIndex - startIndex).Trim();
}