sharp-chat/SharpChat/PacketsC2S/C2SPacketHandlerContext.cs

21 lines
656 B
C#

namespace SharpChat.PacketsC2S {
public class C2SPacketHandlerContext {
public string Text { get; }
public ChatContext Chat { get; }
public ConnectionInfo Connection { get; }
public C2SPacketHandlerContext(string text, ChatContext chat, ConnectionInfo connection) {
Text = text;
Chat = chat;
Connection = connection;
}
public bool CheckPacketId(string packetId) {
return Text == packetId || Text.StartsWith(packetId + '\t');
}
public string[] SplitText(int expect) {
return Text.Split('\t', expect + 1);
}
}
}