sharp-chat/SharpChat/PacketsS2C/ChannelUpdateS2CPacket.cs

30 lines
1.1 KiB
C#

namespace SharpChat.PacketsS2C {
public class ChannelUpdateS2CPacket : SockChatS2CPacket {
private readonly string ChannelNamePrevious;
private readonly string ChannelNameNew;
private readonly bool ChannelHasPassword;
private readonly bool ChannelIsTemporary;
public ChannelUpdateS2CPacket(
string channelNamePrevious,
string channelNameNew,
bool channelHasPassword,
bool channelIsTemporary
) {
ChannelNamePrevious = channelNamePrevious;
ChannelNameNew = channelNameNew;
ChannelHasPassword = channelHasPassword;
ChannelIsTemporary = channelIsTemporary;
}
public override string Pack() {
return string.Format(
"4\t1\t{0}\t{1}\t{2}\t{3}",
SockChatUtility.SanitiseChannelName(ChannelNamePrevious),
SockChatUtility.SanitiseChannelName(ChannelNameNew),
ChannelHasPassword ? 1 : 0,
ChannelIsTemporary ? 1 : 0
);
}
}
}