private bool OpenWorkingFile(string filename) { bool retval = false; if (File.Exists(filename)) { m_trionicFile = new Trionic5File(); m_trionicFile.LibraryPath = Application.StartupPath + "\\Binaries"; m_trionicFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum); FileInfo fi = new FileInfo(filename); //<GS-07102010> remove read only flag if possible try { fi.IsReadOnly = false; btnReadOnly.Caption = "File access OK"; } catch (Exception E) { Console.WriteLine("Failed to remove read only flag: " + E.Message); btnReadOnly.Caption = "File is READ ONLY"; } m_trionicFile.onDecodeProgress += new IECUFile.DecodeProgress(m_trionicFile_onDecodeProgress); m_trionicFile.onTransactionLogChanged += new IECUFile.TransactionLogChanged(m_trionicFile_onTransactionLogChanged); m_trionicFile.SelectFile(filename); //m_trionicFileInformation = m_trionicFile.ParseTrionicFile(ofd.FileName); m_trionicFileInformation = m_trionicFile.ParseFile(); props = m_trionicFile.GetTrionicProperties(); // set indicators and menu items accoring to the file that has been opened if (props.IsTrionic55) { barECUType.Caption = "T5.5"; // enable T5.5 maps EnableT55Maps(true); } else { barECUType.Caption = "T5.2"; EnableT55Maps(false); // disable T5.5 maps } barECUSpeed.Caption = props.CPUspeed; if (props.RAMlocked) { barECULocked.Caption = "RAM locked"; } else { barECULocked.Caption = "RAM unlocked"; } if (CheckFileInLibrary(props.Partnumber)) { btnCompareToOriginalFile.Enabled = true; } else { btnCompareToOriginalFile.Enabled = false; } _ecuConnection.MapSensorType = m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType); gridSymbols.DataSource = m_trionicFileInformation.SymbolCollection; barStaticItem2.Caption = "File: " + Path.GetFileName(m_trionicFileInformation.Filename); this.Text = "T5Suite Professional 2.0 [" + Path.GetFileName(m_trionicFileInformation.Filename) + "]"; OpenGridViewGroups(gridSymbols, 0); // enable buttons barButtonItem4.Enabled = true; btnConnectECU.Enabled = true; btnSwitchMode.Enabled = true; //btnSynchronizeMaps.Enabled = true; btnTuneForE85Fuel.Enabled = true; //<GS-06042010> todo btnTuneToLargerInjectors.Enabled = true; //<GS-06042010> todo btnTuneToStage1.Enabled = true; btnTuneToStage2.Enabled = true; btnTuneToStage3.Enabled = true; btnTuneToStageX.Enabled = true; // btnTuneToThreeBarSensor.Enabled = true; barConvertMapSensor.Enabled = true; btnBoostAdaptionWizard.Enabled = true; btnHardcodedRPMLimit.Enabled = true; if (m_trionicFileInformation.Has2DRegKonMat()) { btnChangeRegkonMatRange.Enabled = true; } else { btnChangeRegkonMatRange.Enabled = false; } m_appSettings.Lastfilename = filename; ctrlRealtime1.Currentfile = filename; if (m_AFRMaps != null) { m_AFRMaps.SaveMaps(); // first save changes that might have been done } m_AFRMaps = null; if (m_AFRMaps == null && m_appSettings.AlwaysCreateAFRMaps) { m_AFRMaps = new AFRMaps(); m_AFRMaps.onFuelmapCellChanged += new AFRMaps.FuelmapCellChanged(m_AFRMaps_onFuelmapCellChanged); m_AFRMaps.onIdleFuelmapCellChanged += new AFRMaps.IdleFuelmapCellChanged(m_AFRMaps_onIdleFuelmapCellChanged); m_AFRMaps.onCellLocked += new AFRMaps.CellLocked(m_AFRMaps_onCellLocked); m_AFRMaps.TrionicFile = m_trionicFile; m_AFRMaps.InitializeMaps(); } // add realtime symbollist to ctrlRealtime1 Trionic5Tools.SymbolCollection _rtSymbols = new Trionic5Tools.SymbolCollection(); foreach (Trionic5Tools.SymbolHelper symh in m_trionicFileInformation.SymbolCollection) { if (symh.Start_address > 0 && (symh.Length >= 1 && symh.Length <= 4)) // <GS-29072010> was 1 & 2 only { _rtSymbols.Add(symh); } } ctrlRealtime1.RealtimeSymbolCollection = _rtSymbols; try { LoadUserDefinedRealtimeSymbols(); // try to load it } catch (Exception E) { Console.WriteLine(E.Message); } LoadKnockMaps(); SetTaskProgress(0, false); retval = true; } return retval; }