sharp-chat/SharpChat.Protocol.SockChat/Packets/ChannelUpdatePacket.cs

30 lines
941 B
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Channels;
using SharpChat.Protocol.SockChat.Channels;
using System.Text;
namespace SharpChat.Protocol.SockChat.Packets {
public class ChannelUpdatePacket : ServerPacket {
public string PreviousName { get; private set; }
public IChannel Channel { get; private set; }
public ChannelUpdatePacket(string previousName, IChannel channel) {
PreviousName = previousName;
Channel = channel;
}
protected override string DoPack() {
StringBuilder sb = new();
sb.Append((int)ServerPacketId.ChannelEvent);
sb.Append(IServerPacket.SEPARATOR);
sb.Append((int)ServerChannelSubPacketId.Update);
sb.Append(IServerPacket.SEPARATOR);
sb.Append(PreviousName);
sb.Append(IServerPacket.SEPARATOR);
sb.Append(Channel.Pack());
return sb.ToString();
}
}
}