public void FindStartAddress(string filename) { long address = Trionic7File.GetStartVectorAddress(filename); int offset = richTextBox1.Find(address.ToString("X8")); if (offset > 0) { richTextBox1.SelectionStart = offset; richTextBox1.SelectionLength = 8; richTextBox1.ScrollToCaret(); } }
private void exportAsTuningPackageToolStripMenuItem_Click(object sender, EventArgs e) { // well.. export the entire result set as a tuning package // export selected maps as tuning package (name the file t7p) // get selected rows //<GS-22022011> TODO: Let the user choose from which binary file he/she wants to export the data // the orginal file or the file that we compared to frmFileToExportSelection frmSelection = new frmFileToExportSelection(); frmSelection.SetOriginalFileName(m_OriginalFilename); frmSelection.SetCompareFileName(m_CompareFilename); if (frmSelection.ShowDialog() == DialogResult.OK) { DataTable dt = (DataTable)gridControl1.DataSource; SymbolCollection scToExport = new SymbolCollection(); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { string varname = dr["SYMBOLNAME"].ToString(); if (varname.StartsWith("Symbolnumber")) { varname = dr["Userdescription"].ToString(); } if (!varname.StartsWith("Symbolnumber") && !varname.StartsWith("overrun") && !varname.StartsWith("Data_name") && !varname.StartsWith("MapChkCal")) { if (frmSelection.UseOriginalFile) { foreach (SymbolHelper sh in m_originalSymbolCollection) { if (sh.SmartVarname == varname) { scToExport.Add(sh); break; } } } else { foreach (SymbolHelper sh in m_compareSymbolCollection) { if (sh.SmartVarname == varname) { scToExport.Add(sh); break; } } } } } frmSymbolSelection symsel = new frmSymbolSelection(); symsel.SetSymbolCollection(scToExport); symsel.SelectAllSymbols(); if (symsel.ShowDialog() == DialogResult.OK) { SymbolCollection scSelected = new SymbolCollection(); scSelected = symsel.GetSelectedSymbolCollection(); PackageExporter pe = new PackageExporter(); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Trionic 7 packages|*.t7p"; if (sfd.ShowDialog() == DialogResult.OK) { if (frmSelection.UseOriginalFile) { if (Trionic7File.IsSoftwareOpen(m_originalSymbolCollection)) { pe.AddressOffset = m_OriginalAddressOffset; } pe.ExportPackage(scSelected, m_OriginalFilename, sfd.FileName); } else { if (Trionic7File.IsSoftwareOpen(m_compareSymbolCollection)) { pe.AddressOffset = m_CompareAddressOffset; } pe.ExportPackage(scSelected, m_filename, sfd.FileName); } } } } } }