Exemple #1
0
        private void btnSaveAs_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (m_trionicFile != null)
            {
                if (m_trionicFile.Exists())
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.CheckFileExists = false;
                    sfd.CheckPathExists = true;
                    sfd.Filter = "Binary file|*.bin|Motorola S record format|*.S19";
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        if (!m_trionicFile.ValidateChecksum()) m_trionicFile.UpdateChecksum();
                        if (sfd.FileName.ToUpper().EndsWith("S19"))
                        {
                            srec2bin convert = new srec2bin();
                            if (!convert.ConvertBinToSrec(m_trionicFileInformation.Filename, sfd.FileName))
                            {
                                frmInfoBox info = new frmInfoBox("Failed to convert file to S19 format");
                            }
                        }
                        else
                        {
                            if (m_trionicFileInformation.Filename != sfd.FileName)
                            {
                                File.Copy(m_trionicFileInformation.Filename, sfd.FileName, true);
                            }

                        }
                    }
                }
            }
        }
Exemple #2
0
        private void OpenWorkingFile()
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = false;
            ofd.Filter = "Trionic 5 files|*.bin;*.s19";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                CloseProject();
                string filename = string.Empty;
                if (ofd.FileName.ToUpper().EndsWith("S19"))
                {
                    srec2bin cvt = new srec2bin();

                    cvt.ConvertSrecToBin(ofd.FileName, out filename);
                }
                else
                {
                    filename = ofd.FileName;
                }
                OpenWorkingFile(filename);
                m_appSettings.LastOpenedType = 0;
                SetDefaultFilters();
            }
        }
Exemple #3
0
        private void btnPeMicroProgramIntel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // write the required file for flashing the ECU (INTEL)
            // this is the current file, exported to S19 format in the directory that contains
            // the selected batchfile
            if (m_appSettings.Write_ecuIntelbatchfile != string.Empty)
            {
                try
                {
                    if (File.Exists(m_appSettings.Write_ecuIntelbatchfile))
                    {
                        m_trionicFile.UpdateChecksum();

                        srec2bin sr = new srec2bin();
                        sr.ConvertBinToSrec(m_trionicFileInformation.Filename);
                        // and copy it to the target directory
                        string fromfile = Path.GetDirectoryName(m_trionicFileInformation.Filename) + "\\" + Path.GetFileNameWithoutExtension(m_trionicFileInformation.Filename) + ".S19";
                        string destfile = Path.GetDirectoryName(m_appSettings.Write_ecuIntelbatchfile) + "\\TO_ECU.S19";
                        File.Copy(fromfile, destfile, true);
                        System.Diagnostics.Process.Start(m_appSettings.Write_ecuIntelbatchfile);
                    }
                    else
                    {
                        frmInfoBox info = new frmInfoBox("Batch file not found. Check parameters");
                    }
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message);
                }
            }
        }