Ejemplo n.º 1
0
    static void Main()
    {
        int    port = 4000;
        string host = "127.0.0.1";

        using (OutGauge outgauge = new OutGauge())
        {
            outgauge.PacketReceived += new EventHandler <OutGaugeEventArgs>(myFunction);
            outgauge.Connect(host, port);
            Console.ReadKey(true);
        }
    }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            updater = new SharpUpdater(this);
            updater.DoUpdate();

            // Start listening for packets
            outgauge.Connect("127.0.0.1", 30000);

            // Attach OutGauge packet event
            outgauge.PacketReceived += (sender, e) => {
                /*
                 * Process p = Process.GetProcessesByName("lfs").FirstOrDefault();
                 *      if (p != null)
                 *      {
                 *          IntPtr h = p.MainWindowHandle;
                 *          SetForegroundWindow(h);
                 *          SendKeys.SendWait("a");
                 *          //System.Threading.Thread.Sleep(100);
                 *      }
                 */



                if (checkBox1.Checked)
                {
                    //Devir
                    label2.Text = Convert.ToInt32(e.RPM).ToString();
                    //Araç
                    label10.Text = Convert.ToString(e.Car);
                    //Hız
                    label9.Text = Convert.ToInt32(e.Speed / 0.27777778).ToString();
                    //Benzin
                    label11.Text = Convert.ToInt32(e.Fuel * 100).ToString();
                    //Vites

                    if (e.Gear == 8)
                    {
                        label12.Text = "7";
                    }
                    else if (e.Gear == 7)
                    {
                        label12.Text = "6";
                    }
                    else if (e.Gear == 6)
                    {
                        label12.Text = "5";
                    }
                    else if (e.Gear == 5)
                    {
                        label12.Text = "4";
                    }
                    else if (e.Gear == 4)
                    {
                        label12.Text = "3";
                    }
                    else if (e.Gear == 3)
                    {
                        label12.Text = "2";
                    }
                    else if (e.Gear == 2)
                    {
                        label12.Text = "1";
                    }
                    else if (e.Gear == 1)
                    {
                        label12.Text = "N";
                    }
                    else if (e.Gear == 0)
                    {
                        label12.Text = "R";
                    }
                    else
                    {
                        label12.Text = Convert.ToInt32(e.Gear).ToString();
                    }

                    //Turbo
                    label13.Text = Convert.ToInt32(e.Turbo * 100).ToString();

                    circularProgressBar4.Value = Convert.ToInt32(e.EngTemp);
                    label19.Text = Convert.ToInt32(e.Packet.EngTemp / 0.27777778).ToString();
                    circularProgressBar5.Value = Convert.ToInt32(e.OilPressure);
                    label20.Text = Convert.ToInt32(e.Packet.OilPressure / 0.27777778).ToString();
                    circularProgressBar6.Value = Convert.ToInt32(e.OilTemp);
                    label21.Text = Convert.ToInt32(e.Packet.OilTemp / 0.27777778).ToString();

                    circularProgressBar1.Value = Convert.ToInt32(e.Throttle * 100);
                    circularProgressBar2.Value = Convert.ToInt32(e.Brake * 100);
                    circularProgressBar3.Value = Convert.ToInt32(e.Clutch * 100);


                    //Görünüm 1
                    textBox1.Text = Convert.ToString(e.Display1);
                    //Görünüm 2
                    textBox2.Text = Convert.ToString(e.Display2);
                }
                else
                {
                }
            };
        }