mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
29 lines
768 B
C#
29 lines
768 B
C#
using YamlDotNet.Core;
|
|
using YamlDotNet.Core.Events;
|
|
|
|
namespace Robust.Shared.Serialization
|
|
{
|
|
/// <summary>
|
|
/// TODO: This fix exists because of https://github.com/aaubry/YamlDotNet/issues/409.
|
|
/// Credit: https://stackoverflow.com/a/56452440
|
|
/// </summary>
|
|
public sealed class YamlMappingFix : IEmitter
|
|
{
|
|
private readonly IEmitter _next;
|
|
|
|
public YamlMappingFix(IEmitter next)
|
|
{
|
|
_next = next;
|
|
}
|
|
|
|
public void Emit(ParsingEvent @event)
|
|
{
|
|
if (@event is MappingStart mapping)
|
|
{
|
|
@event = new MappingStart(mapping.Anchor, mapping.Tag, false, mapping.Style, mapping.Start, mapping.End);
|
|
}
|
|
_next.Emit(@event);
|
|
}
|
|
}
|
|
}
|