21 lines
656 B
C#
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);
|
|
}
|
|
}
|
|
}
|