示例#1
0
        public iRacingSLI()
        {
            InitializeComponent();
            this.Text = "iRacing SLI v" + Version;
            cfg = new configHandler(console);
            connection = new connectionHelper(console);
            connection.setupConnection(startConnection, cboPorts, cfg);
            brk = new brakeVibe();

            int top = Convert.ToInt16(cfg.readSetting("Top", "100")) > -3000 ? Convert.ToInt16(cfg.readSetting("Top", "100")) : 100;
            int left = Convert.ToInt16(cfg.readSetting("Left", "100")) > -3000 ? Convert.ToInt16(cfg.readSetting("Left", "100")) : 100;
            this.SetDesktopLocation(top, left);
            this.cboSpdUnit.SelectedIndex = Convert.ToInt16(cfg.readSetting("spdUnit", "0"));
            this.trkIntensity.Value = Convert.ToInt16(cfg.readSetting("intensity", "0"));
            this.chkTelem.Checked = Convert.ToBoolean(cfg.readSetting("telemEnable", "True"));
            this.chkBrake.Checked = Convert.ToBoolean(cfg.readSetting("brakeEnable", "False"));
            this.groupBox1.Enabled = this.chkBrake.Checked;
            this.trkTol.Value = Convert.ToInt16(cfg.readSetting("brakeTol", "35"));
            this.trkSens.Value = Convert.ToInt16(cfg.readSetting("brakeSens", "3"));

            console("Start iRacingSDK Wrapper");
            wrapper = new SdkWrapper();
            wrapper.EventRaiseType = SdkWrapper.EventRaiseTypes.CurrentThread;
            wrapper.TelemetryUpdateFrequency = 20;

            wrapper.Connected += wrapper_Connected;
            wrapper.Disconnected += wrapper_Disconnected;
            wrapper.SessionInfoUpdated += wrapper_SessionInfoUpdated;
            wrapper.TelemetryUpdated += wrapper_TelemetryUpdated;

            wrapper.Start();
            ticker = 39;
            prevLapTime = 0;
        }
        public iRacingSLI()
        {
            try
            {
                InitializeComponent();
                this.Text = "iRacing SLI v" + Version;
                cfg = new configHandler(console);
                connection = new connectionHelper(console);
                connection.setupConnection(startConnection, cboPorts, cfg);

                int top = Convert.ToInt16(cfg.readSetting("Top", "100")) > -3000 ? Convert.ToInt16(cfg.readSetting("Top", "100")) : 100;
                int left = Convert.ToInt16(cfg.readSetting("Left", "100")) > -3000 ? Convert.ToInt16(cfg.readSetting("Left", "100")) : 100;
                this.SetDesktopLocation(top, left);
                this.cboSpdUnit.SelectedIndex = Convert.ToInt16(cfg.readSetting("spdUnit", "0"));
                this.trkIntensity.Value = Convert.ToInt16(cfg.readSetting("intensity", "0"));
                this.chkTelem.Checked = Convert.ToBoolean(cfg.readSetting("telemEnable", "True"));

                console("Start iRacingSDK Wrapper");
                wrapper = new SdkWrapper();
                wrapper.EventRaiseType = SdkWrapper.EventRaiseTypes.CurrentThread;
                wrapper.TelemetryUpdateFrequency = 20;
                //wrapper.ConnectSleepTime = 1;

                wrapper.Connected += wrapper_Connected;
                wrapper.Disconnected += wrapper_Disconnected;
                wrapper.SessionInfoUpdated += wrapper_SessionInfoUpdated;
                wrapper.TelemetryUpdated += wrapper_TelemetryUpdated;

                wrapper.Start();
                ticker = 39;
                prevLapTime = 0;
            }
            catch (Exception exe)
            {
                ExceptionHelper.writeToLogFile(exe.Message, exe.ToString(), "Constructor", exe.LineNumber(), this.FindForm().Name);
            }
        }