/// <summary>Add set command to queue</summary>
        /// <param name="path">The path.</param>
        /// <param name="value">The value.</param>
        private void update(string path, float value)
        {
            // Create command
            string command = String.Format("set {0} {1}", path, value);
            // Create command object
            SetCommand setCommand = new SetCommand(command, false);

            // Add to queue
            addCommand(setCommand);
        }
        /// <summary>Updates the simulator.</summary>
        private void updateSimulator()
        {
            // Connect to client
            IPEndPoint ep     = new IPEndPoint(IPAddress.Parse(IP), Port);
            TcpClient  client = new TcpClient();

            client.Connect(ep);

            // Run until stop is called
            while (!shouldStop)
            {
                // Wait for commands to enter queue
                if (commandsQueue.Count != 0)
                {
                    using (NetworkStream stream = new NetworkStream(client.Client, false))
                        using (BinaryWriter writer = new BinaryWriter(stream))
                        {
                            while (commandsQueue.Count != 0)
                            {
                                // Dequeue command
                                SetCommand command = commandsQueue.Dequeue();
                                // Change decoding to ASCII
                                byte[] data = System.Text.Encoding.ASCII.GetBytes(command.Command);

                                // Write to socket
                                writer.Write(data);
                                writer.Flush();

                                // Delay command execution if needed
                                if (command.ShouldDelay)
                                {
                                    Thread.Sleep(2000);
                                }
                            }
                        }
                }
                Thread.Sleep(1000);
            }

            // Close client socket
            client.Close();
        }
 /// <summary>Adds the command.</summary>
 /// <param name="command">The command.</param>
 public void addCommand(SetCommand command)
 {
     command.Command += "\r\n";
     commandsQueue.Enqueue(command);
 }