示例#1
0
 private void File_ExportToS19(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     SaveFileDialog sfd1 = new SaveFileDialog();
     sfd1.Filter = "S19 files|*.S19";
     sfd1.AddExtension = true;
     sfd1.DefaultExt = "S19";
     sfd1.OverwritePrompt = true;
     sfd1.Title = "Export file to motorola S19 format...";
     if (sfd1.ShowDialog() == DialogResult.OK)
     {
         srec2bin srec = new srec2bin();
         srec.ConvertBinToSrec(m_currentfile, sfd1.FileName);
     }
 }
示例#2
0
        private void barButtonItem62_ItemClick(object sender, ItemClickEventArgs e)
        {
            // write the required file for flashing the ECU
            // this is the current file, exported to S19 format in the directory that contains
            // the selected batchfile
            if (m_appSettings.Write_ecubatchfile != string.Empty)
            {
                try
                {
                    if (File.Exists(m_appSettings.Write_ecubatchfile))
                    {

                        if (!verifychecksum(false))
                        {
                            frmChecksumIncorrect check = new frmChecksumIncorrect();
                            if (m_appSettings.AutoChecksum)
                            {
                                UpdateChecksum(m_currentfile);
                                if (m_fileiss19)
                                {
                                    // automatisch terugschrijven
                                    srec2bin cnvrt = new srec2bin();
                                    cnvrt.ConvertBinToSrec(m_currentfile);
                                }

                            }
                            //else if (MessageBox.Show("Checksum invalid, auto correct?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            else if (check.ShowDialog() == DialogResult.Yes)
                            {
                                UpdateChecksum(m_currentfile);
                                if (m_fileiss19)
                                {
                                    // automatisch terugschrijven
                                    srec2bin cnvrt = new srec2bin();
                                    cnvrt.ConvertBinToSrec(m_currentfile);
                                }
                            }
                        }

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