Added extension for grabbing multiplayer player count for features

dashboard
Pat Hartl 2023-01-14 15:11:16 -06:00
parent 97c32895da
commit ae6cd7f906
1 changed files with 26 additions and 0 deletions

View File

@ -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 "";
}
}
}