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 t8p) // 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 8 packages|*.t8p"; if (sfd.ShowDialog() == DialogResult.OK) { if (frmSelection.UseOriginalFile) { pe.ExportPackage(scSelected, m_OriginalFilename, sfd.FileName); } else { pe.ExportPackage(scSelected, m_filename, sfd.FileName); } } } } } }
private void exportFixedTuningPackageToolStripMenuItem_Click(object sender, EventArgs e) { SymbolCollection scToExport = new SymbolCollection(); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Trionic 8 packages|*.t8p"; if (sfd.ShowDialog() == DialogResult.OK) { // add all relevant symbols to the export collection //SymbolHelper sh = new SymbolHelper(); // must contain Varname, FlashAddress, Length, Userdescription AddToSymbolCollection(scToExport, "AirCtrlCal.PRatioMaxTab"); AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmass"); AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmassAu"); AddToSymbolCollection(scToExport, "BFuelCal.TempEnrichFacMap"); AddToSymbolCollection(scToExport, "BFuelCal.E85TempEnrichFacMap"); AddToSymbolCollection(scToExport, "KnkFuelCal.EnrichmentMap"); AddToSymbolCollection(scToExport, "KnkFuelCal.fi_OffsetEnrichEnable"); AddToSymbolCollection(scToExport, "KnkFuelCal.fi_MaxOffsetMap"); AddToSymbolCollection(scToExport, "IgnAbsCal.fi_highOctanMAP"); AddToSymbolCollection(scToExport, "IgnAbsCal.fi_lowOctanMAP"); AddToSymbolCollection(scToExport, "IgnAbsCal.fi_NormalMAP"); AddToSymbolCollection(scToExport, "IgnAbsCal.fi_StartMAP"); AddToSymbolCollection(scToExport, "DNCompCal.SlowDriveRelTAB"); AddToSymbolCollection(scToExport, "TrqLimCal.Trq_ManGear"); AddToSymbolCollection(scToExport, "TrqLimCal.Trq_MaxEngineManTab1"); AddToSymbolCollection(scToExport, "TrqLimCal.Trq_MaxEngineAutTab1"); AddToSymbolCollection(scToExport, "TrqLimCal.Trq_MaxEngineManTab2"); AddToSymbolCollection(scToExport, "TrqLimCal.Trq_MaxEngineAutTab2"); AddToSymbolCollection(scToExport, "TrqLimCal.Trq_OverBoostTab"); AddToSymbolCollection(scToExport, "MaxEngSpdCal.n_EngMin"); AddToSymbolCollection(scToExport, "TrqMastCal.Trq_NominalMap"); AddToSymbolCollection(scToExport, "TrqMastCal.m_AirTorqMap"); AddToSymbolCollection(scToExport, "TMCCal.Trq_MaxEngineTab"); AddToSymbolCollection(scToExport, "TMCCal.Trq_MaxEngineLowTab"); AddToSymbolCollection(scToExport, "InjCorrCal.BattCorrSP"); AddToSymbolCollection(scToExport, "InjCorrCal.BattCorrTab"); AddToSymbolCollection(scToExport, "InjCorrCal.InjectorConst"); PackageExporter pe = new PackageExporter(); pe.ExportPackage(scToExport, m_currentfile, sfd.FileName); } }
void edit_FormClosed(object sender, FormClosedEventArgs e) { if (sender is frmEditTuningPackage) { frmEditTuningPackage edit = (frmEditTuningPackage)sender; if (edit.WriteData) { // save the package again with altered settings probably. //logger.Debug("We should write the tuning package here!"); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Trionic 8 packages|*.t8p"; if (sfd.ShowDialog() == DialogResult.OK) { System.Data.DataTable dt = edit.GetDataTable(); SymbolCollection scToExport = new SymbolCollection(); foreach (DataRow dr in dt.Rows) { SymbolHelper sh = new SymbolHelper(); sh.Varname = dr["Map"].ToString(); sh.Flash_start_address = GetSymbolAddress(m_symbols, sh.Varname); sh.Userdescription = GetUserDescription(m_symbols, sh.Varname); sh.Length = GetSymbolLength(m_symbols, sh.Varname); scToExport.Add(sh); } PackageExporter pe = new PackageExporter(); pe.ExportPackage(scToExport, m_currentfile, sfd.FileName); } } } }
private void exportAsTuningPackageToolStripMenuItem_Click(object sender, EventArgs e) { // export selected maps as tuning package (name the file t8p) // get selected rows int[] selectedrows = gridViewSymbols.GetSelectedRows(); SymbolCollection scToExport = new SymbolCollection(); if (selectedrows.Length > 0) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Trionic 8 packages|*.t8p"; if (sfd.ShowDialog() == DialogResult.OK) { int grouplevel = gridViewSymbols.GetRowLevel((int)selectedrows.GetValue(0)); if (grouplevel >= gridViewSymbols.GroupCount) { int[] selrows = gridViewSymbols.GetSelectedRows(); if (selrows.Length > 0) { for (int i = 0; i < selrows.Length; i++) { SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow((int)selrows.GetValue(i)); // make a copy? scToExport.Add(sh); } PackageExporter pe = new PackageExporter(); pe.ExportPackage(scToExport, m_currentfile, sfd.FileName); } } } } }
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 t8p) // 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 8 packages|*.t8p"; if (sfd.ShowDialog() == DialogResult.OK) { if (frmSelection.UseOriginalFile) { pe.ExportPackage(scSelected, m_OriginalFilename, sfd.FileName); } else { pe.ExportPackage(scSelected, m_filename, sfd.FileName); } } } } } }