From f8798f2f4e5c29aee144fd3cea6fc037f11bb4c5 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 8 May 2019 12:28:47 +0100 Subject: [PATCH] Added Server.Tags --- Facepunch.Steamworks/Structs/Server.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Facepunch.Steamworks/Structs/Server.cs b/Facepunch.Steamworks/Structs/Server.cs index 5fa87fb..0c470d5 100644 --- a/Facepunch.Steamworks/Structs/Server.cs +++ b/Facepunch.Steamworks/Structs/Server.cs @@ -22,12 +22,33 @@ public struct ServerInfo public bool Secure { get; set; } public uint LastTimePlayed { get; set; } public int Version { get; set; } - public string Tags { get; set; } + public string TagString { get; set; } public ulong SteamId { get; set; } public IPAddress Address { get; set; } public int ConnectionPort { get; set; } public int QueryPort { get; set; } + string[] _tags; + + /// + /// Gets the individual tags for this server + /// + public string[] Tags + { + get + { + if ( _tags == null ) + { + if ( !string.IsNullOrEmpty( TagString ) ) + { + _tags = TagString.Split( ',' ); + } + } + + return _tags; + } + } + internal static ServerInfo From( gameserveritem_t item ) { return new ServerInfo() @@ -48,7 +69,7 @@ internal static ServerInfo From( gameserveritem_t item ) Secure = item.Secure, LastTimePlayed = item.TimeLastPlayed, Version = item.ServerVersion, - Tags = item.GameTags, + TagString = item.GameTags, SteamId = item.SteamID }; }