Example #1
0
        public frmTuningWizard(Form1 inParent, string in_m_currentfile)
        {
            InitializeComponent();
            parent = inParent;

            // Set-up some navigation rules
            this.wizConfirmPage.AllowNext   = false;
            this.wizCompletedPage.AllowBack = false;

            // Read software version from binary
            if (in_m_currentfile != string.Empty)
            {
                if (File.Exists(in_m_currentfile))
                {
                    T8Header t8header = new T8Header();
                    t8header.init(in_m_currentfile);
                    softwareVersion = t8header.SoftwareVersion.Trim();
                    this.lblSoftwareVersion.Text = softwareVersion.Substring(0, 4);
                }
            }
            // List all compatible tuning packages
            foreach (Form1.TuningAction t in Form1.installedTunings)
            {
                if (t.compatibelSoftware(softwareVersion))
                {
                    this.listTuningActions.Items.Add(t);
                }
            }
            if (this.listTuningActions.ItemCount <= 0)
            {
                this.wizSelectActionPage.AllowNext = false;
            }
        }
Example #2
0
        private void buttonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            // show the flashblock browser
            DataTable dt = new DataTable();

            dt.Columns.Add("Blocknumber", Type.GetType("System.Int32"));
            dt.Columns.Add("Blocktype");
            dt.Columns.Add("Address");
            dt.Columns.Add("VIN");
            dt.Columns.Add("ECU type");
            dt.Columns.Add("Interface");
            dt.Columns.Add("SecretCode");
            T8Header t8header = new T8Header();

            t8header.init(m_filename);

            foreach (FlashBlock fb in t8header.FlashBlocks)
            {
                string vin           = string.Empty;
                string ecudescr      = string.Empty;
                string interfacetype = string.Empty;
                string secretcode    = string.Empty;
                fb.DecodeBlock(out vin, out ecudescr, out interfacetype, out secretcode);
                dt.Rows.Add(fb.BlockNumber, fb.BlockType.ToString(), fb.BlockAddress.ToString("X8"), vin, ecudescr, interfacetype, secretcode);
            }
            frmFlashBlockBrowser browser = new frmFlashBlockBrowser();

            browser.SetData(dt);
            browser.ShowDialog();
        }
Example #3
0
        public frmTuningWizard(Form1 inParent, string in_m_currentfile)
        {
            InitializeComponent();
            parent = inParent;

            // Set-up some navigation rules
            this.wizConfirmPage.AllowNext = false;
            this.wizCompletedPage.AllowBack = false;

            // Read software version from binary
            if (in_m_currentfile != string.Empty)
            {
                if (File.Exists(in_m_currentfile))
                {
                    T8Header t8header = new T8Header();
                    t8header.init(in_m_currentfile);
                    softwareVersion = t8header.SoftwareVersion.Trim();
                    this.lblSoftwareVersion.Text = softwareVersion.Substring(0, 4);
                }
            }
            // List all compatible tuning packages
            foreach (Form1.TuningAction t in Form1.installedTunings)
                if (t.compatibelSoftware(softwareVersion))
                    this.listTuningActions.Items.Add(t);
            if (this.listTuningActions.ItemCount <= 0)
                this.wizSelectActionPage.AllowNext = false;
        }
Example #4
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            // clear all VIN numbers in the flashblocks
            T8Header t8header = new T8Header();

            t8header.init(m_filename);
            t8header.ClearVIN();
            t8header.init(m_filename);
            textEdit4.Text = t8header.ChassisID;
        }
Example #5
0
        public static bool TryToLoadAdditionalBinSymbols(string filename, SymbolCollection coll2load)
        {
            // Look for a complete xml file first
            string[,] SymbolFiles = new string[,] {{"FD0M", "{0}\\FD0M_C.xml"},
                                            {"FD0I", "{0}\\FD0I_C.xml"},
                                            {"FC0N", "{0}\\FC0N_C.xml"},
                                            {"FC0U", "{0}\\FC0U_C.xml"},
                                            {"FD0F", "{0}\\FD0F_C.xml"},
                                            {"FF0L", "{0}\\FF0L_C.xml"},
                                            {"FE09", "{0}\\FE09_C.xml"},
                                            {"FD0G", "{0}\\FD0G_C.xml"}};
            T8Header fh = new T8Header();
            fh.init(filename);
            for (int i = 0; i < SymbolFiles.GetLength(0); i++)
            {
                if (fh.SoftwareVersion.Trim().StartsWith(SymbolFiles[i, 0].ToString(), StringComparison.OrdinalIgnoreCase))
                {
                    string completeXmlFile = String.Format(SymbolFiles[i, 1], System.Windows.Forms.Application.StartupPath);
                    return TryToLoadAdditionalXMLSymbols(completeXmlFile, coll2load);
                }
            }

            // Secondly load the .xml file with same path and filename as the .bin file.
            string xmlfile = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + ".xml");
            return TryToLoadAdditionalXMLSymbols(xmlfile, coll2load);
        }
 private void simpleButton3_Click(object sender, EventArgs e)
 {
     // clear all VIN numbers in the flashblocks
     T8Header t8header = new T8Header();
     t8header.init(m_filename);
     t8header.ClearVIN();
     t8header.init(m_filename);
     textEdit4.Text = t8header.ChassisID;
 }
        private void buttonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            // show the flashblock browser
            DataTable dt = new DataTable();
            dt.Columns.Add("Blocknumber", Type.GetType("System.Int32"));
            dt.Columns.Add("Blocktype");
            dt.Columns.Add("Address");
            dt.Columns.Add("VIN");
            dt.Columns.Add("ECU type");
            dt.Columns.Add("Interface");
            dt.Columns.Add("SecretCode");
            T8Header t8header = new T8Header();
            t8header.init(m_filename);

            foreach (FlashBlock fb in t8header.FlashBlocks)
            {
                string vin = string.Empty;
                string ecudescr = string.Empty;
                string interfacetype = string.Empty;
                string secretcode = string.Empty;
                fb.DecodeBlock(out vin, out ecudescr, out interfacetype, out secretcode);
                dt.Rows.Add(fb.BlockNumber, fb.BlockType.ToString(), fb.BlockAddress.ToString("X8"), vin, ecudescr, interfacetype, secretcode);
            }
            frmFlashBlockBrowser browser = new frmFlashBlockBrowser();
            browser.SetData(dt);
            browser.ShowDialog();
        }
Example #8
0
        private void DynamicTuningMenu()
        {
            //
            // Show Tuning menu shortcuts depening on which file version that was loaded.
            //
            if (m_currentfile != string.Empty)
            {
                if (File.Exists(m_currentfile))
                {
                    T8Header t8header = new T8Header();
                    t8header.init(m_currentfile);
                    string swVersion = t8header.SoftwareVersion.Trim();
                    if (swVersion.Length > 2)
                    {
                        int v = Convert.ToInt32(swVersion[1]);
                        int m = Convert.ToInt32(swVersion[3]);
                        // Below is an ASSUMPTION!
                        // Assuming breakpoint is FC00.
                        // FC01 Open is special, treated as old.
                        if (v < 'C' || swVersion.Substring(0,6) == "FC01_O")
                        {
                            this.btnMaxAirmassMapManual.Caption = "Max airmass map (manual)";
                            this.btnMaxAirmassMapManual.Tag = "Old";
                            this.btnMaxAirmassMapAuto.Caption = "Max airmass map (auto)";
                            this.btnMaxAirmassMapAuto.Tag = "Old";
                            this.barButtonItem13.Caption = "Trq limit auto 175+ hp";
                            this.barButtonItem13.Tag = "Old";
                            this.barButtonItem14.Caption = "Trq limit auto 150 hp";
                            this.barButtonItem14.Tag = "Old";
                            this.barButtonItem15.Caption = "Trq limit manual 175+ hp";
                            this.barButtonItem15.Tag = "Old";
                            this.barButtonItem16.Caption = "Trq limit manual 150 hp";
                            this.barButtonItem16.Tag = "Old";
                            this.barButtonItem41.Visibility = BarItemVisibility.Never;
                            this.barButtonItem41.Tag = "Old";
                            this.barButtonItem42.Visibility = BarItemVisibility.Never;
                            this.barButtonItem42.Tag = "Old";
                            /* Conditional FlexFuel */
                            this.btnFlexFuelLimiter.Visibility = BarItemVisibility.Never;
                            this.barButtonItem15.Visibility = BarItemVisibility.Always;
                            this.barButtonItem16.Visibility = BarItemVisibility.Always;
                        }
                        else
                        {
                            this.btnMaxAirmassMapManual.Caption = "Max airmass map #1";
                            this.btnMaxAirmassMapManual.Tag = "New";
                            this.btnMaxAirmassMapAuto.Caption = "Max airmass map #2";
                            this.btnMaxAirmassMapAuto.Tag = "New";
                            this.barButtonItem13.Caption = "Trq limit 175/200hp";
                            this.barButtonItem13.Tag = "New";
                            this.barButtonItem14.Caption = "Trq limit 150hp";
                            this.barButtonItem14.Tag = "New";
                            this.barButtonItem15.Caption = "Trq limit E85 175/200hp";
                            this.barButtonItem15.Tag = "New";
                            this.barButtonItem16.Caption = "Trq limit E85 150hp";
                            this.barButtonItem16.Tag = "New";
                            this.barButtonItem41.Visibility = BarItemVisibility.Always;
                            this.barButtonItem41.Tag = "New";
                            this.barButtonItem42.Visibility = BarItemVisibility.Always;
                            this.barButtonItem42.Tag = "New";
                            /* Conditional FlexFuel */
                            // FA = MY03-06 Gasoline / front wheel drive
                            // FC = MY07-11 Gasoline / front wheel drive
                            // FD = MY07-10 BioPower / front wheel drive
                            // FE = MY09-11 Gasoline / all wheel drive
                            // FF = MY10 BioPower AWD or MY11 Gasoline/BioPower FWD/AWD
                            if (swVersion.StartsWith("FA") ||
                                swVersion.StartsWith("FC") ||
                                swVersion.StartsWith("FE"))
                            {
                                this.btnFlexFuelLimiter.Visibility = BarItemVisibility.Never;
                                this.barButtonItem15.Visibility = BarItemVisibility.Never;
                                this.barButtonItem16.Visibility = BarItemVisibility.Never;
                            }
                            else
                            {
                                this.btnFlexFuelLimiter.Visibility = BarItemVisibility.Always;
                                this.barButtonItem15.Visibility = BarItemVisibility.Always;
                                this.barButtonItem16.Visibility = BarItemVisibility.Always;
                            }

                        }
                    }
                }
            }
        }
Example #9
0
 private void btnVINDecoder_ItemClick(object sender, ItemClickEventArgs e)
 {
     frmDecodeVIN decode = new frmDecodeVIN();
     if (m_currentfile != string.Empty)
     {
         T8Header header = new T8Header();
         header.init(m_currentfile);
         decode.SetVinNumber(header.ChassisID);
     }
     decode.ShowDialog();
 }
Example #10
0
        private void btnCreateNewProject_ItemClick(object sender, ItemClickEventArgs e)
        {
            // show the project properties screen for the user to fill in
            // if a bin file is loaded, ask the user whether this should be the new projects binary file
            // the project XML should contain a reference to this binfile as well as a lot of other stuff
            frmProjectProperties projectprops = new frmProjectProperties();
            if (m_currentfile != string.Empty)
            {
                projectprops.BinaryFile = m_currentfile;
                T8Header fileheader = new T8Header();
                fileheader.init(m_currentfile);
                projectprops.CarModel = fileheader.CarDescription.Trim();

                projectprops.ProjectName = fileheader.PartNumber.Trim() + " " + fileheader.SoftwareVersion.Trim();
            }
            if (projectprops.ShowDialog() == DialogResult.OK)
            {
                if (!Directory.Exists(m_appSettings.ProjectFolder)) Directory.CreateDirectory(m_appSettings.ProjectFolder);
                // create a new folder with these project properties.
                // also copy the binary file into the subfolder for this project
                if (Directory.Exists(m_appSettings.ProjectFolder + "\\" + MakeDirName(projectprops.ProjectName)))
                {
                    frmInfoBox info = new frmInfoBox("The chosen projectname already exists, please choose another one");
                    //TODO: reshow the dialog
                }
                else
                {
                    // create the project
                    Directory.CreateDirectory(m_appSettings.ProjectFolder + "\\" + MakeDirName(projectprops.ProjectName));
                    // copy the selected binary file to this folder
                    string binfilename = m_appSettings.ProjectFolder + "\\" + MakeDirName(projectprops.ProjectName) + "\\" + Path.GetFileName(projectprops.BinaryFile);
                    File.Copy(projectprops.BinaryFile, binfilename);
                    // now create the projectproperties.xml in this new folder
                    System.Data.DataTable dtProps = new System.Data.DataTable("T5PROJECT");
                    dtProps.Columns.Add("CARMAKE");
                    dtProps.Columns.Add("CARMODEL");
                    dtProps.Columns.Add("CARMY");
                    dtProps.Columns.Add("CARVIN");
                    dtProps.Columns.Add("NAME");
                    dtProps.Columns.Add("BINFILE");
                    dtProps.Columns.Add("VERSION");
                    dtProps.Rows.Add(projectprops.CarMake, projectprops.CarModel, projectprops.CarMY, projectprops.CarVIN, MakeDirName(projectprops.ProjectName), binfilename, projectprops.Version);
                    dtProps.WriteXml(m_appSettings.ProjectFolder + "\\" + MakeDirName(projectprops.ProjectName) + "\\projectproperties.xml");
                    OpenProject(projectprops.ProjectName); //?
                }
            }
        }
Example #11
0
        private void btnConvertOriFiles_ItemClick(object sender, ItemClickEventArgs e)
        {
            // get all files in subfolder Binaries\Ori and convert the filenames
            string[] files = Directory.GetFiles(System.Windows.Forms.Application.StartupPath + "\\Binaries\\Ori", "*.bin");
            foreach (string file in files)
            {
                logger.Debug("Handling: " + Path.GetFileName(file));
                m_currentfile = file;
                TryToOpenFile(m_currentfile, out m_symbols, m_currentfile_size);
                // now get the details
                if (m_currentfile != "")
                {
                    T8Header t8header = new T8Header();

                    t8header.init(m_currentfile);
                    frmAirmassResult res = new frmAirmassResult();
                    res.Currentfile = m_currentfile;
                    res.Symbols = m_symbols;
                    res.Calculate();
                    int peak_airmass = res.PeakAirmass;
                    string newFilename = t8header.PartNumber.Trim() + "_" + t8header.SoftwareVersion.Trim() /*+ "_" + t8header.HardwareID.Trim() + "_" + t8header.DeviceType.Trim() + "_" + peak_airmass.ToString() + "mgc.bin"*/ + ".BIN";

                    if (!File.Exists(System.Windows.Forms.Application.StartupPath + "\\Binaries\\" + newFilename))
                    {
                        File.Copy(file, System.Windows.Forms.Application.StartupPath + "\\Binaries\\" + newFilename);

                        // test
                        VINDecoder dec = new VINDecoder();
                        VINCarInfo info = dec.DecodeVINNumber(t8header.ChassisID);
                        AddToPartnumberCollectionFile(t8header.PartNumber.Trim(), info.Makeyear, t8header.SoftwareVersion.Trim());
                        AddToPartnumberConverterFile(t8header.PartNumber.Trim(), info.EngineType, info.CarModel, t8header.SoftwareVersion.Trim());
                        // test

                    }
                    else
                    {
                        logger.Debug("File already existed: " + newFilename);
                    }
                    /*frminfo.ProgrammerName = t8header.ProgrammerName;
                    frminfo.ProgrammingDevice = t8header.ProgrammerDevice;
                    frminfo.PartNumber = t8header.PartNumber;
                    frminfo.ReleaseDate = t8header.ReleaseDate;
                    frminfo.SoftwareID = t8header.SoftwareVersion;
                    frminfo.ChassisID = t8header.ChassisID;
                    frminfo.EngineType = t8header.CarDescription;
                    frminfo.ImmoID = t8header.ImmobilizerID;
                    frminfo.HardwareID = t8header.HardwareID;
                    frminfo.HardwareType = t8header.DeviceType;
                    frminfo.ECUDescription = t8header.EcuDescription;
                    frminfo.InterfaceDevice = t8header.InterfaceDevice;
                    frminfo.NumberOfFlashBlocks = t8header.NumberOfFlashBlocks.ToString();*/
                }
            }
            logger.Debug("All done");
        }
Example #12
0
        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // show firmware information
            if (m_currentfile != string.Empty)
            {
                if (File.Exists(m_currentfile))
                {
                    frmFirmwareInformation frminfo = new frmFirmwareInformation();
                    T8Header t8header = new T8Header();
                    t8header.init(m_currentfile);
                    frminfo.Filename = m_currentfile;
                    frminfo.ProgrammerName = t8header.ProgrammerName;
                    frminfo.ProgrammingDevice = t8header.ProgrammerDevice;
                    frminfo.PartNumber = t8header.PartNumber;
                    frminfo.ReleaseDate = t8header.ReleaseDate;
                    frminfo.SoftwareID = t8header.SoftwareVersion.Trim();
                    // determine engine type / MY by software version
                    // and determine engine type MY by VIN number
                    string engineTypeBySWVersion = string.Empty;
                    string engineTypeByVIN = string.Empty;
                    VINDecoder decoder = new VINDecoder();
                    VINCarInfo carinfo = decoder.DecodeVINNumber(t8header.ChassisID);
                    engineTypeByVIN = carinfo.EngineType + " MY" + carinfo.Makeyear.ToString() + " " + carinfo.GearboxDescription;
                    frminfo.EngineTypeByVIN = engineTypeByVIN;
                    string swversion = t8header.SoftwareVersion.Trim();
                    engineTypeBySWVersion = DetermineCarInfoBySWVersion(swversion);
                    frminfo.ChassisID = t8header.ChassisID;
                    frminfo.EngineTypeBySoftwareVersion = engineTypeBySWVersion;//t8header.CarDescription;
                    frminfo.ImmoID = t8header.ImmobilizerID;
                    frminfo.HardwareID = t8header.HardwareID;
                    frminfo.HardwareType = t8header.DeviceType;
                    frminfo.ECUDescription = t8header.EcuDescription;
                    frminfo.InterfaceDevice = t8header.InterfaceDevice;
                    frminfo.NumberOfFlashBlocks = t8header.NumberOfFlashBlocks.ToString();

                    if (frminfo.ShowDialog() == DialogResult.OK)
                    {
                        t8header.ImmobilizerID = frminfo.ImmoID;
                        t8header.SoftwareVersion = frminfo.SoftwareID;
                        t8header.CarDescription = frminfo.EngineTypeBySoftwareVersion;
                        t8header.ChassisID = frminfo.ChassisID;
                        t8header.ReleaseDate = frminfo.ReleaseDate;
                        t8header.ProgrammerDevice = frminfo.ProgrammingDevice;
                        t8header.ProgrammerName = frminfo.ProgrammerName;
                        t8header.PartNumber = frminfo.PartNumber;
                        t8header.DeviceType = frminfo.HardwareType;
                        t8header.HardwareID = frminfo.HardwareID;
                        t8header.InterfaceDevice = frminfo.InterfaceDevice;
                        t8header.EcuDescription = frminfo.ECUDescription;
                        // only if enabled
                        if (frminfo.ChangeVINAndImmo)
                        {
                            t8header.UpdateVinAndImmoCode();
                        }
                        // We don't want this code atm, it's a bit unsafe
            #if (DEBUG)
                        //t8header.UpdatePIarea();
            #endif
                        UpdateChecksum(m_currentfile, m_appSettings.AutoChecksum);
                    }
                }
            }
        }
Example #13
0
        private void barButtonItem28_ItemClick(object sender, ItemClickEventArgs e)
        {
            // tune to stage 1!!!
            if (File.Exists(m_currentfile))
            {
                // read tuned marker to see if binary has been tuned before
                T8Header fh = new T8Header();
                fh.init(m_currentfile);
                PartNumberConverter pnc = new PartNumberConverter();
                ECUInformation ecuinfo = pnc.GetECUInfo(fh.PartNumber, "");

                // start window to ask user for desired horses (depending on E85 usage?)
                frmTuneBinary frmTune = new frmTuneBinary();
                if (frmTune.ShowDialog() == DialogResult.OK)
                {
                    int desiredHP = frmTune.DesiredHP;
                    bool carRunsE85 = frmTune.CarRunsE85;

                    // convert HP to torque and airmass
                    //int torque = PowerToTorque(desiredHP, 6000);
                    //int peaktorque = (110 * torque) / 100;
                    int peaktorque = frmTune.PeakTorque;
                    int maxairmass = TorqueToAirmass(peaktorque, carRunsE85);

                    // give user a warning if airmass/c > 1300 mg/c
                    if (maxairmass > 1300)
                    {
                        MessageBox.Show("Your maximum requested airmass exceeds 1300 mg/c [" + maxairmass.ToString() + " mg/c]. Please make sure all your other maps will support this airflow!", "Warning!", MessageBoxButtons.OK);
                    }

                    string msg = "Partnumber not recognized, tuning will continue anyway, please verify settings afterwards";
                    msg += Environment.NewLine + " desired airmass " + maxairmass.ToString() + " mg/c and peak torque " + peaktorque.ToString() + " Nm";
                    if (ecuinfo.Valid)
                    {
                        msg = "Partnumber " + fh.PartNumber + ", carmodel " + ecuinfo.Carmodel.ToString() + ", engine " + ecuinfo.Enginetype.ToString();
                        msg += Environment.NewLine + " desired airmass " + maxairmass.ToString() + " mg/c and peak torque " + peaktorque.ToString() + " Nm";
                    }
                    PSTaskDialog.cTaskDialog.ForceEmulationMode = false;
                    PSTaskDialog.cTaskDialog.EmulatedFormWidth = 600;
                    PSTaskDialog.cTaskDialog.UseToolWindowOnXP = false;
                    PSTaskDialog.cTaskDialog.VerificationChecked = true;
                    PSTaskDialog.cTaskDialog.ShowTaskDialogBox("Tune me up™ wizard", "This wizard will tune your binary.", "Several maps will be altered" + Environment.NewLine + msg, "Happy driving!!!\nDilemma © 2009", "The author does not take responsibility for any damage done to your car or other objects in any form!", "Show me a summary after tuning", "", "Yes, tune me up!|No thanks!", eTaskDialogButtons.None, eSysIcons.Information, eSysIcons.Warning);
                    switch (PSTaskDialog.cTaskDialog.CommandButtonResult)
                    {
                        case 0:
                            // tune to stage x
                            // must use fixed maps, scaled to be good for the current airmass (e.g. pedalrequest map)
                            //TuneToStageNew(1, maxairmass, peaktorque, desiredHP, ecuinfo.Enginetype, carRunsE85);
                            TuneMeUp(maxairmass, peaktorque, desiredHP, ecuinfo.Enginetype, carRunsE85);
                            break;
                        case 1:
                            // cancel
                            break;
                    }
                    if (PSTaskDialog.cTaskDialog.VerificationChecked && PSTaskDialog.cTaskDialog.CommandButtonResult != 1)
                    {
                        TuningReport tuningrep = new TuningReport();
                        tuningrep.DataSource = resumeTuning;
                        tuningrep.CreateReport();
                        tuningrep.ShowPreview(defaultLookAndFeel1.LookAndFeel);
                    }
                }
            }
        }
        private void LoadCompressorMapWithDetails()
        {
            // we should get the top line like for the chart

            if (gridControl1.DataSource != null)
            {
                TurboType tt = TurboType.TD0415T;
                if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.T25_55 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.T25_60 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT17)
                {
                    tt = TurboType.Stock;
                }
                else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD04 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0416T)
                {
                    tt = TurboType.TD0415T;
                }
                else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0418T || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.TD0419T)
                {
                    tt = TurboType.TD0419T;
                }
                else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT2871R || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT28RS)
                {
                    tt = TurboType.GT28RS;
                }
                else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT3071R86 || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT30R)
                {
                    tt = TurboType.GT3071R;
                }
                else if (ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.GT40R || ctrlCompressorMap1.Compressor == ctrlCompressorMap.CompressorMap.HX40W)
                {
                    tt = TurboType.HX40w;
                }
                DataTable dt = (DataTable)gridControl1.DataSource;
                double[] boost_req = new double[dt.Columns.Count];
                /*PressureToTorque ptt = new PressureToTorque();

                 <GS-09032011> changed to airmass calculation
                for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++)
                {
                    double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i));
                    // we get the airmass from this.. now convert to boost pressure
                    double trq = AirmassToTorque(Convert.ToInt32(o), Convert.ToInt32(x_axisvalues.GetValue(i)), checkEdit7.Checked);
                    double val = ptt.CalculatePressureFromTorque(trq, tt );
                    boost_req.SetValue(val, i);
                }*/

                for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++)
                {
                    double o = Convert.ToDouble(dt.Rows[0].ItemArray.GetValue(i));
                    boost_req.SetValue(o, i);
                }
                ctrlCompressorMap1.Boost_request = boost_req;
                // set rpm range
                ctrlCompressorMap1.Rpm_points = pedal_Xaxis;

                if (!ctrlCompressorMap1.IsInitiallyLoaded)
                {
                    T8Header header = new T8Header();
                    header.init(m_currentfile);
                    // Partnumber
                    //PartNumberConverter pnc = new PartNumberConverter();
                    //ECUInformation ecuinfo = pnc.GetECUInfo(header.PartNumber.Trim(), "");
                    //ecuinfo.Turbomodel;
                    // VIN
                    VINDecoder decoder = new VINDecoder();
                    VINCarInfo carinfo = decoder.DecodeVINNumber(header.ChassisID);
                    if (carinfo.TurboModel == VINTurboModel.MitsubishiTD04L_14T)
                    {
                        ctrlCompressorMap1.SetCompressorType(ctrlCompressorMap.CompressorMap.TD04);
                    }
                    else
                    {
                        ctrlCompressorMap1.SetCompressorType(ctrlCompressorMap.CompressorMap.GT17);
                    }

                    ctrlCompressorMap1.Current_engineType = ctrlCompressorMap.EngineType.Liter2;
                }

                ctrlCompressorMap1.IsInitiallyLoaded = true;
                ctrlCompressorMap1.Redraw();
            }
        }
        public static bool TryToLoadAdditionalBinSymbols(string filename, SymbolCollection coll2load)
        {
            // Look for a complete xml file first
            T8Header fh = new T8Header();
            fh.init(filename);
            string[] symbolFiles = Directory.GetFiles(System.Windows.Forms.Application.StartupPath, "*.xml");
            foreach (string symbolFile in symbolFiles)
            {
                string filenameWithoutExtension = Path.GetFileNameWithoutExtension(symbolFile);
                if (fh.SoftwareVersion.Trim().StartsWith(filenameWithoutExtension, StringComparison.OrdinalIgnoreCase))
                {
                    return TryToLoadAdditionalXMLSymbols(symbolFile, coll2load);
                }
            }

            // Secondly load the .xml file with same path and filename as the .bin file.
            string xmlfile = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename) + ".xml");
            return TryToLoadAdditionalXMLSymbols(xmlfile, coll2load);
        }