Not working

This commit is contained in:
Matthias Heil
2026-04-07 12:21:37 +02:00
parent 8038c76307
commit 7b4bbd28a1
9 changed files with 28 additions and 28 deletions
+1 -13
View File
@@ -3,20 +3,8 @@ using System.Numerics;
using System.Threading.Tasks;
namespace NamedPipes;
[Serializable]
public struct Frame(Vector3 translation, Quaternion orientation)
{
public Vector3 Translation => translation;
public Quaternion Orientation => orientation;
}
[Serializable]
public class DebugObject
{
public string? Type { get; set; }
public byte[]? Data { get; set; }
}
public interface IDebugVisualizer
{
Task<bool> SetDebugObjectAsync(DebugObject debugObject);
Task<bool> SetVisualizerModelAsync(VisualizerModel visualizerModel);
Task<bool> SetMessageAsync(string message);
}
+3 -3
View File
@@ -40,11 +40,11 @@ public class NamedPipeClient (string pipeName,string? serverLocation = null, st
}
}
public async Task<bool> SetDebugObjectAsync(DebugObject debugObject)
public async Task<bool> SetVisualizerModelAsync(VisualizerModel visualizerModel)
{
await StartServerAsync().ConfigureAwait(true);
var result = await PipeClient.InvokeAsync(server => server.SetDebugObjectAsync(debugObject));
Logger("NamedPipeClient.SetDebugObjectAsync: result = " + result);
var result = await PipeClient.InvokeAsync(server => server.SetVisualizerModelAsync(visualizerModel));
Logger("NamedPipeClient.SetVisualizerModelAsync: result = " + result);
return result;
}
+4 -4
View File
@@ -43,13 +43,13 @@ public partial class NamedPipesServer(string pipeName,Action<string>? logger = n
}
}
[ObservableProperty]
public partial DebugObject? DebugObject { get; private set; }
public partial VisualizerModel? VisualizerModel { get; private set; }
public async Task<bool> SetDebugObjectAsync(DebugObject debugObject)
public async Task<bool> SetVisualizerModelAsync(VisualizerModel visualizerModel)
{
await Task.Delay(1);
DebugObject = debugObject;
Logger("Received DebugObject of type: " + DebugObject.Type);
VisualizerModel = visualizerModel;
Logger("NamedPipesServer, received object of type: " + visualizerModel.GetType());
return true;
}
+2 -2
View File
@@ -10,7 +10,7 @@ namespace NamedPipes
{
if (data.Length == 0) return null;
//Log.Trace("PipeSerializer.Deserialize: type = " + type + " , data.length = " + data.Length);
var obj = MessagePackSerializer.Deserialize(type, data, MessagePack.Resolvers.ContractlessStandardResolver.Options);
var obj = MessagePackSerializer.Typeless.Deserialize(data);
//if (obj is DebugObject debugObject)
//{
// var length = debugObject.Data?.Length ?? 0;
@@ -29,7 +29,7 @@ namespace NamedPipes
// Log.Trace("PipeSerializer.Deserialize: debugObject.Type = " + debugObject.Type + " , debugObject.Data.Length = " + length);
//}
var bytearray = MessagePackSerializer.Serialize(o.GetType(), o, MessagePack.Resolvers.ContractlessStandardResolver.Options);
var bytearray = MessagePackSerializer.Typeless.Serialize(o);
//var xxx = Deserialize(bytearray, o.GetType());
//Log.Trace("PipeSerializer.Serialize: type = " + o.GetType() + " , bytearray.length = " + bytearray.Length);
return bytearray;
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Numerics;
using System.Runtime.Serialization;
using Frame = System.ValueTuple<System.Numerics.Vector3, System.Numerics.Quaternion, float>;
namespace NamedPipes;
[DataContract]
[Serializable]
public class VisualizerModel
{
public static Type FrameType => typeof(Frame);
[DataMember]
public string? Content { get; set; }
[DataMember]
public Vector3? Point { get; set; }
[DataMember]
public Quaternion? Orientation { get; set; }
[DataMember]
public Vector3[]? PointArray { get; set; }
[DataMember]
public Frame? Frame { get; set; }
[DataMember]
public Frame[]? FrameArray { get; set; }
}