using System; using Gallium; using Nitride.Contents; using YamlDotNet.Serialization; namespace Nitride.Yaml; public static class NitrideYamlEntityExtensions { /// /// Parses the entity text as a YAML file and returns the results. /// public static TType? GetYaml( this Entity entity, Action? configure = null) { DeserializerBuilder builder = new(); configure?.Invoke(builder); IDeserializer deserializer = builder.Build(); return entity.GetYaml(deserializer); } /// /// Parses the entity text as a YAML file and returns the results. /// public static TType? GetYaml( this Entity entity, IDeserializer deserializer) { if (!entity.TryGet(out ITextContent content)) { return default; } string text = content.GetText(); return deserializer.Deserialize(text); } }