diff --git a/DTLib.Dtsod/DtsodV23.cs b/DTLib.Dtsod/DtsodV23.cs index 29cacda..7e411ae 100644 --- a/DTLib.Dtsod/DtsodV23.cs +++ b/DTLib.Dtsod/DtsodV23.cs @@ -280,7 +280,7 @@ public class DtsodV23 : DtsodDict, IDtsod internal static readonly Dictionary> TypeSerializeFuncs = new() { - { typeof(bool), (val, b) => b.Append(val.ToString()) }, + { typeof(bool), (val, b) => b.Append((bool)val ? "true" : "false") }, { typeof(char), (val, b) => b.Append('\'').Append(val).Append('\'') }, { typeof(string), (val, b) => b.Append('"').Append(val.Replace("\\","\\\\").Replace("\"", "\\\"")).Append('"') }, { typeof(byte), (val, b) => b.Append(val.ToString()).Append('b') }, @@ -318,12 +318,15 @@ public class DtsodV23 : DtsodDict, IDtsod else if (value is IList _list) { b.Append('['); - foreach (object el in _list) - { - SerializeType(el, ref tabscount); - b.Append(','); + if(_list.Count>0){ + foreach (object el in _list) + { + SerializeType(el, ref tabscount); + b.Append(','); + } + b.Remove(b.Length - 1, 1); } - b.Remove(b.Length - 1, 1).Append(']'); + b.Append(']'); } else TypeSerializeFuncs[value.GetType()].Invoke(value, b); }