GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
ExplicitNullYamlEventEmitter.cs
1// =============================================================================
2// GPAL - Generally Positive Automation Library
3// Copyright © 2026 Software Decisions, Inc. All rights reserved.
4//
5// This file is part of GPAL.
6// Licensed under the Business Source License 1.1
7//
8// Primary development, architecture, and vision by Michael B. Vederman,
9// CEO of Software Decisions, Inc., Texas.
10//
11// Internal development maintained privately.
12// Public releases appear on GitHub: https://github.com/SoftwareDecisionsInc/GPAL.
13//
14// See LICENSE for full terms, including Additional Use Grant.
15// =============================================================================
16
17using YamlDotNet.Core;
18using YamlDotNet.Core.Events;
19using YamlDotNet.Serialization;
20using YamlDotNet.Serialization.EventEmitters;
21
22public class ExplicitNullYamlEventEmitter : ChainedEventEmitter
23{
24 public ExplicitNullYamlEventEmitter(IEventEmitter nextEmitter) : base(nextEmitter) { }
25
26 public override void Emit(ScalarEventInfo eventInfo, IEmitter emitter)
27 {
28 if (eventInfo.Source.Value == null)
29 {
30 // Emit quoted "null" string instead of blank or ~
31 // emitter.Emit(new Scalar(null, null, "null", ScalarStyle.DoubleQuoted, true, false));
32 emitter.Emit(new Scalar("null"));
33 return;
34 }
35
36 base.Emit(eventInfo, emitter);
37 }
38}