diff options
| author | Sarah B <git@sarahduck.ca> | 2024-01-22 18:22:31 -0800 |
|---|---|---|
| committer | Sarah B <git@sarahduck.ca> | 2024-01-22 18:22:31 -0800 |
| commit | 3f4fe74715124357ba3341e635fdb2bda3fcd92d (patch) | |
| tree | cff33fd322e7a9ad1f5cb0a75adf77341d60ebea /NetClient.cs | |
| parent | 5be6cc2168c4efe5f72f5b9ef52ca48c26523bc2 (diff) | |
Updated LiteNetLib to 1.2.0
Diffstat (limited to 'NetClient.cs')
| -rw-r--r-- | NetClient.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/NetClient.cs b/NetClient.cs index 5146a0a..ce70d91 100644 --- a/NetClient.cs +++ b/NetClient.cs @@ -24,7 +24,9 @@ class Client public Client(string ServerAddress, int port, string ServerPassword) { - if (ServerAddress == "") throw new Exception("Server Address invalid!"); + if (string.IsNullOrEmpty(ServerAddress)) throw new Exception("Server Address invalid!"); + if (string.IsNullOrEmpty(UserName)) throw new Exception("Invalid Username!!"); + if (UserName.Length > 40) throw new Exception("Username too long!"); Listener = new(); NetClient = new(Listener); @@ -100,8 +102,7 @@ class Client if (reader.AvailableBytes > 500) return; - NetDataReader newReader = new(reader.GetRemainingBytes()); - PacketRecived?.Invoke(newReader, from, info.Type); + PacketRecived?.Invoke(reader, from, info.Type); }; } |
