Return of ping pong and ToString for NetworkMessageHeader
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>9</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace mROA.Cbor
|
||||
return writer.Encode();
|
||||
}
|
||||
|
||||
public void Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext context)
|
||||
public int Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext context)
|
||||
{
|
||||
var writer = new CborWriter();
|
||||
WriteData(objectToSerialize, writer, context);
|
||||
writer.Encode(destination);
|
||||
return writer.Encode(destination);
|
||||
}
|
||||
|
||||
public T Deserialize<T>(byte[] rawData, IEndPointContext? context)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>2.0.2</Version>
|
||||
<Version>2.0.3</Version>
|
||||
<LangVersion>9</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace mROA.Abstract
|
||||
public interface IContextualSerializationToolKit : IInjectableModule
|
||||
{
|
||||
byte[] Serialize(object objectToSerialize, IEndPointContext? context);
|
||||
void Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext? context);
|
||||
int Serialize(object objectToSerialize, Span<byte> destination, IEndPointContext? context);
|
||||
T Deserialize<T>(byte[] rawData, IEndPointContext? context);
|
||||
object? Deserialize(byte[] rawData, Type type, IEndPointContext? context);
|
||||
T Deserialize<T>(ReadOnlyMemory<byte> rawMemory, IEndPointContext? context);
|
||||
|
||||
@@ -121,6 +121,11 @@ namespace mROA.Implementation
|
||||
{
|
||||
await PostMessageAsync(
|
||||
new NetworkMessageHeader(_serialization!, new ClientRecovery(Math.Abs(ConnectionId)), _context));
|
||||
await ReceiveChanel.Reader.ReadAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _trustedWriter.WriteAsync(new NetworkMessageHeader());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,5 +39,10 @@ namespace mROA.Implementation
|
||||
public EMessageType MessageType { get; set; }
|
||||
|
||||
public byte[] Data { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $" {Id}:{MessageType} [{Data.Length}]";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Title>mROA</Title>
|
||||
<Version>2.0.3</Version>
|
||||
<Version>2.0.5</Version>
|
||||
<Authors>YaslePoy</Authors>
|
||||
<Description>Fast and easy RPC with contex</Description>
|
||||
<RepositoryUrl>https://github.com/YaslePoy/mROA</RepositoryUrl>
|
||||
|
||||
Reference in New Issue
Block a user