✨ Fix entity.

Signed-off-by: 秋雨落 <i@rain.cx>
This commit is contained in:
秋雨落
2024-01-10 10:46:56 +08:00
parent 32ed6c3b1d
commit 783e850de5
8 changed files with 43 additions and 29 deletions
@@ -1,4 +1,6 @@
using CrystalConnector.Protocol.Messages;
using CrystalConnector.Protocol.Entities;
using CrystalConnector.Protocol.Messages;
using CrystalConnector.Protocol.Utilities;
using Google.Protobuf;
namespace CrystalConnector.Protocol.Packets.S2C;
@@ -6,17 +8,13 @@ namespace CrystalConnector.Protocol.Packets.S2C;
public class ForwardPacket : IPacket
{
public string Publisher { get; set; }
public NamespacedName Channel { get; set; }
public NamespacedId Channel { get; set; }
public string Payload { get; set; }
public ForwardPacket(string publisher, (string Namespace, string Name) channel, string payload)
public ForwardPacket(string publisher, NamespacedId channel, string payload)
{
Publisher = publisher;
Channel = new NamespacedName
{
Namespace = channel.Namespace,
Name = channel.Name
};
Channel = channel;
Payload = payload;
}
@@ -33,7 +31,7 @@ public class ForwardPacket : IPacket
{
var message = Forward.Parser.ParseFrom(bytes);
Publisher = message.Publisher;
Channel = message.Channel;
Channel = message.Channel.ToId();
Payload = message.Payload;
}
@@ -42,7 +40,11 @@ public class ForwardPacket : IPacket
var message = new Forward
{
Publisher = Publisher,
Channel = Channel,
Channel = new NamespacedName
{
Namespace = Channel.Namespace,
Name = Channel.Name
},
Payload = Payload
};