Ejemplo n.º 1
0
 /// <summary>
 /// Execute the request.
 /// </summary>
 /// <param name="context">The server context sending the data.</param>
 /// <param name="command">The command sent from the server context to the server.</param>
 /// <param name="request">Is in request mode; else returning data.</param>
 /// <param name="data">The data from the client.</param>
 /// <param name="isDirectServerRequest">Is the request direct from the server.</param>
 private void ExecuteRequest(Nequeo.Net.Sockets.ServerContext context, string command, bool request, string data, bool isDirectServerRequest = false)
 {
     // Has the credentials been authenticated.
     if (_isAuthenticated)
     {
         // If in request mode.
         if (request)
         {
             // Send a message to the server.
             context.SendToServer(Encoding.ASCII.GetBytes(command + (String.IsNullOrEmpty(data) ? "" : " " + data) + "\r\n"));
         }
         else
         {
             // If not direct from server.
             if (!isDirectServerRequest)
             {
                 // Send a message to the client.
                 context.Send(command + " 200" + (String.IsNullOrEmpty(data) ? "" : " " + data) + "\r\n");
             }
         }
     }
 }