internal AllPlayersNode(string JSON) : base(JSON) { foreach (JToken jt in _ParsedData.Children()) { PlayerNode pn = new PlayerNode(jt.First.ToString()); pn._SteamID = jt.Value <JProperty>()?.Name ?? ""; _Players.Add(pn); } }
/// <summary> /// Retrieves a PlayerNode from all players based on player's steam ID /// </summary> /// <param name="SteamID">The steam ID of a player to find</param> /// <returns>A PlayerNode pertaining to the specified player</returns> public PlayerNode GetBySteamID(string SteamID) { PlayerNode pn = _Players.Find(x => x.SteamID == SteamID); if (pn != null) { return(pn); } return(new PlayerNode("")); }
/// <summary> /// Retrieves a PlayerNode from all players based on player's name /// </summary> /// <param name="Name">The name of the player to find</param> /// <returns>A PlayerNode pertaining to the specified player</returns> public PlayerNode GetByName(string Name) { PlayerNode pn = _Players.Find(x => x.Name == Name); if (pn != null) { return(pn); } return(new PlayerNode("")); }