Beispiel #1
0
        private void btnFirmwareInformation_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (Tools.Instance.m_currentfile != string.Empty)
            {
                if(File.Exists(Tools.Instance.m_currentfile))
                {

                    byte[] allBytes = File.ReadAllBytes(Tools.Instance.m_currentfile);
                    IEDCFileParser parser = Tools.Instance.GetParserForFile(Tools.Instance.m_currentfile, false);
                    partNumberConverter pnc = new partNumberConverter();
                    ECUInfo ecuinfo = pnc.ConvertPartnumber(parser.ExtractBoschPartnumber(allBytes), allBytes.Length);
                    frmFirmwareInfo info = new frmFirmwareInfo();
                    info.InfoString = parser.ExtractInfo(allBytes);
                    info.partNumber = parser.ExtractBoschPartnumber(allBytes);
                    if(ecuinfo.SoftwareID == "") ecuinfo.SoftwareID = parser.ExtractPartnumber(allBytes);
                    info.SoftwareID = ecuinfo.SoftwareID + " " + parser.ExtractSoftwareNumber(allBytes);
                    info.carDetails = ecuinfo.CarMake + " " + ecuinfo.CarType;
                    string enginedetails = ecuinfo.EngineType;
                    string hpinfo = string.Empty;
                    string tqinfo = string.Empty;
                    if (ecuinfo.HP > 0) hpinfo = ecuinfo.HP.ToString() + " bhp";
                    if (ecuinfo.TQ > 0) tqinfo = ecuinfo.TQ.ToString() + " Nm";
                    if (hpinfo != string.Empty || tqinfo != string.Empty)
                    {
                        enginedetails += " (";
                        if (hpinfo != string.Empty) enginedetails += hpinfo;
                        if (hpinfo != string.Empty && tqinfo != string.Empty) enginedetails += "/";
                        if (tqinfo != string.Empty) enginedetails += tqinfo;
                        enginedetails += ")";
                    }
                    info.EngineType = /*ecuinfo.EngineType*/ enginedetails;
                    info.ecuDetails = ecuinfo.EcuType;
                    //DumpECUInfo(ecuinfo);
                    ChecksumResultDetails result = Tools.Instance.UpdateChecksum(Tools.Instance.m_currentfile, true);
                    string chkType = string.Empty;
                    if (result.TypeResult == ChecksumType.VAG_EDC15P_V41) chkType = "VAG EDC15P V4.1";
                    else if (result.TypeResult == ChecksumType.VAG_EDC15P_V41V2) chkType = "VAG EDC15P V4.1v2";
                    else if (result.TypeResult == ChecksumType.VAG_EDC15P_V41_2002) chkType = "VAG EDC15P V4.1 2002+";
                    else if (result.TypeResult != ChecksumType.Unknown) chkType = result.TypeResult.ToString();

                    chkType += " " + result.CalculationResult.ToString();

                    info.checksumType = chkType;
                    // number of codeblocks?
                    info.codeBlocks = DetermineNumberOfCodeblocks().ToString();
                    info.ShowDialog();
                }
            }
        }