mirror of
https://github.com/snltty/linker.git
synced 2025-10-27 19:10:27 +08:00
sync
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using linker.messenger;
|
||||
using MemoryPack;
|
||||
|
||||
namespace linker.messenger.serializer.memorypack
|
||||
{
|
||||
/// <summary>
|
||||
/// MemoryPack 的IConnection序列化扩展
|
||||
/// </summary>
|
||||
public sealed class ConnectionFormatter : MemoryPackFormatter<IConnection>
|
||||
{
|
||||
public override void Serialize<TBufferWriter>(ref MemoryPackWriter<TBufferWriter> writer, scoped ref IConnection value)
|
||||
{
|
||||
writer.WriteNullCollectionHeader();
|
||||
return;
|
||||
}
|
||||
|
||||
public override void Deserialize(ref MemoryPackReader reader, scoped ref IConnection value)
|
||||
{
|
||||
if (!reader.TryReadCollectionHeader(out int len))
|
||||
{
|
||||
value = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user