public static SteamUserList GetList(SteamUserDetailResponse response) { if (response == null) { return(new SteamUserList()); } var result = new SteamUserList(); if (response.players != null) { foreach (var detail in response.players) { result.Add(SteamUserItem.GetItem(detail)); } } return(result); }
public static SteamUserList GetList(SteamUserDetailResponse response, string[] steamIds) { var result = new SteamUserList(); if (steamIds != null) { foreach (var steamId in steamIds) { result.Add(new SteamUserItem() { SteamId = steamId, SteamName = "<not available>", ProfileUrl = string.Empty, }); } } if (response?.players != null) { foreach (var detail in response.players) { var item = result.FirstOrDefault(i => i.SteamId == detail.steamid); if (item == null) { result.Add(SteamUserItem.GetItem(detail)); } else { item.SteamId = detail.steamid; item.SteamName = detail.personaname ?? string.Empty; item.ProfileUrl = detail.profileurl ?? string.Empty; } } } return(result); }