* 🚧 WIP v2.

Signed-off-by: 秋雨落 <i@rain.cx>

* 🚧 WIP v2 * 2.

Signed-off-by: 秋雨落 <i@rain.cx>

* ✨ It works?

Signed-off-by: 秋雨落 <i@rain.cx>

* ✨ Publish to nexus.

Signed-off-by: 秋雨落 <i@rain.cx>

---------

Signed-off-by: 秋雨落 <i@rain.cx>
This commit is contained in:
秋 雨落
2024-01-10 09:52:50 +08:00
committed by GitHub
parent 3af3badcc5
commit 84f4e3543c
32 changed files with 2361 additions and 385 deletions
@@ -0,0 +1,51 @@
using CrystalConnector.Protocol.Messages;
using Google.Protobuf;
namespace CrystalConnector.Protocol.Packets.S2C;
public class ForwardPacket : IPacket
{
public string Publisher { get; set; }
public NamespacedName Channel { get; set; }
public string Payload { get; set; }
public ForwardPacket(string publisher, (string Namespace, string Name) channel, string payload)
{
Publisher = publisher;
Channel = new NamespacedName
{
Namespace = channel.Namespace,
Name = channel.Name
};
Payload = payload;
}
public ForwardPacket(byte[] bytes)
{
Read(bytes);
}
public ForwardPacket()
{
}
public void Read(byte[] bytes)
{
var message = Forward.Parser.ParseFrom(bytes);
Publisher = message.Publisher;
Channel = message.Channel;
Payload = message.Payload;
}
public byte[] Write()
{
var message = new Forward
{
Publisher = Publisher,
Channel = Channel,
Payload = Payload
};
return message.ToByteArray();
}
}