From 94aeb3e754c32059bf465363e19f725183900af2 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 6 Aug 2022 19:15:23 -0400 Subject: [PATCH] implement boolean, and do not write anything if value is null --- Libraries/UniversalEditor.Core/IO/Writer.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Libraries/UniversalEditor.Core/IO/Writer.cs b/Libraries/UniversalEditor.Core/IO/Writer.cs index f909cdbf..0ca9ef2c 100644 --- a/Libraries/UniversalEditor.Core/IO/Writer.cs +++ b/Libraries/UniversalEditor.Core/IO/Writer.cs @@ -609,6 +609,9 @@ namespace UniversalEditor.IO /// The stream is closed. public void WriteObject(object value) { + if (value == null) + return; + if (value is object[]) { object[] array = (object[])value; @@ -621,7 +624,12 @@ namespace UniversalEditor.IO Type objectType = value.GetType(); - if (objectType == typeof(Byte)) + if (objectType == typeof(Boolean)) + { + WriteBoolean((bool)value); + return; + } + else if (objectType == typeof(Byte)) { WriteByte((byte)value); return;