2024-05-20 23:40:34 +00:00
|
|
|
|
namespace SharpChat.SockChat.PacketsC2S {
|
2024-05-20 23:00:47 +00:00
|
|
|
|
public class C2SPacketHandlerContext {
|
2023-02-16 21:16:06 +00:00
|
|
|
|
public string Text { get; }
|
2024-05-20 23:40:34 +00:00
|
|
|
|
public SockChatContext Chat { get; }
|
|
|
|
|
public SockChatConnectionInfo Connection { get; }
|
2023-02-16 21:16:06 +00:00
|
|
|
|
|
2024-05-20 23:40:34 +00:00
|
|
|
|
public C2SPacketHandlerContext(string text, SockChatContext chat, SockChatConnectionInfo connection) {
|
2024-05-19 01:53:14 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|