sharp-chat/SharpChat/Packet/ChannelUpdatePacket.cs

32 lines
1.1 KiB
C#

using System;
namespace SharpChat.Packet {
public class ChannelUpdatePacket : ServerPacket {
private readonly string ChannelNamePrevious;
private readonly string ChannelNameNew;
private readonly bool ChannelHasPassword;
private readonly bool ChannelIsTemporary;
public ChannelUpdatePacket(
string channelNamePrevious,
string channelNameNew,
bool channelHasPassword,
bool channelIsTemporary
) {
ChannelNamePrevious = channelNamePrevious ?? throw new ArgumentNullException(nameof(channelNamePrevious));
ChannelNameNew = channelNameNew ?? throw new ArgumentNullException(nameof(channelNameNew));
ChannelHasPassword = channelHasPassword;
ChannelIsTemporary = channelIsTemporary;
}
public override string Pack() {
return string.Format(
"4\t1\t{0}\t{1}\t{2}\t{3}",
ChannelNamePrevious,
ChannelNameNew,
ChannelHasPassword ? 1 : 0,
ChannelIsTemporary ? 1 : 0
);
}
}
}