Replacing MemoryPack and BinaryFormatter with MessagePack, which covers a much wider range of .net frameworks

Removed all old Serialization tags and methods
Potentially Breaking Change: Removed InventoryNode.ParentID - This was an old serlization hack. Use Data.ParentUUID instead
This commit is contained in:
nooperation
2025-05-24 00:46:45 -04:00
parent f8558e541a
commit 2ae331bf05
14 changed files with 154 additions and 496 deletions

View File

@@ -0,0 +1,31 @@
using MessagePack;
using MessagePack.Formatters;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Text;
namespace OpenMetaverse.Formatters
{
public class UUIDFormatter : IMessagePackFormatter<UUID>
{
public static readonly UUIDFormatter Instance = new UUIDFormatter();
public void Serialize(ref MessagePackWriter writer, UUID value, MessagePackSerializerOptions options)
{
writer.Write(value.GetBytes());
}
public UUID Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
var sequence = reader.ReadBytes();
if (sequence == null)
{
throw new MessagePackSerializationException("Invalid UUID");
}
var bytes = sequence.Value.ToArray();
return new UUID(bytes, 0);
}
}
}