sharp-chat/SharpChat/Packet/ForceDisconnectPacket.cs

20 lines
519 B
C#

using System;
namespace SharpChat.Packet {
public class ForceDisconnectPacket : SockChatS2CPacket {
private readonly long Expires;
public ForceDisconnectPacket() {}
public ForceDisconnectPacket(DateTimeOffset expires) {
Expires = expires.Year >= 2100 ? -1 : expires.ToUnixTimeSeconds();
}
public override string Pack() {
if(Expires != 0)
return string.Format("9\t1\t{0}", Expires);
return "9\t0";
}
}
}