sharp-chat/SharpChat/Packet/ChannelCreatePacket.cs

28 lines
874 B
C#

using System;
namespace SharpChat.Packet {
public class ChannelCreatePacket : ServerPacket {
private readonly string ChannelName;
private readonly bool ChannelHasPassword;
private readonly bool ChannelIsTemporary;
public ChannelCreatePacket(
string channelName,
bool channelHasPassword,
bool channelIsTemporary
) {
ChannelName = channelName ?? throw new ArgumentNullException(nameof(channelName));
ChannelHasPassword = channelHasPassword;
ChannelIsTemporary = channelIsTemporary;
}
public override string Pack() {
return string.Format(
"4\t0\t{0}\t{1}\t{2}",
ChannelName,
ChannelHasPassword ? 1 : 0,
ChannelIsTemporary ? 1 : 0
);
}
}
}