22 lines
595 B
C#
22 lines
595 B
C#
using System.Text;
|
|
|
|
namespace SharpChat.SockChat.S2CPackets;
|
|
|
|
public class ForceDisconnectS2CPacket(DateTimeOffset? expires = null) : S2CPacket {
|
|
public string Pack() {
|
|
StringBuilder sb = new();
|
|
|
|
sb.Append("9\t");
|
|
|
|
if(expires.HasValue && expires.Value > DateTimeOffset.UtcNow) {
|
|
sb.Append("1\t");
|
|
if(expires.Value < DateTimeOffset.MaxValue)
|
|
sb.Append(expires.Value.ToUnixTimeSeconds());
|
|
else
|
|
sb.Append("-1");
|
|
} else
|
|
sb.Append('0');
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|