Added Server.Tags

This commit is contained in:
Garry Newman 2019-05-08 12:28:47 +01:00
parent cf458a515a
commit f8798f2f4e

View File

@ -22,12 +22,33 @@ public struct ServerInfo
public bool Secure { get; set; } public bool Secure { get; set; }
public uint LastTimePlayed { get; set; } public uint LastTimePlayed { get; set; }
public int Version { get; set; } public int Version { get; set; }
public string Tags { get; set; } public string TagString { get; set; }
public ulong SteamId { get; set; } public ulong SteamId { get; set; }
public IPAddress Address { get; set; } public IPAddress Address { get; set; }
public int ConnectionPort { get; set; } public int ConnectionPort { get; set; }
public int QueryPort { get; set; } public int QueryPort { get; set; }
string[] _tags;
/// <summary>
/// Gets the individual tags for this server
/// </summary>
public string[] Tags
{
get
{
if ( _tags == null )
{
if ( !string.IsNullOrEmpty( TagString ) )
{
_tags = TagString.Split( ',' );
}
}
return _tags;
}
}
internal static ServerInfo From( gameserveritem_t item ) internal static ServerInfo From( gameserveritem_t item )
{ {
return new ServerInfo() return new ServerInfo()
@ -48,7 +69,7 @@ internal static ServerInfo From( gameserveritem_t item )
Secure = item.Secure, Secure = item.Secure,
LastTimePlayed = item.TimeLastPlayed, LastTimePlayed = item.TimeLastPlayed,
Version = item.ServerVersion, Version = item.ServerVersion,
Tags = item.GameTags, TagString = item.GameTags,
SteamId = item.SteamID SteamId = item.SteamID
}; };
} }