sharp-chat/SharpChat/PacketsS2C/ChannelCreateS2CPacket.cs

26 lines
855 B
C#

namespace SharpChat.PacketsS2C {
public class ChannelCreateS2CPacket : SockChatS2CPacket {
private readonly string ChannelName;
private readonly bool ChannelHasPassword;
private readonly bool ChannelIsTemporary;
public ChannelCreateS2CPacket(
string channelName,
bool channelHasPassword,
bool channelIsTemporary
) {
ChannelName = channelName;
ChannelHasPassword = channelHasPassword;
ChannelIsTemporary = channelIsTemporary;
}
public override string Pack() {
return string.Format(
"4\t0\t{0}\t{1}\t{2}",
SockChatUtility.SanitiseChannelName(ChannelName),
ChannelHasPassword ? 1 : 0,
ChannelIsTemporary ? 1 : 0
);
}
}
}