Name adjustments and moved some things to the common lib.
This commit is contained in:
parent
b8ec381f3b
commit
0cc5d46ea9
50 changed files with 323 additions and 323 deletions
SharpChat
19
SharpChat/C2SPacketHandlerContext.cs
Normal file
19
SharpChat/C2SPacketHandlerContext.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
namespace SharpChat {
|
||||
public class C2SPacketHandlerContext(
|
||||
string text,
|
||||
Context chat,
|
||||
Connection connection
|
||||
) {
|
||||
public string Text { get; } = text ?? throw new ArgumentNullException(nameof(text));
|
||||
public Context Chat { get; } = chat ?? throw new ArgumentNullException(nameof(chat));
|
||||
public Connection Connection { get; } = connection ?? throw new ArgumentNullException(nameof(connection));
|
||||
|
||||
public bool CheckPacketId(string packetId) {
|
||||
return Text == packetId || Text.StartsWith(packetId + '\t');
|
||||
}
|
||||
|
||||
public string[] SplitText(int expect) {
|
||||
return Text.Split('\t', expect + 1);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue