Not working
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user