• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CommonSuite.frmInfoBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CommonSuite.frmInfoBox的典型用法代码示例。如果您正苦于以下问题:C# frmInfoBox类的具体用法?C# frmInfoBox怎么用?C# frmInfoBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



frmInfoBox类属于CommonSuite命名空间,在下文中一共展示了frmInfoBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: tabdet_onWriteToSRAM

 void tabdet_onWriteToSRAM(object sender, IMapViewer.WriteToSRAMEventArgs e)
 {
     // write data to SRAM, check for valid connection first
     bool writepossible = false;
     try
     {
         //if (flash != null)
         {
             if (CheckCANConnectivity())
             {
                 writepossible = true;
                 m_prohibitReading = true;
                 try
                 {
                     WriteMapToSRAM(e.Mapname, e.Data, true);
                 }
                 catch (Exception E)
                 {
                     logger.Debug("Failed to write to SRAM: " + E.Message);
                 }
             }
         }
         if (!writepossible)
         {
             frmInfoBox info = new frmInfoBox("An active CAN bus connection is needed to write data to the ECU");
         }
     }
     catch (Exception E)
     {
         logger.Debug("Failed to write map to SRAM: " + E.Message);
     }
     m_prohibitReading = false;
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:33,代码来源:frmMain.cs


示例2: GetSRAMSnapshot

 private void GetSRAMSnapshot()
 {
     if (CheckCANConnectivity())
     {
         m_prohibitReading = true;
         bool _success = false;
         SetProgress("Starting snapshot download");
         string filename = Path.GetDirectoryName(m_currentfile) + "\\SRAM" + DateTime.Now.Year.ToString("D4") + DateTime.Now.Month.ToString("D2") + DateTime.Now.Day.ToString("D2") + DateTime.Now.Hour.ToString("D2") + DateTime.Now.Minute.ToString("D2") + DateTime.Now.Second.ToString("D2") + DateTime.Now.Millisecond.ToString("D3") + ".RAM";
         if (m_CurrentWorkingProject != "")
         {
             if (!Directory.Exists(m_appSettings.ProjectFolder + "\\" + m_CurrentWorkingProject + "\\Snapshots")) Directory.CreateDirectory(m_appSettings.ProjectFolder + "\\" + m_CurrentWorkingProject + "\\Snapshots");
             filename = m_appSettings.ProjectFolder + "\\" + m_CurrentWorkingProject + "\\Snapshots\\Snapshot" + DateTime.Now.ToString("MMddyyyyHHmmss") + ".RAM";
         }
         if (trionic7.GetSRAMSnapshot(filename))
         {
             frmInfoBox info = new frmInfoBox("Snapshot downloaded and saved to: " + filename);
         }
         m_prohibitReading = false;
         SetProgressIdle();
     }
     else
     {
         // not connected to ECU
         frmInfoBox info = new frmInfoBox("An active CAN bus connection is needed to download a snapshot");
     }
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:26,代码来源:frmMain.cs


示例3: ImportExcelSymbol

        private void ImportExcelSymbol(string symbolname, string filename)
        {
            bool issixteenbit = false;
            System.Data.DataTable dt = getDataFromXLS(openFileDialog2.FileName);
            if (isSixteenBitTable(symbolname)) issixteenbit = true;
            int symbollength = GetSymbolLength(m_symbols, symbolname);
            int datalength = symbollength;
            if (issixteenbit) datalength /= 2;
            int[] buffer = new int[datalength];
            int bcount = 0;
            //            for (int rtel = 1; rtel < dt.Rows.Count; rtel++)
            for (int rtel = dt.Rows.Count; rtel >= 1; rtel--)
            {
                try
                {
                    int idx = 0;
                    foreach (object o in dt.Rows[rtel].ItemArray)
                    {
                        if (idx > 0)
                        {
                            if (o != null)
                            {
                                if (o != DBNull.Value)
                                {
                                    if (bcount < buffer.Length)
                                    {
                                        buffer.SetValue(Convert.ToInt32(o), bcount++);
                                    }
                                    else
                                    {
                                        frmInfoBox info = new frmInfoBox("Too much information in file, abort");
                                        return;
                                    }
                                }
                            }
                        }
                        idx++;
                    }
                }
                catch (Exception E)
                {
                    logger.Debug("ImportExcelSymbol: " + E.Message);
                }

            }
            if (bcount >= datalength)
            {
                byte[] data = new byte[symbollength];
                int cellcount = 0;
                if (issixteenbit)
                {
                    for (int dcnt = 0; dcnt < buffer.Length; dcnt++)
                    {
                        string bstr1 = "0";
                        string bstr2 = "0";
                        int cellvalue = Convert.ToInt32(buffer.GetValue(dcnt));
                        string svalue = cellvalue.ToString("X4");

                        bstr1 = svalue.Substring(svalue.Length - 4, 2);
                        bstr2 = svalue.Substring(svalue.Length - 2, 2);
                        data.SetValue(Convert.ToByte(bstr1, 16), cellcount++);
                        data.SetValue(Convert.ToByte(bstr2, 16), cellcount++);
                    }
                }
                else
                {
                    for (int dcnt = 0; dcnt < buffer.Length; dcnt++)
                    {
                        int cellvalue = Convert.ToInt32(buffer.GetValue(dcnt));
                        data.SetValue(Convert.ToByte(cellvalue.ToString()), cellcount++);
                    }
                }
                savedatatobinary((int)GetSymbolAddress(m_symbols, symbolname), symbollength, data, m_currentfile, true);
                verifychecksum(false);
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:76,代码来源:frmMain.cs


示例4: File_EditTuningPackage

        private void File_EditTuningPackage(object sender, ItemClickEventArgs e)
        {
            if (tunpackeditWindow != null)
            {
                frmInfoBox info = new frmInfoBox("You have another tuning package edit window open, please close that first");
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Trionic 7 packages|*.t7p";
            ofd.Multiselect = false;
            char[] sep = new char[1];
            sep.SetValue(',', 0);

            SymbolCollection scToImport = new SymbolCollection();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("Map");
            dt.Columns.Add("Length");
            dt.Columns.Add("Data");

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //TODO: create a list of maps to import .. maybe?
                using (StreamReader sr = new StreamReader(ofd.FileName))
                {
                    string line = string.Empty;
                    SymbolHelper sh_Import = new SymbolHelper();
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.StartsWith("symbol="))
                        {
                            //
                            sh_Import = new SymbolHelper();
                            sh_Import.Varname = line.Replace("symbol=", "");
                        }
                        else if (line.StartsWith("length="))
                        {
                            sh_Import.Length = Convert.ToInt32(line.Replace("length=", ""));
                        }
                        else if (line.StartsWith("data="))
                        {
                            //
                            try
                            {
                                string dataBytes = line.Replace("data=", "");
                                // split using ','
                                string[] bytesInStrings = dataBytes.Split(sep);
                                byte[] dataToInsert = new byte[sh_Import.Length];
                                for (int t = 0; t < sh_Import.Length; t++)
                                {
                                    byte b = Convert.ToByte(bytesInStrings[t], 16);
                                    dataToInsert.SetValue(b, t);
                                }
                                int addressInFile = (int)GetSymbolAddress(m_symbols, sh_Import.Varname);
                                if (addressInFile > 0)
                                {
                                    //savedatatobinary(addressInFile, sh_Import.Length, dataToInsert, m_currentfile, true);
                                    // add successful
                                    dt.Rows.Add(sh_Import.Varname, sh_Import.Length.ToString(), dataBytes);
                                }
                                else
                                {
                                    // add failure
                                    dt.Rows.Add(sh_Import.Varname, sh_Import.Length.ToString(), dataBytes);
                                }
                            }
                            catch (Exception E)
                            {
                                // add failure
                                dt.Rows.Add(sh_Import.Varname, sh_Import.Length.ToString(), "");
                                logger.Debug(E.Message);
                            }
                        }
                    }
                }
                tunpackeditWindow = new frmEditTuningPackage();
                tunpackeditWindow.FormClosed += new FormClosedEventHandler(edit_FormClosed);
                tunpackeditWindow.onMapSelected += new frmEditTuningPackage.MapSelected(edit_onMapSelected);
                tunpackeditWindow.SetFilename(ofd.FileName);
                tunpackeditWindow.SetDataTable(dt);
                tunpackeditWindow.Show();

            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:83,代码来源:frmMain.cs


示例5: GetSidCollectionFromBinary

        private static SIDICollection GetSidCollectionFromBinary(string m_currentfile)
        {
            SIDICollection m_sidcollection = new SIDICollection();
            FileStream stream = new FileStream(m_currentfile, FileMode.Open, FileAccess.Read);
            stream.Position = 0L;
            long num2 = 0L;
            bool flag = false;
            byte[] buffer = new byte[] { 0x41, 100, 0x70, 0x4e, 0, 0, 0 };
            do
            {
                if (((byte)stream.ReadByte()) == buffer[0])
                {
                    long position = stream.Position;
                    if (((byte)stream.ReadByte()) == buffer[1])
                    {
                        if ((((((byte)stream.ReadByte()) == buffer[2]) && (((byte)stream.ReadByte()) == buffer[3])) && ((((byte)stream.ReadByte()) == buffer[4]) && (((byte)stream.ReadByte()) == buffer[5]))) && (((byte)stream.ReadByte()) == buffer[6]))
                        {
                            flag = true;
                            num2 = stream.Position - 7L;
                        }
                    }
                    else
                    {
                        stream.Position = position;
                    }
                }
            }
            while (!flag && (stream.Position != 0x80000));
            if (!flag)
            {
                frmInfoBox info = new frmInfoBox("This T7 file is not compatible with the SIDI function in T7Suite!");
                return m_sidcollection;
            }
            stream.Position -= 7L;

            long start_pos = stream.Position;
            byte[] bytes = new byte[12];
            uint num4 = 0x53;           //?? fixed length?
            //int num5 = 0;
            for (int i = 0; i <= num4; i++)
            {
                //logger.Debug("*****" + i.ToString());
                /*if (i == 65)
                {
                    logger.Debug("65");
                }*/
                for (int j = 0; j <= 3; j++)
                {
                    bytes[j] = (byte)stream.ReadByte();
                }
                // set text
                SIDIHelper sidihelper = new SIDIHelper();
                sidihelper.Symbol = Encoding.Default.GetString(bytes, 0, 4);
                sidihelper.Symbol = sidihelper.Symbol.Replace((char)0x00, (char)0x20);
                //logger.Debug(i.ToString() + " = " + Encoding.Default.GetString(bytes, 0, 4));
                stream.Position += 3L;
                for (int k = 0; k <= 2; k++)
                {
                    bytes[k] = (byte)stream.ReadByte();
                }
                sidihelper.AddressSRAM = Convert.ToInt32(BitConverter.ToString(bytes, 0, 3).Replace("-", ""), 16);
                for (int m = 0; m <= 0; m++)
                {
                    bytes[m] = (byte)stream.ReadByte();
                }
                sidihelper.Value = BitConverter.ToString(bytes, 0, 1).Replace("-", "");
                m_sidcollection.Add(sidihelper);
                stream.Position += 1L; // skip one
            }
            if (stream != null)
            {
                stream.Close();
            }
            return m_sidcollection;
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:75,代码来源:frmMain.cs


示例6: ConvertFileToDif


//.........这里部分代码省略.........
                            catch (Exception pE)
                            {
                                logger.Debug(pE.Message);
                            }
                        }
                    }
                }

                if (AutoExport)
                {
                    foreach (SymbolHelper sh in sc)
                    {
                        sh.Color = GetColorFromRegistry(sh.Varname);
                    }
                    DifGenerator difgen = new DifGenerator();
                    difgen.AppSettings = m_appSettings;

                    //difgen.LowAFR = m_appSettings.WidebandLowAFR;
                    //difgen.HighAFR = m_appSettings.WidebandHighAFR;
                    //difgen.MaximumVoltageWideband = m_appSettings.WidebandHighVoltage;
                    //difgen.MinimumVoltageWideband = m_appSettings.WidebandLowVoltage;
                    difgen.WidebandSymbol = m_appSettings.WideBandSymbol;
                    //difgen.UseWidebandInput = m_appSettings.UseWidebandLambdaThroughSymbol;
                    difgen.UseWidebandInput = false;

                    difgen.onExportProgress += new DifGenerator.ExportProgress(difgen_onExportProgress);
                    frmProgressLogWorks = new frmProgress();
                    frmProgressLogWorks.SetProgress("Exporting to LogWorks");
                    frmProgressLogWorks.Show();
                    System.Windows.Forms.Application.DoEvents();
                    try
                    {
                        difgen.ConvertFileToDif(filename, sc, startDate, endDate, m_appSettings.InterpolateLogWorksTimescale, m_appSettings.InterpolateLogWorksTimescale);
                    }
                    catch (Exception expE1)
                    {
                        logger.Debug(expE1.Message);
                    }
                    frmProgressLogWorks.Close();
                }
                else
                {

                    // show selection screen
                    frmPlotSelection plotsel = new frmPlotSelection();
                    foreach (SymbolHelper sh in sc)
                    {
                        plotsel.AddItemToList(sh.Varname);
                    }
                    plotsel.Startdate = startDate;
                    plotsel.Enddate = endDate;
                    plotsel.SelectAllSymbols();
                    if (plotsel.ShowDialog() == DialogResult.OK)
                    {
                        sc = plotsel.Sc;
                        endDate = plotsel.Enddate;
                        startDate = plotsel.Startdate;
                        DifGenerator difgen = new DifGenerator();
                        LogFilters filterhelper = new LogFilters();
                        difgen.SetFilters(filterhelper.GetFiltersFromRegistry());
                        difgen.AppSettings = m_appSettings;
                        //difgen.LowAFR = m_appSettings.WidebandLowAFR;
                        //difgen.HighAFR = m_appSettings.WidebandHighAFR;
                        //difgen.MaximumVoltageWideband = m_appSettings.WidebandHighVoltage;
                        //difgen.MinimumVoltageWideband = m_appSettings.WidebandLowVoltage;
                        difgen.WidebandSymbol = m_appSettings.WideBandSymbol;
                        //difgen.UseWidebandInput = m_appSettings.UseWidebandLambdaThroughSymbol;
                        difgen.UseWidebandInput = false;

                        difgen.onExportProgress += new DifGenerator.ExportProgress(difgen_onExportProgress);
                        frmProgressLogWorks = new frmProgress();
                        frmProgressLogWorks.SetProgress("Exporting to LogWorks");
                        frmProgressLogWorks.Show();
                        System.Windows.Forms.Application.DoEvents();
                        try
                        {
                            if (difgen.ConvertFileToDif(filename, sc, startDate, endDate, m_appSettings.InterpolateLogWorksTimescale, m_appSettings.InterpolateLogWorksTimescale))
                            {
                                StartLogWorksWithCurrentFile(Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + ".dif");
                            }
                            else
                            {
                                frmInfoBox info = new frmInfoBox("No data was found to export!");
                            }
                        }
                        catch (Exception expE2)
                        {
                            logger.Debug(expE2.Message);
                        }
                        frmProgressLogWorks.Close();
                    }
                    TimeSpan ts = new TimeSpan(endDate.Ticks - startDate.Ticks);
                    //MessageBox.Show("LogFile should be " + ts.ToString());
                }
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:101,代码来源:frmMain.cs


示例7: ExportToExcel

        private void ExportToExcel(string mapname, int address, int length, byte[] mapdata, int cols, int rows, bool isSixteenbit, int[] xaxisvalues, int[] yaxisvalues)
        {
            //en-US
            CultureInfo tci = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture = tci;

            try
            {
                bool isupsidedown = GetMapUpsideDown(mapname);
                try
                {
                    if (xla == null)
                    {
                        xla = new Microsoft.Office.Interop.Excel.Application();
                    }
                }
                catch (Exception xlaE)
                {
                    frmInfoBox info = new frmInfoBox("Failed to create office application interface");
                    logger.Debug("Failed to create office application interface: " + xlaE.Message);
                }

                // turn mapdata upside down
                if (isupsidedown)
                {
                    mapdata = TurnMapUpsideDown(mapdata, cols, rows, isSixteenbit);
                }

                xla.Visible = true;
                Microsoft.Office.Interop.Excel.Workbook wb = xla.Workbooks.Add(XlSheetType.xlWorksheet);
                Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)xla.ActiveSheet;
                ws.Name = "symboldata";

                // Now create the chart.
                ChartObjects chartObjs = (ChartObjects)ws.ChartObjects(Type.Missing);
                ChartObject chartObj = chartObjs.Add(100, 400, 400, 300);
                Microsoft.Office.Interop.Excel.Chart xlChart = chartObj.Chart;

                int nRows = rows;
                if (isSixteenbit) nRows /= 2;
                int nColumns = cols;
                string upperLeftCell = "B3";
                int endRowNumber = System.Int32.Parse(upperLeftCell.Substring(1)) + nRows - 1;
                char endColumnLetter = System.Convert.ToChar(Convert.ToInt32(upperLeftCell[0]) + nColumns - 1);
                string upperRightCell = System.String.Format("{0}{1}", endColumnLetter, System.Int32.Parse(upperLeftCell.Substring(1)));
                string lowerRightCell = System.String.Format("{0}{1}", endColumnLetter, endRowNumber);
                // Send single dimensional array to Excel:

                Range rg1 = ws.get_Range("B2", "Z2");
                double[] xarray = new double[nColumns];
                double[] yarray = new double[nRows];
                ws.Cells[1, 1] = "Data for " + mapname;
                for (int i = 0; i < xarray.Length; i++)
                {
                    if (xaxisvalues.Length > i)
                    {
                        xarray[i] = (int)xaxisvalues.GetValue(i);
                    }
                    else
                    {
                        xarray[i] = i;
                    }
                    //ws.Cells[i + 3, 1] = xarray[i];
                    ws.Cells[2, 2 + i] = xarray[i];
                }
                for (int i = 0; i < yarray.Length; i++)
                {
                    if (yaxisvalues.Length > i)
                    {
                        if (isupsidedown)
                        {
                            yarray[i] = (int)yaxisvalues.GetValue((yarray.Length - 1) - i);
                        }
                        else
                        {
                            yarray[i] = (int)yaxisvalues.GetValue(i);
                        }
                    }
                    else
                    {
                        yarray[i] = i;
                    }
                    ws.Cells[i + 3, 1] = yarray[i];
                    //ws.Cells[2, 2 + i] = yarray[i];
                }

                string xaxisdescr = "x-axis";
                string yaxisdescr = "y-axis";
                string zaxisdescr = "z-axis";
                //GetAxisDescriptions(m_currentfile, m_symbols, mapname, out xaxisdescr, out yaxisdescr, out zaxisdescr);
                SymbolAxesTranslator axestrans = new SymbolAxesTranslator();
                string x_axis = string.Empty;
                string y_axis = string.Empty;
                axestrans.GetAxisSymbols(mapname, out x_axis, out y_axis, out xaxisdescr, out yaxisdescr, out zaxisdescr);

                Range rg = ws.get_Range(upperLeftCell, lowerRightCell);
                rg.Value2 = AddData(nRows, nColumns, mapdata, isSixteenbit);

                Range chartRange = ws.get_Range("A2", lowerRightCell);

//.........这里部分代码省略.........
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:101,代码来源:frmMain.cs


示例8: barButtonItem62_ItemClick

        private void barButtonItem62_ItemClick(object sender, ItemClickEventArgs e)
        {
            // write the required file for flashing the ECU
            // this is the current file, exported to S19 format in the directory that contains
            // the selected batchfile
            if (m_appSettings.Write_ecubatchfile != string.Empty)
            {
                try
                {
                    if (File.Exists(m_appSettings.Write_ecubatchfile))
                    {

                        if (!verifychecksum(false))
                        {
                            frmChecksumIncorrect check = new frmChecksumIncorrect();
                            if (m_appSettings.AutoChecksum)
                            {
                                UpdateChecksum(m_currentfile);
                                if (m_fileiss19)
                                {
                                    // automatisch terugschrijven
                                    srec2bin cnvrt = new srec2bin();
                                    cnvrt.ConvertBinToSrec(m_currentfile);
                                }

                            }
                            //else if (MessageBox.Show("Checksum invalid, auto correct?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            else if (check.ShowDialog() == DialogResult.Yes)
                            {
                                UpdateChecksum(m_currentfile);
                                if (m_fileiss19)
                                {
                                    // automatisch terugschrijven
                                    srec2bin cnvrt = new srec2bin();
                                    cnvrt.ConvertBinToSrec(m_currentfile);
                                }
                            }
                        }

                        srec2bin sr = new srec2bin();
                        sr.ConvertBinToSrec(m_currentfile);
                        // and copy it to the target directory
                        string fromfile = Path.GetDirectoryName(m_currentfile) + "\\" + Path.GetFileNameWithoutExtension(m_currentfile) + ".S19";
                        string destfile = Path.GetDirectoryName(m_appSettings.Write_ecubatchfile) + "\\TO_ECU.S19";
                        File.Copy(fromfile, destfile, true);
                        System.Diagnostics.Process.Start(m_appSettings.Write_ecubatchfile);
                    }
                    else
                    {
                        frmInfoBox info = new frmInfoBox("Batch file not found. Check parameters");
                    }
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message);
                }
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:58,代码来源:frmMain.cs


示例9: barButtonItem81_ItemClick

        private void barButtonItem81_ItemClick(object sender, ItemClickEventArgs e)
        {
            // read ECU
            bool _continue = true;
            try
            {
                if (!_globalBDMOpened)
                {
                    if (!BdmAdapter_Open())
                    {
                        frmInfoBox info = new frmInfoBox("Could not connect to the BDM adapter");
                        _continue = false;
                    }
                }
                if (_continue)
                {
                    _globalBDMOpened = true;
                    if (BDMversion == 0)
                    {
                        if (!BdmAdapter_GetVersion(ref BDMversion))
                        {
                            frmInfoBox info = new frmInfoBox("BDM adapter is not compatible");
                            _continue = false;
                        }
                    }
                    if (_continue)
                    {
                        // adapter opened and version is compatible
                        //BdmAdapter_GetVerifyFlash();
                        // read ECU through USB BDM

                        SaveFileDialog sfd = new SaveFileDialog();
                        sfd.Filter = "Binary files|*.bin";
                        if (sfd.ShowDialog() == DialogResult.OK)
                        {

                            mRecreateAllScriptResources(Path.GetDirectoryName(sfd.FileName));
                            barProgress.Visibility = BarItemVisibility.Always;
                            barProgress.EditValue = 0;
                            barProgress.Caption = "Dumping ECU";
                            System.Windows.Forms.Application.DoEvents();

                            _globalECUType = ecu_t.Trionic7;
                            fio_bytes = 0;
                            if (!BdmAdapter_DumpECU(sfd.FileName, ecu_t.Trionic7))
                            {
                                frmInfoBox info = new frmInfoBox("Failed to dump ECU");
                            }
                            DeleteScripts(Path.GetDirectoryName(sfd.FileName));
                        }

                    }
                }
                barProgress.Caption = "Dumping ECU";
                barProgress.EditValue = 0;
                barProgress.Visibility = BarItemVisibility.Never;
                System.Windows.Forms.Application.DoEvents();
            }
            catch (Exception BDMException)
            {
                logger.Debug("Failed to dump ECU: " + BDMException.Message);
                frmInfoBox info = new frmInfoBox("Failed to download firmware from ECU: " + BDMException.Message);
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:64,代码来源:frmMain.cs


示例10: barButtonItem41_ItemClick

 private void barButtonItem41_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (m_currentfile != "")
     {
         openFileDialog1.Multiselect = false;
         if (openFileDialog1.ShowDialog() == DialogResult.OK)
         {
             frmBinCompare bincomp = new frmBinCompare();
             //bincomp.SetSymbolCollection(m_symbols);
             //bincomp.OutsideSymbolBoundary = true;
             bincomp.SetCurrentFilename(m_currentfile);
             bincomp.SetCompareFilename(openFileDialog1.FileName);
             bincomp.CompareFiles();
             bincomp.ShowDialog();
         }
     }
     else
     {
         frmInfoBox info = new frmInfoBox("No file is currently opened, you need to open a binary file first to compare it to another one!");
     }
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:21,代码来源:frmMain.cs


示例11: barButtonItem61_ItemClick

        private void barButtonItem61_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (m_appSettings.Read_ecubatchfile != string.Empty)
            {
                try
                {
                    if (File.Exists(m_appSettings.Read_ecubatchfile))
                    {
                        System.Diagnostics.Process process = new System.Diagnostics.Process();
                        process.StartInfo = new System.Diagnostics.ProcessStartInfo(m_appSettings.Read_ecubatchfile);
                        process.Start();
                        process.WaitForExit();
                        // now, import the resulting S19 file
                        string fromfile = Path.GetDirectoryName(m_appSettings.Read_ecubatchfile) + "\\FROM_ECU.S19";
                        string destfile = Path.GetDirectoryName(m_currentfile) + "\\FROM_ECU" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".S19";
                        File.Copy(fromfile, destfile, true);
                        if (m_appSettings.TargetECUReadFile != string.Empty)
                        {
                            CloseProject();
                            m_appSettings.Lastprojectname = "";
                            File.Copy(fromfile, m_appSettings.TargetECUReadFile, true);
                            OpenFile(m_appSettings.TargetECUReadFile, false);
                            m_appSettings.LastOpenedType = 0;
                        }
                        else
                        {
                            CloseProject();
                            m_appSettings.Lastprojectname = "";
                            OpenFile(destfile, false);
                            m_appSettings.LastOpenedType = 0;

                        }
                    }
                    else
                    {
                        frmInfoBox info = new frmInfoBox("Batch file not found. Check parameters");
                    }
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message);
                }
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:44,代码来源:frmMain.cs


示例12: barButtonItem16_ItemClick

 private void barButtonItem16_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         if (File.Exists(System.Windows.Forms.Application.StartupPath + "//Trionic 7.pdf"))
         {
             System.Diagnostics.Process.Start(System.Windows.Forms.Application.StartupPath + "//Trionic 7.pdf");
         }
         else
         {
             frmInfoBox info = new frmInfoBox("Trionic 7 documentation could not be found or opened!");
         }
     }
     catch (Exception E2)
     {
         logger.Debug(E2.Message);
     }
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:18,代码来源:frmMain.cs


示例13: barButtonItem15_ItemClick

 private void barButtonItem15_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         //T7_manual.pdf with user manual content
         if (File.Exists(System.Windows.Forms.Application.StartupPath + "//T7_manual.pdf"))
         {
             System.Diagnostics.Process.Start(System.Windows.Forms.Application.StartupPath + "//T7_manual.pdf");
         }
         else
         {
             frmInfoBox info = new frmInfoBox("T7Suite user manual could not be found or opened!");
         }
     }
     catch (Exception E2)
     {
         logger.Debug(E2.Message);
     }
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:19,代码来源:frmMain.cs


示例14: verifychecksum

        private bool verifychecksum(bool showinterface)
        {
            //Verify checksums and show result

            bool m_checksums_ok = true;
            if (File.Exists(m_currentfile))
            {
                T7FileHeader t7InfoHeader = null;
                t7InfoHeader = new T7FileHeader();
                t7InfoHeader.init(m_currentfile, m_appSettings.AutoFixFooter);

                ChecksumHandler csHandler = new ChecksumHandler();
                csHandler.SramOffset = m_currentSramOffsett;
                int fwLength = t7InfoHeader.getFWLength();
                int calculatedFWChecksum = csHandler.calculateFWChecksum(m_currentfile);

                uint calculatedF2Checksum = csHandler.calculateF2Checksum(m_currentfile, 0, fwLength);
                int calculatedFBChecksum = csHandler.calculateFBChecksum(m_currentfile, 0, fwLength);

                int readF2checksum = t7InfoHeader.getChecksumF2();
                int readFBchecksum = t7InfoHeader.getChecksumFB();

                if (readF2checksum != 0)
                {
                    if (t7InfoHeader.getChecksumF2() != (int)calculatedF2Checksum)
                    {
                        m_checksums_ok = false;
                    }
                }

                if (t7InfoHeader.getChecksumFB() != calculatedFBChecksum)
                {
                    m_checksums_ok = false;
                }
                if (csHandler.getFWChecksum(m_currentfile) != calculatedFWChecksum)
                {
                    m_checksums_ok = false;
                }
                if (m_checksums_ok)
                {
                    if (showinterface)
                    {
                        frmInfoBox info = new frmInfoBox("Checksums verified and all matched!");
                    }
                }
                else
                {
                    if (m_appSettings.AutoChecksum)
                    {
                        logger.Debug("calculatedF2Checksum = " + calculatedF2Checksum.ToString("X8") + " readF2checksum = " + readF2checksum.ToString("X8"));
                        logger.Debug("calculatedFBChecksum = " + calculatedFBChecksum.ToString("X8") + " readFBchecksum = " + readFBchecksum.ToString("X8"));
                        logger.Debug("calculatedFWChecksum = " + calculatedFWChecksum.ToString("X8") + " csHandler.getFWChecksum(m_currentfile) = " + csHandler.getFWChecksum(m_currentfile).ToString("X8"));

                        csHandler.setFWChecksum(m_currentfile, calculatedFWChecksum);
                        t7InfoHeader.setChecksumF2((int)calculatedF2Checksum);
                        t7InfoHeader.setChecksumFB(calculatedFBChecksum);
                        t7InfoHeader.save(m_currentfile);
                        if (showinterface)
                        {
                            frmInfoBox info = new frmInfoBox("Checksums did not verify ok, but were recalculated.");
                        }

                    }
                    else
                    {
                        if (MessageBox.Show("Checksums did not verify ok, do you want to recalculate and update the checksums?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            csHandler.setFWChecksum(m_currentfile, calculatedFWChecksum);
                            t7InfoHeader.setChecksumF2((int)calculatedF2Checksum);
                            t7InfoHeader.setChecksumFB(calculatedFBChecksum);
                            t7InfoHeader.save(m_currentfile);
                        }
                    }
                }
            }
            else
            {
                if (showinterface)
                {
                    frmInfoBox info = new frmInfoBox("Current file does not exsist, please re-open the file.");
                }
            }
            return m_checksums_ok;
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:84,代码来源:frmMain.cs


示例15: btnUploadTuningPackage_ItemClick

 private void btnUploadTuningPackage_ItemClick(object sender, ItemClickEventArgs e)
 {
     // upload a t7p file to the ECU
     if (m_currentfile != "")
     {
         if (CheckCANConnectivity())
         {
             OpenFileDialog ofd = new OpenFileDialog();
             ofd.Filter = "Trionic 7 packages|*.t7p";
             ofd.Multiselect = false;
             char[] sep = new char[1];
             sep.SetValue(',', 0);
             SymbolCollection scToImport = new SymbolCollection();
             if (ofd.ShowDialog() == DialogResult.OK)
             {
                 //TODO: create a list of maps to import .. maybe?
                 frmProgress progress = new frmProgress();
                 progress.SetProgress("Uploading tuning package...");
                 progress.Show();
                 using (StreamReader sr = new StreamReader(ofd.FileName))
                 {
                     string line = string.Empty;
                     SymbolHelper sh_Import = new SymbolHelper();
                     while ((line = sr.ReadLine()) != null)
                     {
                         if (line.StartsWith("symbol="))
                         {
                             //
                             sh_Import = new SymbolHelper();
                             sh_Import.Varname = line.Replace("symbol=", "");
                         }
                         else if (line.StartsWith("length="))
                         {
                             sh_Import.Length = Convert.ToInt32(line.Replace("length=", ""));
                         }
                         else if (line.StartsWith("data="))
                         {
                             //
                             try
                             {
                                 string dataBytes = line.Replace("data=", "");
                                 // split using ','
                                 string[] bytesInStrings = dataBytes.Split(sep);
                                 byte[] dataToInsert = new byte[sh_Import.Length];
                                 for (int t = 0; t < sh_Import.Length; t++)
                                 {
                                     byte b = Convert.ToByte(bytesInStrings[t], 16);
                                     dataToInsert.SetValue(b, t);
                                 }
                                 int addressInFile = (int)GetSymbolAddress(m_symbols, sh_Import.Varname);
                                 if (addressInFile > 0)
                                 {
                                     if (sh_Import.Varname != "MapChkCal.ST_Enable")
                                     {
                                         progress.SetProgress("Uploading: " + sh_Import.Varname);
                                         WriteMapToSRAM(sh_Import.Varname, dataToInsert, false);
                                         System.Windows.Forms.Application.DoEvents();
                                         Thread.Sleep(1);
                                     }
                                 }
                             }
                             catch (Exception E)
                             {
                                 // add failure
                                 logger.Debug(E.Message);
                             }
                         }
                     }
                 }
                 if (progress != null) progress.Close();
             }
         }
         else
         {
             frmInfoBox info = new frmInfoBox("An active CAN bus connection is needed to upload a tuning package");
         }
     }
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:78,代码来源:frmMain.cs


示例16: barButtonItem82_ItemClick

        private void barButtonItem82_ItemClick(object sender, ItemClickEventArgs e)
        {
            // flash ECU
            bool _continue = true;
            try
            {
                if (!_globalBDMOpened)
                {
                    if (!BdmAdapter_Open())
                    {
                        frmInfoBox info = new frmInfoBox("Could not connect to the BDM adapter");
                        _continue = false;
                    }
                }
                if (_continue)
                {
                    _globalBDMOpened = true;
                    if (BDMversion == 0)
                    {
                        if (!BdmAdapter_GetVersion(ref BDMversion))
                        {
                

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Collections.ExtendedProperties类代码示例发布时间:2022-05-24
下一篇:
C# CommonSuite.SymbolCollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap