NrxDebugVisualizer shows objects.

TODO: Update SceneTreeView after adding new objects
This commit is contained in:
Matthias Heil
2026-04-15 15:59:42 +02:00
parent 4549022153
commit 001b945ea1
12 changed files with 233 additions and 80 deletions
+14 -7
View File
@@ -10,18 +10,25 @@ namespace NamedPipes;
/// </summary>
public class PipeSerializer : IPipeSerializer
{
private JsonSerializerOptions options = new()
{
IncludeFields = true
};
public object Deserialize(byte[] data, Type type)
{
return JsonSerializer.Deserialize(data, type) ?? throw new InvalidDataException($"Can not deserialize to type: {type} ");
var obj = JsonSerializer.Deserialize(data, type, options) ?? throw new InvalidDataException($"Can not deserialize to type: {type} ");
return obj;
}
public byte[] Serialize(object o)
{
using (var memoryStream = new MemoryStream())
using (var utf8JsonWriter = new Utf8JsonWriter(memoryStream))
{
JsonSerializer.Serialize(utf8JsonWriter, o);
return memoryStream.ToArray();
}
using var memoryStream = new MemoryStream();
using var utf8JsonWriter = new Utf8JsonWriter(memoryStream);
JsonSerializer.Serialize(utf8JsonWriter, o, options);
var data = memoryStream.ToArray();
return data;
}
}