mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Misc
This commit is contained in:
@@ -34,7 +34,13 @@ internal sealed class GuidJsonConverter : JsonConverter<Guid> {
|
||||
internal static readonly GuidJsonConverter Shared = new();
|
||||
|
||||
public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) {
|
||||
if (reader.TryGetGuid(out Guid result)) {
|
||||
// Great, we can work with it
|
||||
return result;
|
||||
}
|
||||
|
||||
try {
|
||||
// Try again using more flexible implementation, sigh
|
||||
return Guid.Parse(reader.GetString()!);
|
||||
} catch {
|
||||
// Throw JsonException instead, which will be converted into standard message by STJ
|
||||
|
||||
Reference in New Issue
Block a user