Ejemplo n.º 1
0
 /// <summary>
 /// Sending IResponse to client(ciphertext or plaintext)
 /// </summary>
 /// <param name="response"></param>
 public void Send(IResponse response)
 {
     byte[] buffer = null;
     response.Build();
     if (response.SendingBuffer.GetType() == typeof(string))
     {
         buffer = UniSpyEncoding.GetBytes((string)response.SendingBuffer);
     }
     else
     {
         buffer = (byte[])response.SendingBuffer;
     }
     LogWriter.LogNetworkSending(Session.RemoteIPEndPoint, buffer);
     //Encrypt the response if Crypto is not null
     if (Crypto is not null)
     {
         buffer = Crypto.Encrypt(buffer);
     }
     Session.Send(buffer);
 }