mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Nuget package updates
- Newtonsoft.Json - changed arkdata code to only check NON STEAM players 10 times, then stop.
This commit is contained in:
parent
e069ecdfe7
commit
e5327ac946
13 changed files with 35 additions and 24 deletions
|
|
@ -58,12 +58,13 @@ namespace ArkData
|
|||
/// <param name="apiKey">The Steam API key</param>
|
||||
public DateTime LoadSteam(string apiKey, int steamUpdateInterval = 0)
|
||||
{
|
||||
const int MAX_STEAM_IDS = 100;
|
||||
|
||||
// need to make multiple calls of 100 steam id's.
|
||||
var lastSteamUpdateUtc = DateTime.UtcNow;
|
||||
var startIndex = 0;
|
||||
var playerSteamIds = Players.Where(p => p.LastPlatformUpdateUtc.AddMinutes(steamUpdateInterval) < DateTime.UtcNow).Select(p => p.PlayerId);
|
||||
var playerSteamIds = Players
|
||||
.Where(p => p.LastPlatformUpdateUtc.AddMinutes(steamUpdateInterval) < DateTime.UtcNow && p.NoUpdateCount < MAX_INVALID_COUNT)
|
||||
.Select(p => p.PlayerId)
|
||||
.ToArray();
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -76,7 +77,7 @@ namespace ArkData
|
|||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.BaseAddress = new System.Uri("https://api.steampowered.com/");
|
||||
client.BaseAddress = new Uri("https://api.steampowered.com/");
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ namespace ArkData
|
|||
if (response.IsSuccessStatusCode)
|
||||
using (var reader = new StreamReader(response.Content.ReadAsStreamAsync().Result))
|
||||
{
|
||||
LinkSteamProfiles(reader.ReadToEnd(), lastSteamUpdateUtc);
|
||||
LinkSteamProfiles(reader.ReadToEnd(), lastSteamUpdateUtc, playerSteamIds);
|
||||
}
|
||||
else
|
||||
throw new System.Net.WebException("The Steam API request was unsuccessful. Are you using a valid key?");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue