Nuget package updates

- Newtonsoft.Json
- changed arkdata code to only check NON STEAM players 10 times, then stop.
This commit is contained in:
Brett Hewitson 2022-06-21 21:36:55 +10:00
parent e069ecdfe7
commit e5327ac946
13 changed files with 35 additions and 24 deletions

View file

@ -13,6 +13,9 @@ namespace ArkData
{
public partial class DataContainer
{
const int MAX_STEAM_IDS = 100;
const int MAX_INVALID_COUNT = 10;
/// <summary>
/// A list of all players registered on the server.
/// </summary>
@ -86,7 +89,7 @@ namespace ArkData
/// Deserializes JSON from Steam API and links Steam profile to player profile.
/// </summary>
/// <param name="jsonString">The JSON data string.</param>
private void LinkSteamProfiles(string jsonString, DateTime lastSteamUpdateUtc)
private void LinkSteamProfiles(string jsonString, DateTime lastSteamUpdateUtc, string[] playerSteamIds)
{
var profiles = JsonConvert.DeserializeObject<Models.SteamResponse<Models.SteamProfile>>(jsonString).response.players;
@ -96,6 +99,13 @@ namespace ArkData
player.PlayerName = profiles[i].personaname;
player.LastPlatformUpdateUtc = lastSteamUpdateUtc;
}
for (var i = 0; i < playerSteamIds.Length; i++)
{
var player = Players.SingleOrDefault(p => p.PlayerId == playerSteamIds[i]);
if (player != null && player.LastPlatformUpdateUtc == DateTime.MinValue)
player.NoUpdateCount = Math.Min(MAX_INVALID_COUNT, player.NoUpdateCount + 1);
}
}
}
}