private void OnConnect(AegisClient ac, bool connected) { if (connected == true) { OnNetworkStatusChanged(NetworkStatus.Connected); } else { OnNetworkStatusChanged(NetworkStatus.ConnectionFailed); } }
private bool IsValidPacket(AegisClient ac, StreamBuffer buffer, out Int32 packetSize) { if (buffer.WrittenBytes < 8) { packetSize = 0; return(false); } packetSize = buffer.GetUInt16(); return(packetSize > 0 && buffer.WrittenBytes >= packetSize); }
private void OnReceive(AegisClient ac, StreamBuffer buffer) { SecurePacket packet = new SecurePacket(buffer); packet.Decrypt(AESIV, AESKey); packet.SkipHeader(); if (PacketPreprocessing != null && PacketPreprocessing(packet) == false) { _callbackQueue.AddPacket(packet); } }
private void OnDisconnect(AegisClient ac) { _aegisClient.EnableSend = false; OnNetworkStatusChanged(NetworkStatus.Disconnected); }