2025-04-25 20:05:55 +00:00
|
|
|
|
namespace SharpChat {
|
2025-04-26 12:51:08 +00:00
|
|
|
|
public class C2SPacketHandlerContext(
|
2025-04-25 15:49:46 +00:00
|
|
|
|
string text,
|
2025-04-26 12:51:08 +00:00
|
|
|
|
Context chat,
|
|
|
|
|
Connection connection
|
2025-04-25 15:49:46 +00:00
|
|
|
|
) {
|
|
|
|
|
public string Text { get; } = text ?? throw new ArgumentNullException(nameof(text));
|
2025-04-26 12:51:08 +00:00
|
|
|
|
public Context Chat { get; } = chat ?? throw new ArgumentNullException(nameof(chat));
|
|
|
|
|
public Connection Connection { get; } = connection ?? throw new ArgumentNullException(nameof(connection));
|
2023-02-16 22:16:06 +01:00
|
|
|
|
|
|
|
|
|
public bool CheckPacketId(string packetId) {
|
|
|
|
|
return Text == packetId || Text.StartsWith(packetId + '\t');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string[] SplitText(int expect) {
|
|
|
|
|
return Text.Split('\t', expect + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|