diff --git a/LANCommander.Playnite.Extension/Extensions/MultiplayerInfoExtensions.cs b/LANCommander.Playnite.Extension/Extensions/MultiplayerInfoExtensions.cs new file mode 100644 index 0000000..ec4270f --- /dev/null +++ b/LANCommander.Playnite.Extension/Extensions/MultiplayerInfoExtensions.cs @@ -0,0 +1,26 @@ +using LANCommander.SDK; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LANCommander.PlaynitePlugin.Extensions +{ + internal static class MultiplayerInfoExtensions + { + internal static string GetPlayerCount(this MultiplayerInfo multiplayerInfo) + { + if (multiplayerInfo.MinPlayers == multiplayerInfo.MaxPlayers && multiplayerInfo.MinPlayers >= 2) + return $"({multiplayerInfo.MinPlayers} Players)"; + + if (multiplayerInfo.MinPlayers < multiplayerInfo.MaxPlayers && multiplayerInfo.MinPlayers >= 2) + return $"({multiplayerInfo.MinPlayers}-{multiplayerInfo.MaxPlayers} Players)"; + + if (multiplayerInfo.MinPlayers <= 1 && multiplayerInfo.MaxPlayers > 2) + return $"({multiplayerInfo.MaxPlayers} Players)"; + + return ""; + } + } +}