public void ShowSymbolCollection(SymbolCollection sc) { DataTable dt = new DataTable(); dt.Columns.Add("SYMBOLNAME"); dt.Columns.Add("DESCRIPTION"); dt.Columns.Add("XAXIS"); dt.Columns.Add("XAXISDESCRIPTION"); dt.Columns.Add("YAXIS"); dt.Columns.Add("YAXISDESCRIPTION"); SymbolAxesTranslator sat = new SymbolAxesTranslator(); SymbolTranslator symtrans = new SymbolTranslator(); string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory subcat = XDFSubCategory.Undocumented; string xaxis = string.Empty; string yaxis = string.Empty; string xaxisdescr = ""; string yaxisdescr = ""; string zaxisdescr = ""; foreach (SymbolHelper sh in sc) { string name = sh.SmartVarname; sat.GetAxisSymbols(name, out xaxis, out yaxis, out xaxisdescr, out yaxisdescr, out zaxisdescr); String symboldescr = symtrans.TranslateSymbolToHelpText(name, out helptext, out cat, out subcat); if (xaxis != "") { xaxisdescr = symtrans.TranslateSymbolToHelpText(xaxis, out helptext, out cat, out subcat); } if (yaxis != "") { yaxisdescr = symtrans.TranslateSymbolToHelpText(yaxis, out helptext, out cat, out subcat); } if (xaxis != "" || yaxis != "") { dt.Rows.Add(name, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr); } } gridControl1.DataSource = dt; }
public bool CheckAndFillCollection(SymbolCollection sc) { bool retval = false; // first check whether we have a "blank" file bool _hasSymbolNumbers = false; sc.SortColumn = "Symbol_number"; sc.SortingOrder = GenericComparer.SortOrder.Ascending; sc.Sort(); foreach (SymbolHelper sh in sc) { if (sh.Varname.StartsWith("Symbolnumber")) { _hasSymbolNumbers = true; break; } } // check known symbol length if (_hasSymbolNumbers) { int MapIndex = 0; int KnkFuelCalfi_MaxOffsetMap_Index = 0; int TrqMastCalm_AirTorqMap_Index = 0; int TrqMastCalX_AccPedalMAP_Index = 0; int BstKnkCalMaxAirmass_Index = 0; int BstKnkCalMaxAirmassAu_Index = 0; int PedalMapCalTrq_RequestMap_Index = 0; int PedalMapCalTrq_RequestSportMap_Index = 0; int KnkDetCalfi_knkWinOffsMAP_Index = 0; int KnkDetCalfi_knkWinSizeMAP_Index = 0; int InjAnglCalMap_Index = 0; bool _reverse288Maps = false; if (SequenceOf512Maps(sc, 1, 2, 1, 2, 2, 1)) { if (SequenceOf576Maps(sc, 1, 1, 1, 2, 1, 2)) // new file from JZW { //2 = KnkDetCal.fi_KnkWinOffsMap //3 = KnkDetCal.fi_KnkWinSizeMap //7 = TrqMastCal.m_AirTorqMap //8 = TrqMastCal.X_AccPedalMAP KnkFuelCalfi_MaxOffsetMap_Index = 4; KnkDetCalfi_knkWinOffsMAP_Index = 2; KnkDetCalfi_knkWinSizeMAP_Index = 3; InjAnglCalMap_Index = 1; PedalMapCalTrq_RequestMap_Index = 5; PedalMapCalTrq_RequestSportMap_Index = 6; TrqMastCalm_AirTorqMap_Index = 7; TrqMastCalX_AccPedalMAP_Index = 8; BstKnkCalMaxAirmass_Index = 9; _reverse288Maps = true; } else { KnkFuelCalfi_MaxOffsetMap_Index = 1; TrqMastCalm_AirTorqMap_Index = 2; TrqMastCalX_AccPedalMAP_Index = 3; BstKnkCalMaxAirmass_Index = 4; PedalMapCalTrq_RequestMap_Index = 5; PedalMapCalTrq_RequestSportMap_Index = 6; KnkDetCalfi_knkWinOffsMAP_Index = 7; KnkDetCalfi_knkWinSizeMAP_Index = 8; InjAnglCalMap_Index = 9; } } else if (SequenceOf512Maps(sc, 2, 1, 1, 2, 1, 2)) { BstKnkCalMaxAirmass_Index = 1; BstKnkCalMaxAirmassAu_Index = 2; InjAnglCalMap_Index = 3; KnkFuelCalfi_MaxOffsetMap_Index = 4; KnkDetCalfi_knkWinOffsMAP_Index = 5; KnkDetCalfi_knkWinSizeMAP_Index = 6; PedalMapCalTrq_RequestMap_Index = 7; TrqMastCalm_AirTorqMap_Index = 8; TrqMastCalX_AccPedalMAP_Index = 9; } else { BstKnkCalMaxAirmass_Index = 1; TrqMastCalm_AirTorqMap_Index = 2; TrqMastCalX_AccPedalMAP_Index = 3; InjAnglCalMap_Index = 4; KnkFuelCalfi_MaxOffsetMap_Index = 5; PedalMapCalTrq_RequestMap_Index = 6; PedalMapCalTrq_RequestSportMap_Index = 7; KnkDetCalfi_knkWinOffsMAP_Index = 8; KnkDetCalfi_knkWinSizeMAP_Index = 9; } // set the 512 map indexes correctly /* * 2008 file: (1,2,1,2,2,1) * * 9*512 map * * KnkFuelCal.fi_MaxOffsetMap 1039 1 * TrqMastCal.m_AirTorqMap 2344 2 * TrqMastCal.X_AccPedalMAP 2345 * BstKnkCal.MaxAirmass 3192 1 * PedalMapCal.Trq_RequestMap 5820 2 * PedalMapCal.Trq_RequestSportMap 5821 * KnkDetCal.fi_knkWinOffsMAP 6749 2 * KnkDetCal.fi_knkWinSizeMAP 6750 * InjAnglCal.Map 6815 1 * * 2007 file: (2,1,1,2,1,2) * * 9*512 map * BstKnkCal.MaxAirmass 316 * BstKnkCal.MaxAirmassAu 317 * InjAnglCal.Map 2489 * KnkFuelCal.fi_MaxOffsetMap 2517 * KnkDetCal.fi_knkWinOffsMAP 3311 * KnkDetCal.fi_knkWinSizeMAP 3312 * PedalMapCal.Trq_RequestMap 5962 * TrqMastCal.m_AirTorqMap 6254 * TrqMastCal.X_AccPedalMAP 6255 * * Non working file 2007: (1,2,1,1,2,2) * * BstKnkCal.MaxAirmass 512 1 * TrqMastCal.m_AirTorqMap 2186 2 * TrqMastCal.X_AccPedalMAP 2187 * InjAnglCal.Map 2981 1 * KnkFuelCal.fi_MaxOffsetMap 4496 1 * PedalMapCal.Trq_RequestMap 5771 2 * PedalMapCal.Trq_RequestSportMap 5772 * KnkDetCal.fi_knkWinOffsMAP 6373 2 * KnkDetCal.fi_knkWinSizeMAP 6374 * * * */ MapIndex = SetMapName(sc, 70, 1, "FCutCal.FuelFactorMAP"); SetMapNameByIndex(sc, MapIndex - 1, 10, "FCutCal.T_EngineSP"); SetMapNameByIndex(sc, MapIndex - 2, 14, "FCutCal.nCombSinceFuelCutSP"); SetMapNameByIndex(sc, MapIndex - 6, 2, "FCutCal.m_AirInletTime"); SetMapNameByIndex(sc, MapIndex - 7, 2, "FCutCal.m_AirInletLimit"); MapIndex = SetMapName(sc, 504, 1, "AfterStCal.StartMAP"); SetMapNameByIndex(sc, MapIndex + 1, 28, "AfterStCal.n_CombXSP"); SetMapNameByIndex(sc, MapIndex + 2, 36, "AfterStCal.T_EngineYSP"); SetMapNameByIndex(sc, MapIndex + 3, 112, "AfterStCal.AmbientMAP"); SetMapNameByIndex(sc, MapIndex + 4, 8, "AfterStCal.p_AirAmbientYSP"); SetMapName(sc, 480, 1, "EngTipLimCal.X_Koeff"); SetMapName(sc, 672, 1, "EngTipNormCal.Trq_BacklashTipOutMap"); SetMapName(sc, 672, 2, "EngTipSportCal.Trq_BacklashTipOutMap"); // very probable SetMapName(sc, 512, /*1*/ KnkFuelCalfi_MaxOffsetMap_Index, "KnkFuelCal.fi_MaxOffsetMap"); MapIndex = SetMapName(sc, 512, /*2*/ TrqMastCalm_AirTorqMap_Index, "TrqMastCal.m_AirTorqMap"); SetMapNameByIndex(sc, MapIndex - 2, 576, "TrqMastCal.Trq_MBTMAP"); // maybe use search first match from current index SetMapNameByIndex(sc, MapIndex - 1, 576, "TrqMastCal.Trq_NominalMap"); SetMapNameByIndex(sc, MapIndex + 1, 512, "TrqMastCal.X_AccPedalMAP"); SetMapNameByIndex(sc, MapIndex + 2, 72, "TrqMastCal.IgnAngleDiffSP"); SetMapNameByIndex(sc, MapIndex + 3, 72, "TrqMastCal.TLO_TAB"); SetMapNameByIndex(sc, MapIndex + 4, 32, "TrqMastCal.n_EngineYSP"); // TrqMastCal.n_EngineYSP/n_EngYSP SetMapNameByIndex(sc, MapIndex + 5, 32, "TrqMastCal.n_EngineXSP"); SetMapNameByIndex(sc, MapIndex + 6, 8, "TrqMastCal.n_MaxDerXSP"); SetMapNameByIndex(sc, MapIndex + 7, 32, "TrqMastCal.Trq_EngXSP"); SetMapNameByIndex(sc, MapIndex + 8, 32, "TrqMastCal.Trq_PedYSP"); SetMapNameByIndex(sc, MapIndex + 9, 32, "TrqMastCal.Trq_MaxDerIncMAP"); SetMapNameByIndex(sc, MapIndex + 10, 32, "TrqMastCal.Trq_MaxDerDecMAP"); SetMapNameByIndex(sc, MapIndex + 11, 2, "TrqMastCal.Trq_MaxDerShift"); SetMapNameByIndex(sc, MapIndex + 12, 36, "TrqMastCal.m_AirXSP"); SetMapName(sc, 512, /*3*/ TrqMastCalX_AccPedalMAP_Index, "TrqMastCal.X_AccPedalMAP"); MapIndex = SetMapName(sc, 512, /*4*/ BstKnkCalMaxAirmass_Index, "BstKnkCal.MaxAirmass"); SetMapNameByIndex(sc, MapIndex - 1, 32, "BstKnkCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex - 2, 32, "BstKnkCal.OffsetXSP"); if (BstKnkCalMaxAirmassAu_Index > 0) { MapIndex = SetMapName(sc, 512, /*4*/ BstKnkCalMaxAirmassAu_Index, "BstKnkCal.MaxAirmassAu"); } SetMapName(sc, 512, /*5*/ PedalMapCalTrq_RequestMap_Index, "PedalMapCal.Trq_RequestMap"); if (PedalMapCalTrq_RequestSportMap_Index > 0) { SetMapName(sc, 512, /*6*/ PedalMapCalTrq_RequestSportMap_Index, "PedalMapCal.Trq_RequestSportMap"); } SetMapName(sc, 512, /*7*/ KnkDetCalfi_knkWinOffsMAP_Index, "KnkDetCal.fi_knkWinOffsMAP"); SetMapName(sc, 512, /*8*/ KnkDetCalfi_knkWinSizeMAP_Index, "KnkDetCal.fi_knkWinSizeMAP"); MapIndex = SetMapName(sc, 512, /*9*/ InjAnglCalMap_Index, "InjAnglCal.Map"); SetMapNameByIndex(sc, MapIndex - 1, 32, "InjAnglCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 2, 32, "InjAnglCal.AirXSP"); MapIndex = SetMapName(sc, 384, 1, "AirMassMastCal.m_AirMBTMAP"); SetMapNameByIndex(sc, MapIndex - 1, 24, "AirMassMastCal.Trq_MBTXSP"); SetMapNameByIndex(sc, MapIndex - 2, 32, "AirMassMastCal.n_EngMBTYSP"); MapIndex = SetMapName(sc, 384, 2, "IgnAbsCal.fi_IgnMBTMAP"); SetMapNameByIndex(sc, MapIndex - 1, 32, "IgnAbsCal.n_EngMBTYSP"); SetMapNameByIndex(sc, MapIndex - 2, 24, "IgnAbsCal.m_AirMBTXSP"); SetMapNameByIndex(sc, MapIndex + 1, 576, "IgnAbsCal.fi_highOctanMAP"); SetMapNameByIndex(sc, MapIndex + 2, 576, "IgnAbsCal.fi_lowOctanMAP"); SetMapNameByIndex(sc, MapIndex + 3, 576, "IgnAbsCal.fi_NormalMAP"); SetMapNameByIndex(sc, MapIndex + 4, 36, "IgnAbsCal.m_AirNormXSP"); SetMapNameByIndex(sc, MapIndex + 5, 32, "IgnAbsCal.n_EngNormYSP"); MapIndex = SetMapName(sc, 320, 1, "IgnAbsCal.fi_FuelCutMAP"); SetMapNameByIndex(sc, MapIndex - 1, 32, "IgnAbsCal.n_EngFuelCutYSP"); SetMapNameByIndex(sc, MapIndex - 2, 20, "IgnAbsCal.T_EngFuelCutXSP"); SetMapNameByIndex(sc, MapIndex + 1, 20, "IgnAbsCal.T_EngStartXSP"); SetMapNameByIndex(sc, MapIndex + 2, 16, "IgnAbsCal.n_EngStartYSP"); SetMapNameByIndex(sc, MapIndex + 3, 160, "IgnAbsCal.fi_StartMAP"); MapIndex = SetMapName(sc, 306, 1, "OilTempCal.T_SpeedAndLoadDecreaseMap"); SetMapNameByIndex(sc, MapIndex - 1, 34, "OilTempCal.v_VehicleYSP"); SetMapNameByIndex(sc, MapIndex - 2, 18, "OilTempCal.T_AirInletXSP"); //<GS-29082011> /* * 4 maps length 288 (0x120) means biopower for T8. * * 1st = BFuelCal.LambdaOneFacMap * 2nd = BFuelCal.TempEnrichFacMap * 3rd = BFuelCal.E85TempEnrichFacMap * 4th = MAFCal.NormAdjustFacMap * */ if (SymbolCountOfLength(sc, 288) == 4) { // biopower MapIndex = SetMapName(sc, 288, 1, "BFuelCal.LambdaOneFacMap"); SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP"); SetMapName(sc, 288, 2, "BFuelCal.E85TempEnrichFacMap"); SetMapName(sc, 288, 3, "BFuelCal.TempEnrichFacMap"); SetMapName(sc, 288, 4, "MAFCal.NormAdjustFacMap"); } else { if (!_reverse288Maps) { MapIndex = SetMapName(sc, 288, 1, "BFuelCal.LambdaOneFacMap"); SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP"); SetMapName(sc, 288, 2, "BFuelCal.TempEnrichFacMap"); SetMapName(sc, 288, 3, "MAFCal.NormAdjustFacMap"); } else { MapIndex = SetMapName(sc, 288, 2, "BFuelCal.LambdaOneFacMap"); SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP"); SetMapName(sc, 288, 3, "BFuelCal.TempEnrichFacMap"); SetMapName(sc, 288, 1, "MAFCal.NormAdjustFacMap"); } } SetMapName(sc, 256, 1, "AirCtrlCal.RegMap"); MapIndex = SetMapName(sc, 256, 2, "PedalMapCal.GainFactorMap"); SetMapNameByIndex(sc, MapIndex - 1, 16, "PedalMapCal.GainFactorYSP"); SetMapNameByIndex(sc, MapIndex - 3, 2, "PedalMapCal.T_SportModeEnable"); SetMapNameByIndex(sc, MapIndex - 10, 2, "PedalMapCal.SportFactor"); SetMapNameByIndex(sc, MapIndex - 14, 512, "PedalMapCal.Trq_RequestSportMap"); SetMapNameByIndex(sc, MapIndex - 15, 512, "PedalMapCal.Trq_RequestMap"); SetMapNameByIndex(sc, MapIndex - 16, 32, "PedalMapCal.X_PedalMap"); SetMapNameByIndex(sc, MapIndex - 17, 32, "PedalMapCal.n_EngineMap"); SetMapName(sc, 224, 1, "MAFCal.WeightConstMap"); MapIndex = SetMapName(sc, 220, 1, "IgnTempCal.T_AirInletReferenceMap"); SetMapNameByIndex(sc, MapIndex - 1, 22, "IgnTempCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex - 2, 20, "IgnTempCal.m_AirXSP"); SetMapName(sc, 220, 2, "IgnTempCal.fi_OffsetMaxAirInletMap"); SetMapName(sc, 220, 3, "IgnTempCal.T_MaxAirInletMap"); SetMapName(sc, 220, 4, "IgnTempCal.fi_OffsetMinAirInletMap"); SetMapName(sc, 220, 5, "IgnTempCal.T_MinAirInletMap"); SetMapName(sc, 220, 6, "IgnTempCal.fi_OffsetMaxTEngMap"); SetMapName(sc, 220, 7, "IgnTempCal.fi_OffsetMinTEngMap"); MapIndex = SetMapName(sc, 208, 1, "AfterStCal.HotSoakMAP"); SetMapNameByIndex(sc, MapIndex + 2, 26, "AfterStCal.t_soakXSP"); SetMapNameByIndex(sc, MapIndex + 4, 16, "AfterStCal.T_EngineYSP2"); MapIndex = SetMapName(sc, 204, 1, "IgnMastCal.dwellTimeMap"); SetMapNameByIndex(sc, MapIndex + 1, 34, "IgnMastCal.n_EngDwellTimeYSP"); SetMapNameByIndex(sc, MapIndex + 2, 12, "IgnMastCal.UBattDwellTimeXSP"); MapIndex = SetMapName(sc, 200, 1, "ExhaustCal.T_fiIgnMap"); SetMapNameByIndex(sc, MapIndex - 1, 20, "ExhaustCal.fi_IgnSP"); SetMapNameByIndex(sc, MapIndex - 4, 20, "ExhaustCal.m_AirSP"); SetMapNameByIndex(sc, MapIndex + 1, 576, "ExhaustCal.T_Lambda1Map"); SetMapNameByIndex(sc, MapIndex + 4, 576, "TrqMastCal.Trq_MBTMAP"); // maybe use search first match from current index SetMapNameByIndex(sc, MapIndex + 5, 576, "TrqMastCal.Trq_NominalMap"); SetMapNameByIndex(sc, MapIndex + 6, 512, "TrqMastCal.m_AirTorqMap"); SetMapNameByIndex(sc, MapIndex + 7, 512, "TrqMastCal.X_AccPedalMAP"); SetMapNameByIndex(sc, MapIndex + 8, 72, "TrqMastCal.IgnAngleDiffSP"); SetMapNameByIndex(sc, MapIndex + 9, 72, "TrqMastCal.TLO_TAB"); SetMapNameByIndex(sc, MapIndex + 10, 32, "TrqMastCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 11, 32, "TrqMastCal.n_EngXSP"); SetMapNameByIndex(sc, MapIndex + 12, 8, "TrqMastCal.n_MaxDerXSP"); SetMapNameByIndex(sc, MapIndex + 13, 32, "TrqMastCal.Trq_EngXSP"); SetMapNameByIndex(sc, MapIndex + 14, 32, "TrqMastCal.Trq_PedYSP"); SetMapNameByIndex(sc, MapIndex + 15, 32, "TrqMastCal.Trq_MaxDerIncMAP"); SetMapNameByIndex(sc, MapIndex + 16, 32, "TrqMastCal.Trq_MaxDerDecMAP"); SetMapNameByIndex(sc, MapIndex + 17, 2, "TrqMastCal.Trq_MaxDerShift"); SetMapNameByIndex(sc, MapIndex + 18, 36, "TrqMastCal.m_AirXSP"); MapIndex = SetMapName(sc, 192, 1, "AirCtrlCal.m_AirBoostHighAltOffsMAP"); SetMapNameByIndex(sc, MapIndex - 1, 24, "AirCtrlCal.p_AirAmbientYSP"); SetMapNameByIndex(sc, MapIndex - 2, 16, "AirCtrlCal.p_AfterTurbineXSP"); MapIndex = SetMapName(sc, 192, 2, "IgnMastCal.MinMap"); SetMapNameByIndex(sc, MapIndex + 1, 24, "IgnMastCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 2, 16, "IgnMastCal.m_AirXSP"); MapIndex = SetMapName(sc, 168, 1, "IgnKnkCal.RetardIndexMap"); SetMapNameByIndex(sc, MapIndex - 1, 24, "IgnKnkCal.n_EngIndexYSP"); SetMapNameByIndex(sc, MapIndex - 2, 14, "IgnKnkCal.m_AirIndexXSP"); SetMapNameByIndex(sc, MapIndex - 6, 32, "IgnKnkCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex - 7, 36, "IgnKnkCal.m_AirXSP"); MapIndex = SetMapName(sc, 168, 2, "IgnKnkCal.ARetardIndexMap"); SetMapNameByIndex(sc, MapIndex + 1, 576, "IgnKnkCal.IndexMap"); MapIndex = SetMapName(sc, 168, 3, "KnkDetCal.X_hystOffsetMAP"); MapIndex = SetMapName(sc, 168, 4, "KnkDetCal.X_AHystOffsetMAP"); MapIndex = SetMapName(sc, 160, 1, "MisfCal.m_LoadLevelMAT"); SetMapNameByIndex(sc, MapIndex + 1, 36, "MisfCal.m_AirXSP"); SetMapNameByIndex(sc, MapIndex + 4, 576, "MisfCal.CatOverheatFactorMAT"); SetMapNameByIndex(sc, MapIndex + 7, 32, "MisfCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 10, 10, "MisfCal.T_EngXSP"); if (_reverse288Maps) { MapIndex = SetMapName(sc, 576, 12, "KnkFuelCal.EnrichmentMap", 1, 576); SetMapNameByIndex(sc, MapIndex + 1, 576, "KnkFuelCal.fi_OffsetEnrichEnable"); SetMapNameByIndex(sc, MapIndex + 2, 576, "KnkFuelCal.fi_MaxOffsetMap"); SetMapNameByIndex(sc, MapIndex + 3, 32, "KnkFuelCal.m_AirXSP"); } else { MapIndex = SetMapName(sc, 576, 2, "KnkFuelCal.EnrichmentMap", 1, 576); SetMapNameByIndex(sc, MapIndex + 1, 576, "KnkFuelCal.fi_OffsetEnrichEnable"); SetMapNameByIndex(sc, MapIndex + 2, 576, "KnkFuelCal.fi_MaxOffsetMap"); SetMapNameByIndex(sc, MapIndex + 3, 32, "KnkFuelCal.m_AirXSP"); } SetMapName(sc, 160, 2, "IgnAbsCal.fi_StartMAP"); SetMapName(sc, 140, 1, "FuelCutInhibitCal.FCIFaultCodeList"); SetMapName(sc, 130, 1, "VIOSMAFCal.TicksSP"); SetMapName(sc, 130, 2, "VIOSMAFCal.Q_AirInletTab"); if (_reverse288Maps) { SetMapName(sc, 98, 1, "AirCtrlCal.Ppart_BoostMap"); SetMapName(sc, 98, 2, "AirCtrlCal.Ipart_BoostMap"); MapIndex = SetMapName(sc, 98, 3, "AirCtrlCal.Dpart_BoostMap"); } else { SetMapName(sc, 98, 3, "AirCtrlCal.Ppart_BoostMap"); SetMapName(sc, 98, 4, "AirCtrlCal.Ipart_BoostMap"); MapIndex = SetMapName(sc, 98, 5, "AirCtrlCal.Dpart_BoostMap"); } SetMapNameByIndex(sc, MapIndex + 1, 14, "AirCtrlCal.PIDXSP"); SetMapNameByIndex(sc, MapIndex + 2, 14, "AirCtrlCal.PIDYSP"); SetMapNameByIndex(sc, MapIndex + 3, 2, "AirCtrlCal.IPart_BoostCoAirM1"); SetMapNameByIndex(sc, MapIndex + 4, 2, "AirCtrlCal.m_IFacMax"); SetMapNameByIndex(sc, MapIndex + 5, 2, "AirCtrlCal.FilterFactor"); SetMapNameByIndex(sc, MapIndex + 6, 32, "AirCtrlCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 7, 2, "AirCtrlCal.Hysteres"); SetMapNameByIndex(sc, MapIndex + 8, 16, "AirCtrlCal.SetLoadXSP"); SetMapNameByIndex(sc, MapIndex + 9, 256, "AirCtrlCal.RegMap"); // find torquelimiters automatically int state = 0; int symIndex = 0; int symCounter = 0; bool limitersFound = false; foreach (SymbolHelper sh in sc) { //if (state > 0) logger.Debug("State = " + state.ToString() + " symcount: " + symCounter.ToString()); switch (state) { case 0: if (sh.Length == 16) { state++; } break; case 1: if (sh.Length == 2) { state++; } else { state = 0; } break; case 2: if (sh.Length == 32) { state++; } else { state = 0; } break; case 3: if (sh.Length == 32) { state++; } else { state = 0; } break; case 4: if (sh.Length == 32) { state++; } else { state = 0; } break; case 5: if (sh.Length == 32) { state++; } else { state = 0; } break; case 6: if (sh.Length == 2) { state++; } else { state = 0; } break; case 7: if (sh.Length == 2) { state++; } else { state = 0; } break; case 8: if (sh.Length == 2) { state++; } else { state = 0; } break; case 9: if (sh.Length == 32) { state++; } else { state = 0; } break; case 10: if (sh.Length == 32) { state++; } else { state = 0; } break; case 11: symIndex = sh.Symbol_number; break; } symCounter++; if (symIndex > 0) { break; } } if (symIndex > 0) { logger.Debug("(I) Found index: " + symIndex.ToString()); limitersFound = true; // - 11 = TrqLimCal.Trq_ManGear SetMapNameByIndex(sc, symIndex - 11, 16, "TrqLimCal.Trq_ManGear"); SetMapNameByIndex(sc, symIndex - 9, 32, "TrqLimCal.Trq_MaxEngineManTab1"); SetMapNameByIndex(sc, symIndex - 8, 32, "TrqLimCal.Trq_MaxEngineAutTab1"); SetMapNameByIndex(sc, symIndex - 7, 32, "TrqLimCal.Trq_MaxEngineManTab2"); SetMapNameByIndex(sc, symIndex - 6, 32, "TrqLimCal.Trq_MaxEngineAutTab2"); SetMapNameByIndex(sc, symIndex - 2, 32, "TrqLimCal.n_EngYSP"); SetMapNameByIndex(sc, symIndex - 1, 32, "TrqLimCal.Trq_OverBoostTab"); SetMapNameByIndex(sc, symIndex + 7, 24, "TrqLimCal.CompressorNoiseYSP"); SetMapNameByIndex(sc, symIndex + 8, 6, "TrqLimCal.CompressorNoiseXSP"); SetMapNameByIndex(sc, symIndex + 9, 72, "TrqLimCal.Trq_CompressorNoiseRedLimMAP"); } if (!limitersFound) { state = 0; symIndex = 0; symCounter = 0; foreach (SymbolHelper sh in sc) { //if (state > 0) logger.Debug("State = " + state.ToString() + " symcount: " + symCounter.ToString()); switch (state) { case 0: if (sh.Length == 16) { state++; } break; case 1: if (sh.Length == 2) { state++; } else { state = 0; } break; case 2: if (sh.Length == 32) { state++; } else { state = 0; } break; case 3: if (sh.Length == 32) { state++; } else { state = 0; } break; case 4: if (sh.Length == 2) { state++; } else { state = 0; } break; case 5: if (sh.Length == 2) { state++; } else { state = 0; } break; case 6: if (sh.Length == 2) { state++; } else { state = 0; } break; case 7: if (sh.Length == 32) { state++; } else { state = 0; } break; case 8: if (sh.Length == 32) { state++; } else { state = 0; } break; case 9: symIndex = sh.Symbol_number; state++; break; case 10: break; } symCounter++; if (symIndex > 0) { break; } } } if (symIndex > 0) { logger.Debug("(II) Found index: " + symIndex.ToString()); limitersFound = true; // - 9 = TrqLimCal.Trq_ManGear SetMapNameByIndex(sc, symIndex - 9, 16, "TrqLimCal.Trq_ManGear"); SetMapNameByIndex(sc, symIndex - 7, 32, "TrqLimCal.Trq_MaxEngineManTab1"); SetMapNameByIndex(sc, symIndex - 6, 32, "TrqLimCal.Trq_MaxEngineAutTab1"); SetMapNameByIndex(sc, symIndex - 2, 32, "TrqLimCal.n_EngYSP"); SetMapNameByIndex(sc, symIndex - 1, 32, "TrqLimCal.Trq_OverBoostTab"); SetMapNameByIndex(sc, symIndex + 7, 24, "TrqLimCal.CompressorNoiseYSP"); SetMapNameByIndex(sc, symIndex + 8, 6, "TrqLimCal.CompressorNoiseXSP"); SetMapNameByIndex(sc, symIndex + 9, 72, "TrqLimCal.Trq_CompressorNoiseRedLimMAP"); } SymbolTranslator st = new SymbolTranslator(); foreach (SymbolHelper sh in sc) { string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory sub = XDFSubCategory.Undocumented; sh.Description = st.TranslateSymbolToHelpText(sh.Userdescription, out helptext, out cat, out sub); if (sh.Category == "Undocumented" || sh.Category == "") { sh.createAndUpdateCategory(sh.Userdescription); } } } return(retval); }
/// <summary> /// /// </summary> /// <param name="symbol_collection"></param> /// <param name="allSymbolNames"></param> private static void AddNamesToSymbols(SymbolCollection symbol_collection, string[] allSymbolNames) { for (int i = 0; i < allSymbolNames.Length - 1; i++) { try { CastProgressEvent("Adding symbol names: ", (int)(((float)i / (float)allSymbolNames.Length) * 100)); SymbolHelper sh = symbol_collection[(i)]; sh.Varname = allSymbolNames[i + 1].Trim(); // Skip first in array since its "SymbolNames" logger.Debug(String.Format("Set symbolnumber: {0} to be {1}", sh.Symbol_number, sh.Varname)); SymbolTranslator translator = new SymbolTranslator(); string help = string.Empty; XDFCategories category = XDFCategories.Undocumented; XDFSubCategory subcat = XDFSubCategory.Undocumented; sh.Description = translator.TranslateSymbolToHelpText(sh.Varname, out help, out category, out subcat); if (sh.Varname.Contains(".")) { try { sh.Category = sh.Varname.Substring(0, sh.Varname.IndexOf(".")); } catch (Exception cE) { logger.Debug(String.Format("Failed to assign category to symbol: {0} err: {1}", sh.Varname, cE.Message)); } } } catch (Exception E) { logger.Debug("Failed to add symbolnames: " + E.Message); } } }
private static void ImportSymbols(System.Data.DataTable dt, SymbolCollection coll2load) { SymbolTranslator st = new SymbolTranslator(); int numSym = coll2load.Count; int cnt = 0; foreach (SymbolHelper sh in coll2load) { cnt = cnt + 1; CastProgressEvent("Importing symbols: ", (int)(((float)cnt / (float)numSym) * 100)); foreach (DataRow dr in dt.Rows) { try { if (dr["SYMBOLNAME"].ToString() == sh.Varname) { if (sh.Flash_start_address == Convert.ToInt32(dr["FLASHADDRESS"])) { // Swap varname and userdescription if (sh.Varname == String.Format("Symbolnumber {0}", sh.Symbol_number)) { sh.Userdescription = sh.Varname; sh.Varname = dr["DESCRIPTION"].ToString(); } else { sh.Userdescription = dr["DESCRIPTION"].ToString(); } string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory sub = XDFSubCategory.Undocumented; sh.Description = st.TranslateSymbolToHelpText(sh.Varname, out helptext, out cat, out sub); if (sh.Category == "Undocumented" || sh.Category == "") { sh.createAndUpdateCategory(sh.Varname); } break; } } } catch (Exception E) { logger.Debug(E.Message); } } } CastProgressEvent("Completed", 0); }
private double GetMapCorrectionFactor(string symbolname) { double returnvalue = 1; try { SymbolTranslator st = new SymbolTranslator(); string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory subcat = XDFSubCategory.Undocumented; string text = st.TranslateSymbolToHelpText(symbolname, out helptext, out cat, out subcat); if (helptext.Contains("Resolution is")) { int idx = helptext.IndexOf("Resolution is"); idx += 14; string value = helptext.Substring(idx).Trim(); if (value.Contains(" ")) { int idx2 = value.IndexOf(" "); value = value.Substring(0, idx2); value = ClearToNumber(value); returnvalue = ConvertToDouble(value); } else { value = ClearToNumber(value); returnvalue = ConvertToDouble(value); } } } catch (Exception E) { logger.Debug(E.Message); } if (returnvalue == 0) returnvalue = 1; if (symbolname == "KnkSoundRedCal.fi_OffsMa") returnvalue = 0.1; else if (symbolname == "IgnE85Cal.fi_AbsMap") returnvalue = 0.1; else if (symbolname == "MAFCal.cd_ThrottleMap") returnvalue = 0.0009765625; else if (symbolname == "TrqMastCal.Trq_NominalMap") returnvalue = 0.1; else if (symbolname == "TrqMastCal.Trq_MBTMAP") returnvalue = 0.1; else if (symbolname == "AfterStCal.StartMAP") returnvalue = 0.0009765625; // 1/1024 else if (symbolname == "KnkFuelCal.EnrichmentMap") returnvalue = 0.0009765625; // 1/1024 else if (symbolname == "AfterStCal.HotSoakMAP") returnvalue = 0.0009765625; // 1/1024 else if (symbolname == "MAFCal.NormAdjustFacMap") returnvalue = 0.0078125; // 1/128 else if (symbolname == "BFuelCal.LambdaOneFacMap") returnvalue = 0.0078125; // 1/128 else if (symbolname == "BFuelCal.TempEnrichFacMap") returnvalue = 0.0078125; // 1/128 else if (symbolname == "BFuelCal.E85TempEnrichFacMap") returnvalue = 0.0078125; // 1/128 else if (symbolname == "AfterStCal.AmbientMAP") returnvalue = 0.0078125; // 1/128 else if (symbolname == "FFFuelCal.KnkEnrichmentMAP") returnvalue = 0.0078125; // 1/128 else if (symbolname == "FFFuelCal.TempEnrichFacMAP") returnvalue = 0.0078125; // 1/128 /** vanaf hier */ returnvalue = SymbolDictionary.GetSymbolUnit(symbolname); /** tot hier **/ // //MAFCal.NormAdjustFacMap (correctionfactor = 1/128) //BFuelCal.LambdaOneFacMap (correctionfactor = 1/128) //BFuelCal.TempEnrichFacMap (correctionfactor = 1/128) //AfterStCal.AmbientMAP (correctionfactor = 1/128) return returnvalue; }
private void CompareToFile(string filename) { if (m_currentfile != "") { if (m_symbols.Count > 0) { dockManager1.BeginUpdate(); try { DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500)); CompareResults tabdet = new CompareResults(); tabdet.Dock = DockStyle.Fill; tabdet.Filename = filename; tabdet.onSymbolSelect += new CompareResults.NotifySelectSymbol(tabdet_onSymbolSelect); dockPanel.Controls.Add(tabdet); dockPanel.Text = "Compare results: " + Path.GetFileName(filename); dockPanel.DockTo(dockManager1, DockingStyle.Left, 1); dockPanel.Width = 700; SymbolCollection compare_symbols = new SymbolCollection(); FileInfo fi = new FileInfo(filename); logger.Debug("Opening compare file"); TryToOpenFile(filename, out compare_symbols, (int)fi.Length); System.Windows.Forms.Application.DoEvents(); logger.Debug("Start compare"); SetProgress("Start comparing symbols in files"); SetProgressPercentage(0); System.Windows.Forms.Application.DoEvents(); System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add("SYMBOLNAME"); dt.Columns.Add("SRAMADDRESS", Type.GetType("System.Int32")); dt.Columns.Add("FLASHADDRESS", Type.GetType("System.Int32")); dt.Columns.Add("LENGTHBYTES", Type.GetType("System.Int32")); dt.Columns.Add("LENGTHVALUES", Type.GetType("System.Int32")); dt.Columns.Add("DESCRIPTION"); dt.Columns.Add("ISCHANGED", Type.GetType("System.Boolean")); dt.Columns.Add("CATEGORY", Type.GetType("System.Int32")); //0 dt.Columns.Add("DIFFPERCENTAGE", Type.GetType("System.Double")); dt.Columns.Add("DIFFABSOLUTE", Type.GetType("System.Int32")); dt.Columns.Add("DIFFAVERAGE", Type.GetType("System.Double")); dt.Columns.Add("CATEGORYNAME"); dt.Columns.Add("SUBCATEGORYNAME"); dt.Columns.Add("SymbolNumber1", Type.GetType("System.Int32")); dt.Columns.Add("SymbolNumber2", Type.GetType("System.Int32")); dt.Columns.Add("Userdescription"); dt.Columns.Add("MissingInOriFile", Type.GetType("System.Boolean")); dt.Columns.Add("MissingInCompareFile", Type.GetType("System.Boolean")); string ht = string.Empty; double diffperc = 0; int diffabs = 0; double diffavg = 0; int percentageDone = 0; int symNumber = 0; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory subcat = XDFSubCategory.Undocumented; if (compare_symbols.Count > 0) { CompareResults cr = new CompareResults(); cr.ShowAddressesInHex = m_appSettings.ShowAddressesInHex; cr.SetFilterMode(m_appSettings.ShowAddressesInHex); SymbolTranslator st = new SymbolTranslator(); foreach (SymbolHelper sh_compare in compare_symbols) { try { symNumber++; percentageDone = (symNumber * 50) / compare_symbols.Count; if (Convert.ToInt32(barProgress.EditValue) != percentageDone) { barProgress.EditValue = percentageDone; System.Windows.Forms.Application.DoEvents(); } } catch (Exception E) { logger.Debug(E.Message); } string compareName = sh_compare.SmartVarname; foreach (SymbolHelper sh_org in m_symbols) { string originalName = sh_org.SmartVarname; if (compareName.Equals(originalName) && compareName != String.Empty) { if (sh_compare.Flash_start_address > 0 && sh_compare.Flash_start_address < 0x100000) { if (sh_org.Flash_start_address > 0 && sh_org.Flash_start_address < 0x100000) { if (!CompareSymbolToCurrentFile(compareName, (int)sh_compare.Flash_start_address, sh_compare.Length, filename, out diffperc, out diffabs, out diffavg)) { sh_org.createAndUpdateCategory(sh_org.SmartVarname); dt.Rows.Add(originalName, sh_compare.Start_address, sh_compare.Flash_start_address, sh_compare.Length, sh_compare.Length, st.TranslateSymbolToHelpText(compareName, out ht, out cat, out subcat), false, 0, diffperc, diffabs, diffavg, sh_org.Category, "", sh_org.Symbol_number, sh_compare.Symbol_number, sh_org.Userdescription); break; } } } } } } symNumber = 0; string varnamecomp = string.Empty; foreach (SymbolHelper shtest in compare_symbols) { try { symNumber++; percentageDone = 50 + (symNumber * 25) / compare_symbols.Count; if (Convert.ToInt32(barProgress.EditValue) != percentageDone) { barProgress.EditValue = percentageDone; System.Windows.Forms.Application.DoEvents(); } } catch (Exception E) { logger.Debug(E.Message); } bool _foundSymbol = false; varnamecomp = shtest.SmartVarname; if (IsSymbolCalibration(varnamecomp)) { foreach (SymbolHelper shoritest in m_symbols) { if (varnamecomp == shoritest.SmartVarname) { _foundSymbol = true; break; } } if (!_foundSymbol) { // add this symbol to the MissingInOriCollection dt.Rows.Add(varnamecomp, shtest.Start_address, shtest.Flash_start_address, shtest.Length, shtest.Length, st.TranslateSymbolToHelpText(varnamecomp, out ht, out cat, out subcat), false, 0, 0, 0, 0, "Missing in original", "", 0, shtest.Symbol_number, shtest.Userdescription, true, false); } } } symNumber = 0; foreach (SymbolHelper shtest in m_symbols) { try { symNumber++; percentageDone = 75 + (symNumber * 25) / compare_symbols.Count; if (Convert.ToInt32(barProgress.EditValue) != percentageDone) { barProgress.EditValue = percentageDone; System.Windows.Forms.Application.DoEvents(); } } catch (Exception E) { logger.Debug(E.Message); } bool _foundSymbol = false; varnamecomp = shtest.SmartVarname; if (IsSymbolCalibration(varnamecomp)) { foreach (SymbolHelper shoritest in compare_symbols) { if (varnamecomp == shoritest.SmartVarname) { _foundSymbol = true; break; } } if (!_foundSymbol) { // add this symbol to the MissingInCompCollection dt.Rows.Add(varnamecomp, shtest.Start_address, shtest.Flash_start_address, shtest.Length, shtest.Length, st.TranslateSymbolToHelpText(varnamecomp, out ht, out cat, out subcat), false, 0, 0, 0, 0, "Missing in compare", "", 0, shtest.Symbol_number, shtest.Userdescription, false, true); } } } tabdet.OriginalSymbolCollection = m_symbols; tabdet.OriginalFilename = m_currentfile; tabdet.CompareFilename = filename; tabdet.CompareSymbolCollection = compare_symbols; tabdet.OpenGridViewGroups(tabdet.gridControl1, 1); tabdet.gridControl1.DataSource = dt.Copy(); SetProgressIdle(); } } catch (Exception E) { logger.Debug(E.Message); } dockManager1.EndUpdate(); } } }
private void TryToLoadAdditionalCSVSymbols(string filename) { // convert to CSV file format // 56;AreaCal.A_MaxAdap;;; try { SymbolTranslator st = new SymbolTranslator(); char[] sep = new char[1]; sep.SetValue(';', 0); string[] fileContent = File.ReadAllLines(filename); foreach (string line in fileContent) { string[] values = line.Split(sep); try { string varname = (string)values.GetValue(1); int symbolnumber = Convert.ToInt32(values.GetValue(0)); foreach (SymbolHelper sh in m_symbols) { if (sh.Symbol_number == symbolnumber) { sh.Userdescription = varname; string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory sub = XDFSubCategory.Undocumented; sh.Description = st.TranslateSymbolToHelpText(sh.Userdescription, out helptext, out cat, out sub); if (sh.Category == "Undocumented" || sh.Category == "") { sh.createAndUpdateCategory(sh.Userdescription); } } } } catch (Exception lineE) { logger.Debug("Failed to import a symbol from CSV file " + line + ": " + lineE.Message); } } } catch (Exception E) { logger.Debug("Failed to import additional CSV symbols: " + E.Message); } }
private void TryToLoadAdditionalAS2Symbols(string filename) { // convert to AS2 file format try { SymbolTranslator st = new SymbolTranslator(); string[] fileContent = File.ReadAllLines(filename); int symbolnumber = 0; foreach (string line in fileContent) { if (line.StartsWith("*")) { symbolnumber++; try { string varname = line.Substring(1); int idxSymTab = 0; foreach (SymbolHelper sh in m_symbols) { if (sh.Length > 0) { idxSymTab++; } if (idxSymTab == symbolnumber) { sh.Userdescription = varname; string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory sub = XDFSubCategory.Undocumented; sh.Description = st.TranslateSymbolToHelpText(varname, out helptext, out cat, out sub); if (sh.Category == "Undocumented" || sh.Category == "") { sh.createAndUpdateCategory(sh.Userdescription); } break; } } } catch (Exception lineE) { logger.Debug("Failed to import a symbol from AS2 file " + line + ": " + lineE.Message); } } } } catch (Exception E) { logger.Debug("Failed to import additional AS2 symbols: " + E.Message); } }
private void barButtonItem23_ItemClick(object sender, ItemClickEventArgs e) { // ask the user for which value to search and if searching should include symbolnames and/or symbol description if (m_currentfile != "") { SymbolCollection result_Collection = new SymbolCollection(); frmSearchMaps searchoptions = new frmSearchMaps(); if (searchoptions.ShowDialog() == DialogResult.OK) { SetProgress("Start searching data..."); SetProgressPercentage(0); System.Windows.Forms.Application.DoEvents(); int cnt = 0; SetProgress("Searching..."); foreach (SymbolHelper sh in m_symbols) { SetProgressPercentage((cnt * 100) / m_symbols.Count); bool hit_found = false; if (searchoptions.UseSpecificMapLength) { if (sh.Length != (int)searchoptions.MapLength) { continue; } } if (searchoptions.IncludeSymbolNames) { if (searchoptions.SearchForNumericValues) { if (sh.Varname.Contains(searchoptions.NumericValueToSearchFor.ToString())) { hit_found = true; } } if (searchoptions.SearchForStringValues) { if (searchoptions.StringValueToSearchFor != string.Empty) { if (sh.Varname.Contains(searchoptions.StringValueToSearchFor)) { hit_found = true; } } } } if (searchoptions.IncludeSymbolDescription) { if (searchoptions.SearchForNumericValues) { if (sh.Description.Contains(searchoptions.NumericValueToSearchFor.ToString())) { hit_found = true; } } if (searchoptions.SearchForStringValues) { if (searchoptions.StringValueToSearchFor != string.Empty) { if (sh.Description.Contains(searchoptions.StringValueToSearchFor)) { hit_found = true; } } } } // now search the symbol data if (sh.Flash_start_address < m_currentfile_size) { byte[] symboldata = readdatafromfile(m_currentfile, (int)sh.Flash_start_address, sh.Length); if (searchoptions.SearchForNumericValues) { if (isSixteenBitTable(sh.Varname)) { for (int i = 0; i < symboldata.Length / 2; i += 2) { float value = Convert.ToInt32(symboldata.GetValue(i)) * 256; value += Convert.ToInt32(symboldata.GetValue(i + 1)); value *= (float)GetMapCorrectionFactor(sh.Varname); value += (float)GetMapCorrectionOffset(sh.Varname); if (value == (float)searchoptions.NumericValueToSearchFor) { hit_found = true; } } } else { for (int i = 0; i < symboldata.Length; i++) { float value = Convert.ToInt32(symboldata.GetValue(i)); value *= (float)GetMapCorrectionFactor(sh.Varname); value += (float)GetMapCorrectionOffset(sh.Varname); if (value == (float)searchoptions.NumericValueToSearchFor) { hit_found = true; } } } } if (searchoptions.SearchForStringValues) { if (searchoptions.StringValueToSearchFor.Length > symboldata.Length) { // possible... string symboldataasstring = System.Text.Encoding.ASCII.GetString(symboldata); if (symboldataasstring.Contains(searchoptions.StringValueToSearchFor)) { hit_found = true; } } } } if (hit_found) { // add to collection result_Collection.Add(sh); } cnt++; } SetProgressIdle(); if (result_Collection.Count == 0) { MessageBox.Show("No results found..."); } else { // start result screen dockManager1.BeginUpdate(); try { SymbolTranslator st = new SymbolTranslator(); DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500)); CompareResults tabdet = new CompareResults(); tabdet.ShowAddressesInHex = m_appSettings.ShowAddressesInHex; tabdet.SetFilterMode(m_appSettings.ShowAddressesInHex); tabdet.Dock = DockStyle.Fill; tabdet.UseForFind = true; tabdet.Filename = openFileDialog1.FileName; tabdet.onSymbolSelect += new CompareResults.NotifySelectSymbol(tabdet_onSymbolSelectForFind); dockPanel.Controls.Add(tabdet); string resultText = "Search results: "; if (searchoptions.SearchForNumericValues) { resultText += " number " + searchoptions.NumericValueToSearchFor.ToString(); } if (searchoptions.SearchForStringValues) { resultText += " string " + searchoptions.StringValueToSearchFor; } dockPanel.Text = resultText; dockPanel.DockTo(dockManager1, DockingStyle.Left, 1); dockPanel.Width = 700; System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add("SYMBOLNAME"); dt.Columns.Add("SRAMADDRESS", Type.GetType("System.Int32")); dt.Columns.Add("FLASHADDRESS", Type.GetType("System.Int32")); dt.Columns.Add("LENGTHBYTES", Type.GetType("System.Int32")); dt.Columns.Add("LENGTHVALUES", Type.GetType("System.Int32")); dt.Columns.Add("DESCRIPTION"); dt.Columns.Add("ISCHANGED", Type.GetType("System.Boolean")); dt.Columns.Add("CATEGORY"); //0 dt.Columns.Add("DIFFPERCENTAGE", Type.GetType("System.Double")); dt.Columns.Add("DIFFABSOLUTE", Type.GetType("System.Int32")); dt.Columns.Add("DIFFAVERAGE", Type.GetType("System.Double")); dt.Columns.Add("CATEGORYNAME"); dt.Columns.Add("SUBCATEGORYNAME"); dt.Columns.Add("SymbolNumber1", Type.GetType("System.Int32")); dt.Columns.Add("SymbolNumber2", Type.GetType("System.Int32")); string category = ""; string ht = string.Empty; double diffperc = 0; int diffabs = 0; double diffavg = 0; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory subcat = XDFSubCategory.Undocumented; foreach (SymbolHelper shfound in result_Collection) { string helptext = st.TranslateSymbolToHelpText(shfound.Varname, out ht, out cat, out subcat); shfound.createAndUpdateCategory(shfound.SmartVarname); dt.Rows.Add(shfound.SmartVarname, shfound.Start_address, shfound.Flash_start_address, shfound.Length, shfound.Length, helptext, false, 0, 0, 0, 0, shfound.Category, "", shfound.Symbol_number, shfound.Symbol_number); } tabdet.CompareSymbolCollection = result_Collection; tabdet.OpenGridViewGroups(tabdet.gridControl1, 1); tabdet.gridControl1.DataSource = dt.Copy(); } catch (Exception E) { logger.Debug(E.Message); } dockManager1.EndUpdate(); } } } }
public bool CheckAndFillCollection(SymbolCollection sc) { bool retval = false; // first check whether we have a "blank" file bool _hasSymbolNumbers = false; sc.SortColumn = "Symbol_number"; sc.SortingOrder = GenericComparer.SortOrder.Ascending; sc.Sort(); foreach (SymbolHelper sh in sc) { if (sh.Varname.StartsWith("Symbolnumber")) { _hasSymbolNumbers = true; break; } } // check known symbol length if (_hasSymbolNumbers) { int MapIndex = 0; int KnkFuelCalfi_MaxOffsetMap_Index = 0; int TrqMastCalm_AirTorqMap_Index = 0; int TrqMastCalX_AccPedalMAP_Index = 0; int BstKnkCalMaxAirmass_Index = 0; int BstKnkCalMaxAirmassAu_Index = 0; int PedalMapCalTrq_RequestMap_Index = 0; int PedalMapCalTrq_RequestSportMap_Index = 0; int KnkDetCalfi_knkWinOffsMAP_Index = 0; int KnkDetCalfi_knkWinSizeMAP_Index = 0; int InjAnglCalMap_Index = 0; bool _reverse288Maps = false; if (SequenceOf512Maps(sc, 1, 2, 1, 2, 2, 1)) { if (SequenceOf576Maps(sc, 1, 1, 1, 2, 1, 2)) // new file from JZW { //2 = KnkDetCal.fi_KnkWinOffsMap //3 = KnkDetCal.fi_KnkWinSizeMap //7 = TrqMastCal.m_AirTorqMap //8 = TrqMastCal.X_AccPedalMAP KnkFuelCalfi_MaxOffsetMap_Index = 4; KnkDetCalfi_knkWinOffsMAP_Index = 2; KnkDetCalfi_knkWinSizeMAP_Index = 3; InjAnglCalMap_Index = 1; PedalMapCalTrq_RequestMap_Index = 5; PedalMapCalTrq_RequestSportMap_Index = 6; TrqMastCalm_AirTorqMap_Index = 7; TrqMastCalX_AccPedalMAP_Index = 8; BstKnkCalMaxAirmass_Index = 9; _reverse288Maps = true; } else { KnkFuelCalfi_MaxOffsetMap_Index = 1; TrqMastCalm_AirTorqMap_Index = 2; TrqMastCalX_AccPedalMAP_Index = 3; BstKnkCalMaxAirmass_Index = 4; PedalMapCalTrq_RequestMap_Index = 5; PedalMapCalTrq_RequestSportMap_Index = 6; KnkDetCalfi_knkWinOffsMAP_Index = 7; KnkDetCalfi_knkWinSizeMAP_Index = 8; InjAnglCalMap_Index = 9; } } else if (SequenceOf512Maps(sc, 2, 1, 1, 2, 1, 2)) { BstKnkCalMaxAirmass_Index = 1; BstKnkCalMaxAirmassAu_Index = 2; InjAnglCalMap_Index = 3; KnkFuelCalfi_MaxOffsetMap_Index = 4; KnkDetCalfi_knkWinOffsMAP_Index = 5; KnkDetCalfi_knkWinSizeMAP_Index = 6; PedalMapCalTrq_RequestMap_Index = 7; TrqMastCalm_AirTorqMap_Index = 8; TrqMastCalX_AccPedalMAP_Index = 9; } else { BstKnkCalMaxAirmass_Index = 1; TrqMastCalm_AirTorqMap_Index = 2; TrqMastCalX_AccPedalMAP_Index = 3; InjAnglCalMap_Index = 4; KnkFuelCalfi_MaxOffsetMap_Index = 5; PedalMapCalTrq_RequestMap_Index = 6; PedalMapCalTrq_RequestSportMap_Index = 7; KnkDetCalfi_knkWinOffsMAP_Index = 8; KnkDetCalfi_knkWinSizeMAP_Index = 9; } // set the 512 map indexes correctly /* 2008 file: (1,2,1,2,2,1) 9*512 map KnkFuelCal.fi_MaxOffsetMap 1039 1 TrqMastCal.m_AirTorqMap 2344 2 TrqMastCal.X_AccPedalMAP 2345 BstKnkCal.MaxAirmass 3192 1 PedalMapCal.Trq_RequestMap 5820 2 PedalMapCal.Trq_RequestSportMap 5821 KnkDetCal.fi_knkWinOffsMAP 6749 2 KnkDetCal.fi_knkWinSizeMAP 6750 InjAnglCal.Map 6815 1 2007 file: (2,1,1,2,1,2) 9*512 map BstKnkCal.MaxAirmass 316 BstKnkCal.MaxAirmassAu 317 InjAnglCal.Map 2489 KnkFuelCal.fi_MaxOffsetMap 2517 KnkDetCal.fi_knkWinOffsMAP 3311 KnkDetCal.fi_knkWinSizeMAP 3312 PedalMapCal.Trq_RequestMap 5962 TrqMastCal.m_AirTorqMap 6254 TrqMastCal.X_AccPedalMAP 6255 Non working file 2007: (1,2,1,1,2,2) BstKnkCal.MaxAirmass 512 1 TrqMastCal.m_AirTorqMap 2186 2 TrqMastCal.X_AccPedalMAP 2187 InjAnglCal.Map 2981 1 KnkFuelCal.fi_MaxOffsetMap 4496 1 PedalMapCal.Trq_RequestMap 5771 2 PedalMapCal.Trq_RequestSportMap 5772 KnkDetCal.fi_knkWinOffsMAP 6373 2 KnkDetCal.fi_knkWinSizeMAP 6374 * */ MapIndex = SetMapName(sc, 70, 1, "FCutCal.FuelFactorMAP"); SetMapNameByIndex(sc, MapIndex - 1, 10, "FCutCal.T_EngineSP"); SetMapNameByIndex(sc, MapIndex - 2, 14, "FCutCal.nCombSinceFuelCutSP"); SetMapNameByIndex(sc, MapIndex - 6, 2, "FCutCal.m_AirInletTime"); SetMapNameByIndex(sc, MapIndex - 7, 2, "FCutCal.m_AirInletLimit"); MapIndex = SetMapName(sc, 504, 1, "AfterStCal.StartMAP"); SetMapNameByIndex(sc, MapIndex + 1, 28, "AfterStCal.n_CombXSP"); SetMapNameByIndex(sc, MapIndex + 2, 36, "AfterStCal.T_EngineYSP"); SetMapNameByIndex(sc, MapIndex + 3, 112, "AfterStCal.AmbientMAP"); SetMapNameByIndex(sc, MapIndex + 4, 8, "AfterStCal.p_AirAmbientYSP"); SetMapName(sc, 480, 1, "EngTipLimCal.X_Koeff"); SetMapName(sc, 672, 1, "EngTipNormCal.Trq_BacklashTipOutMap"); SetMapName(sc, 672, 2, "EngTipSportCal.Trq_BacklashTipOutMap"); // very probable SetMapName(sc, 512, /*1*/ KnkFuelCalfi_MaxOffsetMap_Index, "KnkFuelCal.fi_MaxOffsetMap"); MapIndex = SetMapName(sc, 512, /*2*/ TrqMastCalm_AirTorqMap_Index, "TrqMastCal.m_AirTorqMap"); SetMapNameByIndex(sc, MapIndex -2, 576, "TrqMastCal.Trq_MBTMAP"); // maybe use search first match from current index SetMapNameByIndex(sc, MapIndex -1, 576, "TrqMastCal.Trq_NominalMap"); SetMapNameByIndex(sc, MapIndex + 1, 512, "TrqMastCal.X_AccPedalMAP"); SetMapNameByIndex(sc, MapIndex + 2, 72, "TrqMastCal.IgnAngleDiffSP"); SetMapNameByIndex(sc, MapIndex + 3, 72, "TrqMastCal.TLO_TAB"); SetMapNameByIndex(sc, MapIndex + 4, 32, "TrqMastCal.n_EngineYSP"); // TrqMastCal.n_EngineYSP/n_EngYSP SetMapNameByIndex(sc, MapIndex + 5, 32, "TrqMastCal.n_EngineXSP"); SetMapNameByIndex(sc, MapIndex + 6, 8, "TrqMastCal.n_MaxDerXSP"); SetMapNameByIndex(sc, MapIndex + 7, 32, "TrqMastCal.Trq_EngXSP"); SetMapNameByIndex(sc, MapIndex + 8, 32, "TrqMastCal.Trq_PedYSP"); SetMapNameByIndex(sc, MapIndex + 9, 32, "TrqMastCal.Trq_MaxDerIncMAP"); SetMapNameByIndex(sc, MapIndex + 10, 32, "TrqMastCal.Trq_MaxDerDecMAP"); SetMapNameByIndex(sc, MapIndex + 11, 2, "TrqMastCal.Trq_MaxDerShift"); SetMapNameByIndex(sc, MapIndex + 12, 36, "TrqMastCal.m_AirXSP"); SetMapName(sc, 512, /*3*/ TrqMastCalX_AccPedalMAP_Index, "TrqMastCal.X_AccPedalMAP"); MapIndex = SetMapName(sc, 512, /*4*/ BstKnkCalMaxAirmass_Index, "BstKnkCal.MaxAirmass"); SetMapNameByIndex(sc, MapIndex - 1, 32, "BstKnkCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex - 2, 32, "BstKnkCal.OffsetXSP"); if (BstKnkCalMaxAirmassAu_Index > 0) { MapIndex = SetMapName(sc, 512, /*4*/ BstKnkCalMaxAirmassAu_Index, "BstKnkCal.MaxAirmassAu"); } SetMapName(sc, 512, /*5*/ PedalMapCalTrq_RequestMap_Index, "PedalMapCal.Trq_RequestMap"); if (PedalMapCalTrq_RequestSportMap_Index > 0) { SetMapName(sc, 512, /*6*/ PedalMapCalTrq_RequestSportMap_Index, "PedalMapCal.Trq_RequestSportMap"); } SetMapName(sc, 512, /*7*/ KnkDetCalfi_knkWinOffsMAP_Index, "KnkDetCal.fi_knkWinOffsMAP"); SetMapName(sc, 512, /*8*/ KnkDetCalfi_knkWinSizeMAP_Index, "KnkDetCal.fi_knkWinSizeMAP"); MapIndex = SetMapName(sc, 512, /*9*/ InjAnglCalMap_Index, "InjAnglCal.Map"); SetMapNameByIndex(sc, MapIndex - 1, 32, "InjAnglCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 2, 32, "InjAnglCal.AirXSP"); MapIndex = SetMapName(sc, 384, 1, "AirMassMastCal.m_AirMBTMAP"); SetMapNameByIndex(sc, MapIndex - 1, 24, "AirMassMastCal.Trq_MBTXSP"); SetMapNameByIndex(sc, MapIndex - 2, 32, "AirMassMastCal.n_EngMBTYSP"); MapIndex = SetMapName(sc, 384, 2, "IgnAbsCal.fi_IgnMBTMAP"); SetMapNameByIndex(sc, MapIndex - 1, 32, "IgnAbsCal.n_EngMBTYSP"); SetMapNameByIndex(sc, MapIndex - 2, 24, "IgnAbsCal.m_AirMBTXSP"); SetMapNameByIndex(sc, MapIndex + 1, 576, "IgnAbsCal.fi_highOctanMAP"); SetMapNameByIndex(sc, MapIndex + 2, 576, "IgnAbsCal.fi_lowOctanMAP"); SetMapNameByIndex(sc, MapIndex + 3, 576, "IgnAbsCal.fi_NormalMAP"); SetMapNameByIndex(sc, MapIndex + 4, 36, "IgnAbsCal.m_AirNormXSP"); SetMapNameByIndex(sc, MapIndex + 5, 32, "IgnAbsCal.n_EngNormYSP"); MapIndex = SetMapName(sc, 320, 1, "IgnAbsCal.fi_FuelCutMAP"); SetMapNameByIndex(sc, MapIndex - 1, 32, "IgnAbsCal.n_EngFuelCutYSP"); SetMapNameByIndex(sc, MapIndex - 2, 20, "IgnAbsCal.T_EngFuelCutXSP"); SetMapNameByIndex(sc, MapIndex + 1, 20, "IgnAbsCal.T_EngStartXSP"); SetMapNameByIndex(sc, MapIndex + 2, 16, "IgnAbsCal.n_EngStartYSP"); SetMapNameByIndex(sc, MapIndex + 3, 160, "IgnAbsCal.fi_StartMAP"); MapIndex = SetMapName(sc, 306, 1, "OilTempCal.T_SpeedAndLoadDecreaseMap"); SetMapNameByIndex(sc, MapIndex - 1, 34, "OilTempCal.v_VehicleYSP"); SetMapNameByIndex(sc, MapIndex - 2, 18, "OilTempCal.T_AirInletXSP"); //<GS-29082011> /* 4 maps length 288 (0x120) means biopower for T8. 1st = BFuelCal.LambdaOneFacMap 2nd = BFuelCal.TempEnrichFacMap 3rd = BFuelCal.E85TempEnrichFacMap 4th = MAFCal.NormAdjustFacMap * */ if (SymbolCountOfLength(sc, 288) == 4) { // biopower MapIndex = SetMapName(sc, 288, 1, "BFuelCal.LambdaOneFacMap"); SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP"); SetMapName(sc, 288, 2, "BFuelCal.E85TempEnrichFacMap"); SetMapName(sc, 288, 3, "BFuelCal.TempEnrichFacMap"); SetMapName(sc, 288, 4, "MAFCal.NormAdjustFacMap"); } else { if (!_reverse288Maps) { MapIndex = SetMapName(sc, 288, 1, "BFuelCal.LambdaOneFacMap"); SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP"); SetMapName(sc, 288, 2, "BFuelCal.TempEnrichFacMap"); SetMapName(sc, 288, 3, "MAFCal.NormAdjustFacMap"); } else { MapIndex = SetMapName(sc, 288, 2, "BFuelCal.LambdaOneFacMap"); SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP"); SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP"); SetMapName(sc, 288, 3, "BFuelCal.TempEnrichFacMap"); SetMapName(sc, 288, 1, "MAFCal.NormAdjustFacMap"); } } SetMapName(sc, 256, 1, "AirCtrlCal.RegMap"); MapIndex = SetMapName(sc, 256, 2, "PedalMapCal.GainFactorMap"); SetMapNameByIndex(sc, MapIndex - 1, 16, "PedalMapCal.GainFactorYSP"); SetMapNameByIndex(sc, MapIndex - 3, 2, "PedalMapCal.T_SportModeEnable"); SetMapNameByIndex(sc, MapIndex - 10, 2, "PedalMapCal.SportFactor"); SetMapNameByIndex(sc, MapIndex - 14, 512, "PedalMapCal.Trq_RequestSportMap"); SetMapNameByIndex(sc, MapIndex - 15, 512, "PedalMapCal.Trq_RequestMap"); SetMapNameByIndex(sc, MapIndex - 16, 32, "PedalMapCal.X_PedalMap"); SetMapNameByIndex(sc, MapIndex - 17, 32, "PedalMapCal.n_EngineMap"); SetMapName(sc, 224, 1, "MAFCal.WeightConstMap"); MapIndex = SetMapName(sc, 220, 1, "IgnTempCal.T_AirInletReferenceMap"); SetMapNameByIndex(sc, MapIndex - 1, 22, "IgnTempCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex - 2, 20, "IgnTempCal.m_AirXSP"); SetMapName(sc, 220, 2, "IgnTempCal.fi_OffsetMaxAirInletMap"); SetMapName(sc, 220, 3, "IgnTempCal.T_MaxAirInletMap"); SetMapName(sc, 220, 4, "IgnTempCal.fi_OffsetMinAirInletMap"); SetMapName(sc, 220, 5, "IgnTempCal.T_MinAirInletMap"); SetMapName(sc, 220, 6, "IgnTempCal.fi_OffsetMaxTEngMap"); SetMapName(sc, 220, 7, "IgnTempCal.fi_OffsetMinTEngMap"); MapIndex = SetMapName(sc, 208, 1, "AfterStCal.HotSoakMAP"); SetMapNameByIndex(sc, MapIndex + 2, 26, "AfterStCal.t_soakXSP"); SetMapNameByIndex(sc, MapIndex + 4, 16, "AfterStCal.T_EngineYSP2"); MapIndex = SetMapName(sc, 204, 1, "IgnMastCal.dwellTimeMap"); SetMapNameByIndex(sc, MapIndex + 1, 34, "IgnMastCal.n_EngDwellTimeYSP"); SetMapNameByIndex(sc, MapIndex + 2, 12, "IgnMastCal.UBattDwellTimeXSP"); MapIndex = SetMapName(sc, 200, 1, "ExhaustCal.T_fiIgnMap"); SetMapNameByIndex(sc, MapIndex - 1, 20, "ExhaustCal.fi_IgnSP"); SetMapNameByIndex(sc, MapIndex - 4, 20, "ExhaustCal.m_AirSP"); SetMapNameByIndex(sc, MapIndex + 1, 576, "ExhaustCal.T_Lambda1Map"); SetMapNameByIndex(sc, MapIndex + 4, 576, "TrqMastCal.Trq_MBTMAP"); // maybe use search first match from current index SetMapNameByIndex(sc, MapIndex + 5, 576, "TrqMastCal.Trq_NominalMap"); SetMapNameByIndex(sc, MapIndex + 6, 512, "TrqMastCal.m_AirTorqMap"); SetMapNameByIndex(sc, MapIndex + 7, 512, "TrqMastCal.X_AccPedalMAP"); SetMapNameByIndex(sc, MapIndex + 8, 72, "TrqMastCal.IgnAngleDiffSP"); SetMapNameByIndex(sc, MapIndex + 9, 72, "TrqMastCal.TLO_TAB"); SetMapNameByIndex(sc, MapIndex + 10, 32, "TrqMastCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 11, 32, "TrqMastCal.n_EngXSP"); SetMapNameByIndex(sc, MapIndex + 12, 8, "TrqMastCal.n_MaxDerXSP"); SetMapNameByIndex(sc, MapIndex + 13, 32, "TrqMastCal.Trq_EngXSP"); SetMapNameByIndex(sc, MapIndex + 14, 32, "TrqMastCal.Trq_PedYSP"); SetMapNameByIndex(sc, MapIndex + 15, 32, "TrqMastCal.Trq_MaxDerIncMAP"); SetMapNameByIndex(sc, MapIndex + 16, 32, "TrqMastCal.Trq_MaxDerDecMAP"); SetMapNameByIndex(sc, MapIndex + 17, 2, "TrqMastCal.Trq_MaxDerShift"); SetMapNameByIndex(sc, MapIndex + 18, 36, "TrqMastCal.m_AirXSP"); MapIndex = SetMapName(sc, 192, 1, "AirCtrlCal.m_AirBoostHighAltOffsMAP"); SetMapNameByIndex(sc, MapIndex - 1, 24, "AirCtrlCal.p_AirAmbientYSP"); SetMapNameByIndex(sc, MapIndex - 2, 16, "AirCtrlCal.p_AfterTurbineXSP"); MapIndex = SetMapName(sc, 192, 2, "IgnMastCal.MinMap"); SetMapNameByIndex(sc, MapIndex + 1, 24, "IgnMastCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 2, 16, "IgnMastCal.m_AirXSP"); MapIndex = SetMapName(sc, 168, 1, "IgnKnkCal.RetardIndexMap"); SetMapNameByIndex(sc, MapIndex - 1, 24, "IgnKnkCal.n_EngIndexYSP"); SetMapNameByIndex(sc, MapIndex - 2, 14, "IgnKnkCal.m_AirIndexXSP"); SetMapNameByIndex(sc, MapIndex - 6, 32, "IgnKnkCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex - 7, 36, "IgnKnkCal.m_AirXSP"); MapIndex = SetMapName(sc, 168, 2, "IgnKnkCal.ARetardIndexMap"); SetMapNameByIndex(sc, MapIndex + 1, 576, "IgnKnkCal.IndexMap"); MapIndex = SetMapName(sc, 168, 3, "KnkDetCal.X_hystOffsetMAP"); MapIndex = SetMapName(sc, 168, 4, "KnkDetCal.X_AHystOffsetMAP"); MapIndex = SetMapName(sc, 160, 1, "MisfCal.m_LoadLevelMAT"); SetMapNameByIndex(sc, MapIndex + 1, 36, "MisfCal.m_AirXSP"); SetMapNameByIndex(sc, MapIndex + 4, 576, "MisfCal.CatOverheatFactorMAT"); SetMapNameByIndex(sc, MapIndex + 7, 32, "MisfCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 10, 10, "MisfCal.T_EngXSP"); if (_reverse288Maps) { MapIndex = SetMapName(sc, 576, 12, "KnkFuelCal.EnrichmentMap", 1, 576); SetMapNameByIndex(sc, MapIndex + 1, 576, "KnkFuelCal.fi_OffsetEnrichEnable"); SetMapNameByIndex(sc, MapIndex + 2, 576, "KnkFuelCal.fi_MaxOffsetMap"); SetMapNameByIndex(sc, MapIndex + 3, 32, "KnkFuelCal.m_AirXSP"); } else { MapIndex = SetMapName(sc, 576, 2, "KnkFuelCal.EnrichmentMap", 1, 576); SetMapNameByIndex(sc, MapIndex + 1, 576, "KnkFuelCal.fi_OffsetEnrichEnable"); SetMapNameByIndex(sc, MapIndex + 2, 576, "KnkFuelCal.fi_MaxOffsetMap"); SetMapNameByIndex(sc, MapIndex + 3, 32, "KnkFuelCal.m_AirXSP"); } SetMapName(sc, 160, 2, "IgnAbsCal.fi_StartMAP"); SetMapName(sc, 140, 1, "FuelCutInhibitCal.FCIFaultCodeList"); SetMapName(sc, 130, 1, "VIOSMAFCal.TicksSP"); SetMapName(sc, 130, 2, "VIOSMAFCal.Q_AirInletTab"); if (_reverse288Maps) { SetMapName(sc, 98, 1, "AirCtrlCal.Ppart_BoostMap"); SetMapName(sc, 98, 2, "AirCtrlCal.Ipart_BoostMap"); MapIndex = SetMapName(sc, 98, 3, "AirCtrlCal.Dpart_BoostMap"); } else { SetMapName(sc, 98, 3, "AirCtrlCal.Ppart_BoostMap"); SetMapName(sc, 98, 4, "AirCtrlCal.Ipart_BoostMap"); MapIndex = SetMapName(sc, 98, 5, "AirCtrlCal.Dpart_BoostMap"); } SetMapNameByIndex(sc, MapIndex + 1, 14, "AirCtrlCal.PIDXSP"); SetMapNameByIndex(sc, MapIndex + 2, 14, "AirCtrlCal.PIDYSP"); SetMapNameByIndex(sc, MapIndex + 3, 2, "AirCtrlCal.IPart_BoostCoAirM1"); SetMapNameByIndex(sc, MapIndex + 4, 2, "AirCtrlCal.m_IFacMax"); SetMapNameByIndex(sc, MapIndex + 5, 2, "AirCtrlCal.FilterFactor"); SetMapNameByIndex(sc, MapIndex + 6, 32, "AirCtrlCal.n_EngYSP"); SetMapNameByIndex(sc, MapIndex + 7, 2, "AirCtrlCal.Hysteres"); SetMapNameByIndex(sc, MapIndex + 8, 16, "AirCtrlCal.SetLoadXSP"); SetMapNameByIndex(sc, MapIndex + 9, 256, "AirCtrlCal.RegMap"); // find torquelimiters automatically int state = 0; int symIndex =0; int symCounter = 0; bool limitersFound = false; foreach (SymbolHelper sh in sc) { //if (state > 0) logger.Debug("State = " + state.ToString() + " symcount: " + symCounter.ToString()); switch (state) { case 0: if (sh.Length == 16) state++; break; case 1: if (sh.Length == 2) state++; else state = 0; break; case 2: if (sh.Length == 32) state++; else state = 0; break; case 3: if (sh.Length == 32) state++; else state = 0; break; case 4: if (sh.Length == 32) state++; else state = 0; break; case 5: if (sh.Length == 32) state++; else state = 0; break; case 6: if (sh.Length == 2) state++; else state = 0; break; case 7: if (sh.Length == 2) state++; else state = 0; break; case 8: if (sh.Length == 2) state++; else state = 0; break; case 9: if (sh.Length == 32) state++; else state = 0; break; case 10: if (sh.Length == 32) state++; else state = 0; break; case 11: symIndex = sh.Symbol_number; break; } symCounter++; if (symIndex > 0) break; } if (symIndex > 0) { logger.Debug("(I) Found index: " + symIndex.ToString()); limitersFound = true; // - 11 = TrqLimCal.Trq_ManGear SetMapNameByIndex(sc, symIndex - 11, 16, "TrqLimCal.Trq_ManGear"); SetMapNameByIndex(sc, symIndex - 9, 32, "TrqLimCal.Trq_MaxEngineManTab1"); SetMapNameByIndex(sc, symIndex - 8, 32, "TrqLimCal.Trq_MaxEngineAutTab1"); SetMapNameByIndex(sc, symIndex - 7, 32, "TrqLimCal.Trq_MaxEngineManTab2"); SetMapNameByIndex(sc, symIndex - 6, 32, "TrqLimCal.Trq_MaxEngineAutTab2"); SetMapNameByIndex(sc, symIndex - 2, 32, "TrqLimCal.n_EngYSP"); SetMapNameByIndex(sc, symIndex - 1, 32, "TrqLimCal.Trq_OverBoostTab"); SetMapNameByIndex(sc, symIndex + 7, 24, "TrqLimCal.CompressorNoiseYSP"); SetMapNameByIndex(sc, symIndex + 8, 6, "TrqLimCal.CompressorNoiseXSP"); SetMapNameByIndex(sc, symIndex + 9, 72, "TrqLimCal.Trq_CompressorNoiseRedLimMAP"); } if (!limitersFound) { state = 0; symIndex = 0; symCounter = 0; foreach (SymbolHelper sh in sc) { //if (state > 0) logger.Debug("State = " + state.ToString() + " symcount: " + symCounter.ToString()); switch (state) { case 0: if (sh.Length == 16) state++; break; case 1: if (sh.Length == 2) state++; else state = 0; break; case 2: if (sh.Length == 32) state++; else state = 0; break; case 3: if (sh.Length == 32) state++; else state = 0; break; case 4: if (sh.Length == 2) state++; else state = 0; break; case 5: if (sh.Length == 2) state++; else state = 0; break; case 6: if (sh.Length == 2) state++; else state = 0; break; case 7: if (sh.Length == 32) state++; else state = 0; break; case 8: if (sh.Length == 32) state++; else state = 0; break; case 9: symIndex = sh.Symbol_number; state++; break; case 10: break; } symCounter++; if (symIndex > 0) break; } } if (symIndex > 0) { logger.Debug("(II) Found index: " + symIndex.ToString()); limitersFound = true; // - 9 = TrqLimCal.Trq_ManGear SetMapNameByIndex(sc, symIndex - 9, 16, "TrqLimCal.Trq_ManGear"); SetMapNameByIndex(sc, symIndex - 7, 32, "TrqLimCal.Trq_MaxEngineManTab1"); SetMapNameByIndex(sc, symIndex - 6, 32, "TrqLimCal.Trq_MaxEngineAutTab1"); SetMapNameByIndex(sc, symIndex - 2, 32, "TrqLimCal.n_EngYSP"); SetMapNameByIndex(sc, symIndex - 1, 32, "TrqLimCal.Trq_OverBoostTab"); SetMapNameByIndex(sc, symIndex + 7, 24, "TrqLimCal.CompressorNoiseYSP"); SetMapNameByIndex(sc, symIndex + 8, 6, "TrqLimCal.CompressorNoiseXSP"); SetMapNameByIndex(sc, symIndex + 9, 72, "TrqLimCal.Trq_CompressorNoiseRedLimMAP"); } SymbolTranslator st = new SymbolTranslator(); foreach (SymbolHelper sh in sc) { string helptext = string.Empty; XDFCategories cat = XDFCategories.Undocumented; XDFSubCategory sub = XDFSubCategory.Undocumented; sh.Description = st.TranslateSymbolToHelpText(sh.Userdescription, out helptext, out cat, out sub); if (sh.Category == "Undocumented" || sh.Category == "") { sh.createAndUpdateCategory(sh.Userdescription); } } } return retval; }