From 733363547f72cef8e45f419e8cc1c25279e0640a Mon Sep 17 00:00:00 2001 From: Alexander Ivanov <11728682+nahk-ivanov@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:01:42 -0700 Subject: [PATCH] Address comments --- YamlDotNet/Core/EmitterSettings.cs | 32 +++++++++---------- .../Serialization/StaticSerializerBuilder.cs | 3 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/YamlDotNet/Core/EmitterSettings.cs b/YamlDotNet/Core/EmitterSettings.cs index 4cf5feec..57ee975d 100644 --- a/YamlDotNet/Core/EmitterSettings.cs +++ b/YamlDotNet/Core/EmitterSettings.cs @@ -78,7 +78,7 @@ public EmitterSettings() { } - public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxSimpleKeyLength, bool skipAnchorName = false, bool indentSequences = false, bool useUtf16SurrogatePairs = false, string? newLine = null) + public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxSimpleKeyLength, bool skipAnchorName = false, bool indentSequences = false, string? newLine = null, bool useUtf16SurrogatePairs = false) { if (bestIndent < 2 || bestIndent > 9) { @@ -101,8 +101,8 @@ public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxS MaxSimpleKeyLength = maxSimpleKeyLength; SkipAnchorName = skipAnchorName; IndentSequences = indentSequences; - UseUtf16SurrogatePairs = useUtf16SurrogatePairs; NewLine = newLine ?? Environment.NewLine; + UseUtf16SurrogatePairs = useUtf16SurrogatePairs; } public EmitterSettings WithBestIndent(int bestIndent) @@ -114,8 +114,8 @@ public EmitterSettings WithBestIndent(int bestIndent) MaxSimpleKeyLength, SkipAnchorName, IndentSequences, - UseUtf16SurrogatePairs, - NewLine + NewLine, + UseUtf16SurrogatePairs ); } @@ -128,8 +128,8 @@ public EmitterSettings WithBestWidth(int bestWidth) MaxSimpleKeyLength, SkipAnchorName, IndentSequences, - UseUtf16SurrogatePairs, - NewLine + NewLine, + UseUtf16SurrogatePairs ); } @@ -142,8 +142,8 @@ public EmitterSettings WithMaxSimpleKeyLength(int maxSimpleKeyLength) maxSimpleKeyLength, SkipAnchorName, IndentSequences, - UseUtf16SurrogatePairs, - NewLine + NewLine, + UseUtf16SurrogatePairs ); } @@ -156,8 +156,8 @@ public EmitterSettings WithNewLine(string newLine) MaxSimpleKeyLength, SkipAnchorName, IndentSequences, - UseUtf16SurrogatePairs, - newLine + newLine, + UseUtf16SurrogatePairs ); } @@ -181,8 +181,8 @@ public EmitterSettings WithoutAnchorName() MaxSimpleKeyLength, true, IndentSequences, - UseUtf16SurrogatePairs, - NewLine + NewLine, + UseUtf16SurrogatePairs ); } @@ -195,8 +195,8 @@ public EmitterSettings WithIndentedSequences() MaxSimpleKeyLength, SkipAnchorName, true, - UseUtf16SurrogatePairs, - NewLine + NewLine, + UseUtf16SurrogatePairs ); } @@ -209,8 +209,8 @@ public EmitterSettings WithUtf16SurrogatePairs() MaxSimpleKeyLength, SkipAnchorName, IndentSequences, - true, - NewLine + NewLine, + true ); } } diff --git a/YamlDotNet/Serialization/StaticSerializerBuilder.cs b/YamlDotNet/Serialization/StaticSerializerBuilder.cs index 4c165fbc..76726701 100644 --- a/YamlDotNet/Serialization/StaticSerializerBuilder.cs +++ b/YamlDotNet/Serialization/StaticSerializerBuilder.cs @@ -370,7 +370,8 @@ public StaticSerializerBuilder JsonCompatible() { this.emitterSettings = this.emitterSettings .WithMaxSimpleKeyLength(int.MaxValue) - .WithoutAnchorName(); + .WithoutAnchorName() + .WithUtf16SurrogatePairs(); return this .WithTypeConverter(new GuidConverter(true), w => w.InsteadOf())