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;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.Serialization;
|
||||
namespace NrxVisualizerObjectSource;
|
||||
using Frame = ValueTuple<Vector3, Quaternion, float>;
|
||||
using Frame = System.ValueTuple<System.Numerics.Vector3, System.Numerics.Quaternion, float>;
|
||||
namespace NamedPipes;
|
||||
|
||||
[DataContract]
|
||||
[Serializable]
|
||||
public class VisualizerModel
|
||||
{
|
||||
public static Type FrameType => typeof(Frame);
|
||||
@@ -2,7 +2,6 @@
|
||||
using Microsoft.VisualStudio.Extensibility.DebuggerVisualizers;
|
||||
using Microsoft.VisualStudio.RpcContracts.RemoteUI;
|
||||
using NamedPipes;
|
||||
using NrxVisualizerObjectSource;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
@@ -38,6 +37,7 @@ internal sealed class NrxDebuggerVisualizerProvider : DebuggerVisualizerProvider
|
||||
{
|
||||
if (visualizerModel is null) return;
|
||||
PipeClient ??= new NamedPipeClient("testPipe", serverName: @"TestServer", logger: (m) => Console.WriteLine(m));
|
||||
_ = PipeClient.SetVisualizerModelAsync(visualizerModel);
|
||||
_ = PipeClient.SetMessageAsync($"Hello from {nameof(CreateVisualizerAsync)},visualizerModel.Content = {visualizerModel.Content}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.VisualStudio.Extensibility.UI;
|
||||
using NrxVisualizerObjectSource;
|
||||
using NamedPipes;
|
||||
|
||||
namespace NrxDebugVisualizer;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.VisualStudio.DebuggerVisualizers;
|
||||
using NamedPipes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -7,7 +8,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Frame = System.ValueTuple<System.Numerics.Vector3, System.Numerics.Quaternion, float>;
|
||||
|
||||
namespace NrxVisualizerObjectSource;
|
||||
public class NrxVisualizerObjectSource : VisualizerObjectSource
|
||||
{
|
||||
|
||||
+11
-1
@@ -2,11 +2,21 @@
|
||||
using NamedPipes;
|
||||
var count = 0;
|
||||
var message = "Hello World!".ToCharArray();
|
||||
VisualizerModel visualizerModel = new VisualizerModel
|
||||
{
|
||||
Content = "Hello from TestClient",
|
||||
Point = new System.Numerics.Vector3(1, 2, 3),
|
||||
//Orientation = System.Numerics.Quaternion.Identity,
|
||||
//PointArray = [new System.Numerics.Vector3(4, 5, 6), new System.Numerics.Vector3(7, 8, 9)],
|
||||
//Frame = (new System.Numerics.Vector3(10, 11, 12), System.Numerics.Quaternion.Identity, 1.0f),
|
||||
//FrameArray = [(new System.Numerics.Vector3(13, 14, 15), System.Numerics.Quaternion.Identity, 2.0f), (new System.Numerics.Vector3(16, 17, 18), System.Numerics.Quaternion.Identity, 3.0f)]
|
||||
};
|
||||
while (true)
|
||||
{
|
||||
var pipeClient = new NamedPipeClient("testPipe",@".\","TestServer",logger:Console.WriteLine);
|
||||
Thread.Sleep(1000);
|
||||
await pipeClient.SetVisualizerModelAsync(visualizerModel);
|
||||
pipeClient.SetMessageAsync($"Hello from TestClient " + count++).GetAwaiter().GetResult();
|
||||
pipeClient.SetDebugObjectAsync(new DebugObject{Type = typeof(string).FullName,Data = Encoding.GetEncoding("UTF-8").GetBytes(message)}).GetAwaiter().GetResult();
|
||||
//pipeClient.SetDebugObjectAsync(new DebugObject{Type = typeof(string).FullName,Data = Encoding.GetEncoding("UTF-8").GetBytes(message)}).GetAwaiter().GetResult();
|
||||
pipeClient.Dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user