mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2026-04-22 01:45:55 +08:00
Update JsonDebugger.cs
This commit is contained in:
parent
1f263726f9
commit
04ba0a3549
@ -11,7 +11,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
private readonly static List<string> _indentsChache = new List<string>();
|
private readonly static List<string> _indentsChache = new List<string>();
|
||||||
internal static string ToJsonLog(object obj)
|
internal static string ToJsonLog(object obj)
|
||||||
{
|
{
|
||||||
if (obj == null) return "null";
|
if (obj == null) { return "null"; }
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
int linesCounter = 0;
|
int linesCounter = 0;
|
||||||
var visited = new Dictionary<object, int>();
|
var visited = new Dictionary<object, int>();
|
||||||
@ -159,10 +159,8 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
sb.Append('"');
|
sb.Append('"');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ToJsonLog(ref linesCounter, list, sb, visited, indent, indentStep);
|
||||||
value = list;
|
return;
|
||||||
type = list.GetType();
|
|
||||||
// как дописать приваильно тут вызов ToJsonLog ?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.IsValueType == false)
|
if (type.IsValueType == false)
|
||||||
@ -179,7 +177,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
visited.Add(value, linesCounter);
|
visited.Add(value, linesCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Collections
|
||||||
IEnumerable enumerable = value as IEnumerable;
|
IEnumerable enumerable = value as IEnumerable;
|
||||||
if(enumerable != null)
|
if(enumerable != null)
|
||||||
{
|
{
|
||||||
@ -206,7 +204,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
ToJsonLog(ref linesCounter, item, sb, visited, indent + 1, indentStep);
|
ToJsonLog(ref linesCounter, item, sb, visited, indent + 1, indentStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Если были элементы, переносим строку перед закрывающей скобкой
|
// перенос строки если были элементы
|
||||||
if (!first)
|
if (!first)
|
||||||
{
|
{
|
||||||
NewLine(ref linesCounter, sb, indent, indentStep);
|
NewLine(ref linesCounter, sb, indent, indentStep);
|
||||||
@ -230,8 +228,6 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
if (!first) { sb.Append(','); } else { first = false; }
|
if (!first) { sb.Append(','); } else { first = false; }
|
||||||
|
|
||||||
NewLine(ref linesCounter, sb, indent + 1, indentStep);
|
NewLine(ref linesCounter, sb, indent + 1, indentStep);
|
||||||
//sb.AppendLine();
|
|
||||||
//sb.Append(nextIndent);
|
|
||||||
sb.Append('"');
|
sb.Append('"');
|
||||||
sb.Append(field.Name);
|
sb.Append(field.Name);
|
||||||
sb.Append('"');
|
sb.Append('"');
|
||||||
@ -272,7 +268,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
ToJsonLog(ref linesCounter, propValue, sb, visited, indent + 1, indentStep);
|
ToJsonLog(ref linesCounter, propValue, sb, visited, indent + 1, indentStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Если были поля/свойства, добавляем перевод строки перед закрывающей скобкой
|
// перенос строки если были элементы
|
||||||
if (!first)
|
if (!first)
|
||||||
{
|
{
|
||||||
NewLine(ref linesCounter, sb, indent, indentStep);
|
NewLine(ref linesCounter, sb, indent, indentStep);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user