mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
24 lines
802 B
C#
24 lines
802 B
C#
using Content.Shared.Database;
|
|
using Robust.Shared.Network;
|
|
|
|
namespace Content.Server.Connection;
|
|
|
|
/// <summary>
|
|
/// Helper functions for working with <see cref="NetUserData"/>.
|
|
/// </summary>
|
|
public static class UserDataExt
|
|
{
|
|
/// <summary>
|
|
/// Get the preferred HWID that should be used for new records related to a player.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Players can have zero or more HWIDs, but for logging things like connection logs we generally
|
|
/// only want a single one. This method returns a nullable method.
|
|
/// </remarks>
|
|
public static ImmutableTypedHwid? GetModernHwid(this NetUserData userData)
|
|
{
|
|
return userData.ModernHWIds.Length == 0
|
|
? null
|
|
: new ImmutableTypedHwid(userData.ModernHWIds[0], HwidType.Modern);
|
|
}
|
|
}
|