using System; using System.Text; namespace SharpChat.PacketsS2C { public class WhoServerResponseS2CPacket : SockChatTimedS2CPacket { private readonly string[] Users; private readonly string SelfName; public WhoServerResponseS2CPacket(string[] users, string selfName) { Users = users; SelfName = selfName; } public override string Pack() { StringBuilder sb = new(); sb.AppendFormat("2\t{0}\t-1\t0\fwho\f", TimeStamp.ToUnixTimeSeconds()); foreach(string userName in Users) { sb.Append(@"{0}, ", userName); } if(Users.Length > 0) sb.Length -= 2; sb.AppendFormat("\t{0}\t10010", MessageId); return sb.ToString(); } } }