Add another useful json helper

This commit is contained in:
Łukasz Domeradzki
2025-03-08 15:00:38 +01:00
parent a478c02967
commit ebc4601ed4
3 changed files with 7 additions and 3 deletions

View File

@@ -26,7 +26,6 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Nodes;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.Helpers.Json;
@@ -50,7 +49,7 @@ internal sealed class Bot {
throw new InvalidOperationException(nameof(constructor));
}
JsonElement emptyObject = new JsonObject().ToJsonElement();
JsonObject emptyObject = new();
BotConfig? botConfig = emptyObject.ToJsonObject<BotConfig>();

View File

@@ -81,7 +81,7 @@ internal sealed class MobileAuthenticator {
["shared_secret"] = sharedSecret
};
Steam.Security.MobileAuthenticator? result = jsonObject.ToJsonElement().ToJsonObject<Steam.Security.MobileAuthenticator>();
Steam.Security.MobileAuthenticator? result = jsonObject.ToJsonObject<Steam.Security.MobileAuthenticator>();
if (result == null) {
throw new InvalidOperationException(nameof(result));