Esempio n. 1
0
        public void SendValue(string property, double value)
        {
            string message;

            //sending the following messages according to the format the simulator expects
            if (property.Equals("Rudder"))
            {
                message = "set /controls/flight/rudder ";
            }
            else if (property.Equals("Throttle"))
            {
                message = "set /controls/engines/current-engine/throttle ";
            }
            else if (property.Equals("Elevator"))
            {
                message = "set /controls/flight/elevator ";
            }
            else if (property.Equals("Aileron"))
            {
                message = "set /controls/flight/aileron ";
            }
            else
            {
                return;
            }
            message += value;
            client.Send(message);
        }
Esempio n. 2
0
 public void Send(string commands)
 {
     //splitting the commands by newline character
     string[] commandsArray = commands.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
     new Thread(delegate()
     {
         foreach (string command in commandsArray)
         {
             if (!string.IsNullOrWhiteSpace(command))
             {
                 client.Send(command);
                 Thread.Sleep(2000);
             }
         }
     }).Start();
 }