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

26 lines
754 B
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Channels;
using System;
using System.Text;
namespace SharpChat.Protocol.SockChat.Packets {
public class ChannelSwitchPacket : ServerPacket {
public IChannel Channel { get; private set; }
public ChannelSwitchPacket(IChannel channel) {
Channel = channel ?? throw new ArgumentNullException(nameof(channel));
}
protected override string DoPack() {
StringBuilder sb = new();
sb.Append((int)ServerPacketId.UserMove);
sb.Append(IServerPacket.SEPARATOR);
sb.Append((int)ServerMoveSubPacketId.ForcedMove);
sb.Append(IServerPacket.SEPARATOR);
sb.Append(Channel.Name);
return sb.ToString();
}
}
}