mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
update debug utils
This commit is contained in:
parent
de2a0d43ac
commit
12e58ef273
@ -1,5 +1,6 @@
|
|||||||
using DCFApixels.DragonECS.Internal;
|
using DCFApixels.DragonECS.Internal;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -134,6 +135,19 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static string AutoConvertObjectToString(object o)
|
||||||
|
{
|
||||||
|
if (o is string str)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
if (o is IEnumerable enumerable)
|
||||||
|
{
|
||||||
|
return string.Join(", ", enumerable.Cast<object>());
|
||||||
|
}
|
||||||
|
return o.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public readonly struct MarkerInfo
|
public readonly struct MarkerInfo
|
||||||
{
|
{
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
@ -281,7 +295,7 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(tag))
|
if (string.IsNullOrEmpty(tag))
|
||||||
{
|
{
|
||||||
Console.WriteLine(v);
|
Console.WriteLine(AutoConvertObjectToString(v));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -298,7 +312,7 @@ namespace DCFApixels.DragonECS
|
|||||||
Console.ForegroundColor = ConsoleColor.Green;
|
Console.ForegroundColor = ConsoleColor.Green;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Console.WriteLine($"[{tag}] {v}");
|
Console.WriteLine($"[{tag}] {AutoConvertObjectToString(v)}");
|
||||||
Console.ForegroundColor = color;
|
Console.ForegroundColor = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ namespace DCFApixels.DragonECS
|
|||||||
return AutoToString(self, typeof(T), isWriteName);
|
return AutoToString(self, typeof(T), isWriteName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string AutoToString(object target, Type type, bool isWriteName)
|
internal static string AutoToString(object target, Type type, bool isWriteName)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
#if (DEBUG && !DISABLE_DEBUG) || !REFLECTION_DISABLED //в дебажных утилитах REFLECTION_DISABLED только в релизном билде работает
|
||||||
#pragma warning disable IL2070 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations.
|
#pragma warning disable IL2070 // 'this' argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The parameter of method does not have matching annotations.
|
||||||
|
Loading…
Reference in New Issue
Block a user