sharp-chat/SharpChat.SockChat/PacketsC2S/C2SPacketHandlerContext.cs

22 lines
689 B
C#
Raw Normal View History

namespace SharpChat.SockChat.PacketsC2S {
public class C2SPacketHandlerContext {
2023-02-16 21:16:06 +00:00
public string Text { get; }
public SockChatContext Chat { get; }
public SockChatConnectionInfo Connection { get; }
2023-02-16 21:16:06 +00:00
public C2SPacketHandlerContext(string text, SockChatContext chat, SockChatConnectionInfo connection) {
Text = text;
Chat = chat;
Connection = connection;
2023-02-16 21:16:06 +00:00
}
public bool CheckPacketId(string packetId) {
return Text == packetId || Text.StartsWith(packetId + '\t');
}
public string[] SplitText(int expect) {
return Text.Split('\t', expect + 1);
}
}
}