Пример #1
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");
        }
Пример #2
0
 void airmassresult_onStartTableViewer(object sender, frmAirmassResult.StartTableViewerEventArgs e)
 {
     // start the table viewer
     StartTableViewer(e.SymbolName);
 }
Пример #3
0
 private void btnAirmassResult_ItemClick(object sender, ItemClickEventArgs e)
 {
     System.Windows.Forms.Application.DoEvents();
     if (CheckAllTablesAvailable())
     {
         // build a table that shows the maximum allowed airmass depending on the current limiters
         // table show be the same size as the pedalrequest map
         frmAirmassResult airmassresult = new frmAirmassResult();
         airmassresult.onStartTableViewer += new frmAirmassResult.StartTableViewer(airmassresult_onStartTableViewer);
         airmassresult.Currentfile = m_currentfile;
         airmassresult.Symbols = m_symbols;
         airmassresult.Calculate();
         airmassresult.Show(); // not dialog?
     }
 }