sharp-chat/SharpChat/Packet/ForceDisconnectPacket.cs

21 lines
575 B
C#

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