sharp-chat/SharpChat/PacketsS2C/ForceDisconnectS2CPacket.cs

20 lines
533 B
C#

using System;
namespace SharpChat.PacketsS2C {
public class ForceDisconnectS2CPacket : SockChatS2CPacket {
private readonly long Expires;
public ForceDisconnectS2CPacket() { }
public ForceDisconnectS2CPacket(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";
}
}
}