fixed some DtsodV23 bugs, but there still more
This commit is contained in:
parent
55ef06e484
commit
9f07cc78e3
@ -280,7 +280,7 @@ public class DtsodV23 : DtsodDict<string, dynamic>, IDtsod
|
|||||||
|
|
||||||
internal static readonly Dictionary<Type, Action<dynamic, StringBuilder>> TypeSerializeFuncs = new()
|
internal static readonly Dictionary<Type, Action<dynamic, StringBuilder>> 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(char), (val, b) => b.Append('\'').Append(val).Append('\'') },
|
||||||
{ typeof(string), (val, b) => b.Append('"').Append(val.Replace("\\","\\\\").Replace("\"", "\\\"")).Append('"') },
|
{ typeof(string), (val, b) => b.Append('"').Append(val.Replace("\\","\\\\").Replace("\"", "\\\"")).Append('"') },
|
||||||
{ typeof(byte), (val, b) => b.Append(val.ToString()).Append('b') },
|
{ typeof(byte), (val, b) => b.Append(val.ToString()).Append('b') },
|
||||||
@ -318,12 +318,15 @@ public class DtsodV23 : DtsodDict<string, dynamic>, IDtsod
|
|||||||
else if (value is IList _list)
|
else if (value is IList _list)
|
||||||
{
|
{
|
||||||
b.Append('[');
|
b.Append('[');
|
||||||
foreach (object el in _list)
|
if(_list.Count>0){
|
||||||
{
|
foreach (object el in _list)
|
||||||
SerializeType(el, ref tabscount);
|
{
|
||||||
b.Append(',');
|
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);
|
else TypeSerializeFuncs[value.GetType()].Invoke(value, b);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user