mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 20:35:29 +00:00
24 lines
606 B
C#
24 lines
606 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace PckStudio.Core.Extensions
|
|
{
|
|
internal static class JObjectExtensions
|
|
{
|
|
public static bool TryGetValue<T>(this JObject jObject, string propertyName, out T value)
|
|
{
|
|
if (!jObject.TryGetValue(propertyName, out JToken token))
|
|
{
|
|
value = default;
|
|
return false;
|
|
}
|
|
value = token.ToObject<T>() ?? default;
|
|
return value is T;
|
|
}
|
|
}
|
|
}
|