sharp-chat/SharpChat/Packet/ForceDisconnectPacket.cs

25 lines
660 B
C#

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