Rename `Shared` to `ClientServerShared` across client, server, calculator, interface, and serializer code. Update pipe-name parsing to use ordinal comparison while retaining the `PipeDemo` default. Preserve custom JSON serialization with public field support for `Vector3`.
17 lines
552 B
C#
17 lines
552 B
C#
using PipeMethodCalls;
|
|
using System.Text.Json;
|
|
|
|
namespace ClientServerShared;
|
|
|
|
/// <summary>
|
|
/// JSON serializer that also includes public fields (required for System.Numerics.Vector3).
|
|
/// </summary>
|
|
public class JsonFieldsPipeSerializer : IPipeSerializer
|
|
{
|
|
private static readonly JsonSerializerOptions Options = new() { IncludeFields = true };
|
|
|
|
public object Deserialize(byte[] data, Type type) => JsonSerializer.Deserialize(data, type, Options)!;
|
|
|
|
public byte[] Serialize(object o) => JsonSerializer.SerializeToUtf8Bytes(o, Options);
|
|
}
|