当前位置: 首页>>代码示例>>C#>>正文


C# CommonSuite.SymbolCollection类代码示例

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


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

示例1: LoadDataFromFile

        internal void LoadDataFromFile(string filename, SymbolCollection m_symbols)
        {
            richTextBox1.LoadFile(filename, RichTextBoxStreamType.RichText);

            //richTextBox1.LoadFile(filename, RichTextBoxStreamType.PlainText);
            /*string totaltext = string.Empty;

            int linecount = 0;
            using (StreamReader sr = new StreamReader(filename))
            {
                using (StreamWriter sw = new StreamWriter(Application.StartupPath + "\\temp.asm", false))
                {
                    sw.Write(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1043{\fonttbl{\f0\fswiss\fcharset0 Courier new;}}{\colortbl ;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;}{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\lang1033\f0\fs20 ");
                    string line = string.Empty;
                    while ((line = sr.ReadLine()) != null)
                    {
                        sw.WriteLine(HighlightText(line) + @"\par");
                        linecount++;
                        //if (linecount == 1000) break;
                    }
                    sw.Write(@"\lang1043\par}");
                }
            }
            richTextBox1.LoadFile(Application.StartupPath + "\\temp.asm");*/
            //richTextBox1.Text = totaltext;
        }
开发者ID:Meindert66,项目名称:T8SuitePro,代码行数:26,代码来源:AsmViewer.cs

示例2: ExportPackage

        public void ExportPackage(SymbolCollection sc, string filename, string packagefilename)
        {
            if (File.Exists(packagefilename)) File.Delete(packagefilename);

            foreach (SymbolHelper sh in sc)
            {
                if (sh.Flash_start_address - m_AddressOffset > 0 && sh.Flash_start_address - m_AddressOffset < 0x80000)
                {

                    byte[] data = readdatafromfile(filename, (int)sh.Flash_start_address - m_AddressOffset, sh.Length);
                    // if the symbol contains data... use that
                    if (sh.Currentdata != null)
                    {
                        if (sh.Length > 0) data = sh.Currentdata;
                    }
                    ExportMap(packagefilename, sh.Varname, sh.Userdescription, sh.Length, data);
                }
                else if (sh.Flash_start_address  > 0 && sh.Flash_start_address  < 0x80000)
                {

                    byte[] data = readdatafromfile(filename, (int)sh.Flash_start_address , sh.Length);
                    // if the symbol contains data... use that
                    if (sh.Currentdata != null)
                    {
                        if (sh.Length > 0) data = sh.Currentdata;
                    }
                    ExportMap(packagefilename, sh.Varname, sh.Userdescription, sh.Length, data);
                }
            }
        }
开发者ID:ChrisPea,项目名称:TuningSuites,代码行数:30,代码来源:PackageExporter.cs

示例3: SetSymbolList

 public void SetSymbolList(SymbolCollection sc)
 {
     lookUpEdit1.Properties.DisplayMember = "Varname";
     lookUpEdit1.Properties.ValueMember = "Varname";
     lookUpEdit2.Properties.DisplayMember = "Varname";
     lookUpEdit2.Properties.ValueMember = "Varname";
     lookUpEdit3.Properties.DisplayMember = "Varname";
     lookUpEdit3.Properties.ValueMember = "Varname";
     lookUpEdit1.Properties.DataSource = sc;
     lookUpEdit2.Properties.DataSource = sc;
     lookUpEdit3.Properties.DataSource = sc;
     _symbols = sc;
 }
开发者ID:ChrisPea,项目名称:TuningSuites,代码行数:13,代码来源:frmMatrixSelection.cs

示例4: ShowSymbolCollection

        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.Varname;
                if (sh.Userdescription != "" && sh.Userdescription != String.Format("Symbolnumber {0}", sh.Symbol_number))
                {
                    name = sh.Userdescription;
                }

                sat.GetAxisSymbols(name, out xaxis, out yaxis, out xaxisdescr, out yaxisdescr, out zaxisdescr);
                string symboldescr = symtrans.TranslateSymbolToHelpText(name, out helptext, out cat, out subcat, m_ApplicationLanguage);
                if (xaxis != "")
                {
                    xaxisdescr = symtrans.TranslateSymbolToHelpText(xaxis, out helptext, out cat, out subcat, m_ApplicationLanguage);
                }
                if (yaxis != "")
                {
                    yaxisdescr = symtrans.TranslateSymbolToHelpText(yaxis, out helptext, out cat, out subcat, m_ApplicationLanguage);
                }
                if (xaxis != "" || yaxis != "")
                {
                    dt.Rows.Add(name, symboldescr, xaxis, xaxisdescr, yaxis, yaxisdescr);
                }
            }
            gridControl1.DataSource = dt;
        }
开发者ID:ChrisPea,项目名称:TuningSuites,代码行数:45,代码来源:AxisBrowser.cs

示例5: GetSelectedSymbolCollection

        public SymbolCollection GetSelectedSymbolCollection()
        {
            // build a new collection based on the selected rows
            SymbolCollection scSelected = new SymbolCollection();
            if (gridControl1.DataSource != null)
            {
                //DataTable dt = (DataTable)gridControl1.DataSource;

                int[] selrows = gridView1.GetSelectedRows();
                foreach (int rowhandle in selrows)
                {
                    SymbolHelper sh = (SymbolHelper)gridView1.GetRow(rowhandle);
                    if (sh != null)
                    {
                        scSelected.Add(sh);
                    }
                }
            }
            return scSelected;
        }
开发者ID:ChrisPea,项目名称:TuningSuites,代码行数:20,代码来源:frmSymbolSelection.cs

示例6: Actions_btnCompareSRAMSnapshots_ItemClick


//.........这里部分代码省略.........
                                frmInfoBox info = new frmInfoBox("Sram data structure invalid... " + sh.Varname);
                                return;
                            }
                            else
                            {
                                double diffperc = 0;
                                int diffabs = 0;
                                double diffavg = 0;
                                bool isdifferent = false;
                                if (isSixteenBitTable(sh.Varname))
                                {
                                    for (int i = 0; i < data_1.Length; i += 2)
                                    {
                                        try
                                        {
                                            int value1 = (int)(byte)data_1.GetValue(i) * 256;
                                            value1 += (int)(byte)data_1.GetValue(i + 1);
                                            int value2 = (int)(byte)data_2.GetValue(i) * 256;
                                            value2 += (int)(byte)data_2.GetValue(i + 1);
                                            if (value1 != value2)
                                            {
                                                isdifferent = true;
                                                diffabs++;
                                            }
                                        }
                                        catch (Exception E)
                                        {
                                            logger.Debug(E.Message);
                                        }
                                    }
                                }
                                else
                                {
                                    for (int i = 0; i < data_1.Length; i++)
                                    {
                                        if ((byte)data_1.GetValue(i) != (byte)data_2.GetValue(i))
                                        {
                                            isdifferent = true;
                                            diffabs++;
                                        }
                                    }
                                }
                                if (isdifferent)
                                {
                                    int lengthvalues = sh.Length;
                                    if (isSixteenBitTable(sh.Varname)) lengthvalues /= 2;
                                    diffperc = (diffabs * 100) / lengthvalues;
                                    dt.Rows.Add(sh.Varname, sh.Start_address, sh.Flash_start_address, sh.Length, lengthvalues, sh.Description, false, 0, diffperc, diffabs, diffavg, sh.Category.ToString().Replace("_", " "), sh.Subcategory.ToString().Replace("_", " "), sh.Symbol_number, sh.Symbol_number, sh.Userdescription);
                                }
                            }
                        }

                    }
                    progress.Close();
                    SymbolCollection compSymbols = new SymbolCollection();
                    //AddressLookupCollection compAddressLookup = new AddressLookupCollection();
                    dockManager1.BeginUpdate();
                    try
                    {
                        DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                        SRAMCompareResults tabdet = new SRAMCompareResults();
                        tabdet.Dock = DockStyle.Fill;
                        tabdet.Filename1 = filename_1;
                        tabdet.Filename2 = filename_2;
                        tabdet.onSRAMSymbolSelect += new SRAMCompareResults.NotifySRAMSelectSymbol(tabdet_onSRAMSymbolSelect);
                        dockPanel.Controls.Add(tabdet);
                        //dockPanel.DockAsTab(dockPanel1);
                        dockPanel.Text = "SRAM compare results: " + Path.GetFileName(filename_1) + " " + Path.GetFileName(filename_2);
                        bool isDocked = false;
                        foreach (DockPanel pnl in dockManager1.Panels)
                        {
                            if (pnl.Text.StartsWith("SRAM compare results: ") && pnl != dockPanel && (pnl.Visibility == DockVisibility.Visible))
                            {
                                dockPanel.DockAsTab(pnl, 0);
                                isDocked = true;
                                break;
                            }
                        }
                        if (!isDocked)
                        {
                            dockPanel.DockTo(dockManager1, DockingStyle.Left, 1);
                            dockPanel.Width = 700;
                        }
                        //CompareSymbolTable(filename, compSymbols, compAddressLookup, tabdet.gridControl1);
                        tabdet.gridControl1.DataSource = dt;
                        //tabdet.CompareTrionic5Tools.SymbolCollection = compSymbols;
                        //tabdet.CompareAddressLookupCollection = compAddressLookup;
                        tabdet.OpenGridViewGroups(tabdet.gridControl1, 1);
                    }
                    catch (Exception E)
                    {
                        logger.Debug(E.Message);
                    }
                    dockManager1.EndUpdate();
                    SetStatusText("SRAM compare done");
                    //SetTaskProgress(0, false);

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

示例7: GetXaxisValues

        private int[] GetXaxisValues(string filename, SymbolCollection curSymbols, string symbolname)
        {
            int[] retval = new int[1];
            retval.SetValue(0, 0);
            int xaxisaddress = 0;
            int xaxislength = 0;
            bool issixteenbit = true;
            double multiplier = 1;

            SymbolAxesTranslator axistranslator = new SymbolAxesTranslator();
            string x_axis = string.Empty;
            string y_axis = string.Empty;
            string x_axis_descr = string.Empty;
            string y_axis_descr = string.Empty;
            string z_axis_descr = string.Empty;
            if (axistranslator.GetAxisSymbols(symbolname, out x_axis, out y_axis, out x_axis_descr, out y_axis_descr, out z_axis_descr))
            {
                if (x_axis != "")
                {
                    xaxislength = GetSymbolLength(curSymbols, x_axis);
                    xaxisaddress = (int)GetSymbolAddress(curSymbols, x_axis);
                }
            }
            multiplier = GetMapCorrectionFactor(x_axis);

            int number = xaxislength;
            if (xaxislength > 0)
            {
                byte[] axisdata = readdatafromfile(filename,xaxisaddress, xaxislength);
                if (issixteenbit) number /= 2;
                retval = new int[number];
                int offset = 0;
                for (int i = 0; i < xaxislength; i++)
                {

                    if (issixteenbit)
                    {
                        byte val1 = (byte)axisdata.GetValue(i);
                        byte val2 = (byte)axisdata.GetValue(++i);
                        int ival1 = Convert.ToInt32(val1);
                        int ival2 = Convert.ToInt32(val2);
                        int value = (ival1 * 256) + ival2;
                        if (symbolname == "BstKnkCal.MaxAirmass" || symbolname == "BstKnkCal.MaxAirmassAu")
                        {
                            if (value > 32000) value = -(65536 - value); // negatief maken
                        }
                        double valtot = (double)value * multiplier;
                        value = (int)valtot;
                        retval.SetValue(value, offset++);
                    }
                    else
                    {
                        byte val1 = (byte)axisdata.GetValue(i);
                        int ival1 = Convert.ToInt32(val1);
                        double valtot = (double)ival1 * multiplier;
                        ival1 = (int)valtot;
                        retval.SetValue(ival1, offset++);
                    }
                }
            }
            return retval;
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:62,代码来源:frmMain.cs

示例8: GetTableMatrixWitdhByName

        private int GetTableMatrixWitdhByName(string filename, SymbolCollection curSymbols, string symbolname, out int columns, out int rows)
        {
            columns = 1;// GetSymbolLength(curSymbols, symbolname) / 2;
            if (symbolname == "TorqueCal.M_NominalMap") columns = 18;
            else if (symbolname == "TorqueCal.M_IgnInflTorqMap") columns = 18; //<GS-31052011>
            //else if (symbolname == "TorqueCal.M_EngXSP") columns = 18;
            else if (symbolname == "TorqueCal.X_AccPedalMap") columns = 16;
            else if (symbolname == "TorqueCal.fi_IgnLimMap") columns = 18; //??
            else if (symbolname == "IgnKnkCal.AdapTimer") columns = 18;
            else if (symbolname == "IgnNormCal2Type") columns = 18;
            else if (symbolname == "KnkSoundRedCalType") columns = 18;
            //else if (symbolname == "IgnLOffCal.n_EngYSP") columns = 18;
            else if (symbolname == "MissfCal.DetLevLowLim") columns = 18;
            else if (symbolname == "MissfCal.DetectLevel") columns = 18;
            else if (symbolname == "KnkFuelCal.EnrichmentMap") columns = 18;
            else if (symbolname == "KnkFuelCalType") columns = 18;
            // else if (symbolname == "IgnNormCal.ST_Enable") columns = 18;
            else if (symbolname == "KnkFuelCal.fi_MapMaxOff") columns = 16;
            else if (symbolname == "AirComp.LimPresComp") columns = 8;
            else if (symbolname == "IgnTempCal.AirMap") columns = 5;
            else if (symbolname == "IgnTempCal.EngMap") columns = 5;
            else if (symbolname == "TorqueCal.fi_IgnMinTab") columns = 4;
            else if (symbolname == "MissfCal.DetectLoadLevel") columns = 5;
            else if (symbolname == "KnkDetCal.RefFactorMap") columns = 16;
            else if (symbolname == "BFuelCal.Map") columns = 18;
            else if (symbolname == "BFuelCal.StartMap") columns = 18;
            else if (symbolname == "BFuelCal.E85Map") columns = 18;
            //else if (symbolname == "TorqueCal.M_IgnInflTorqMap") columns = 18;
            else if (symbolname == "TCompCal.EnrFacMap") columns = 8;
            else if (symbolname == "TCompCal.EnrFacE85Map") columns = 8;

            else if (symbolname == "TCompCal.EnrFacAutMap") columns = 8;
            else if (symbolname == "AftSt2ExtraCal.EnrFacMap") columns = 15;
            else if (symbolname == "AftSt2ExtraCal.EnrMapE85") columns = 7;
            else if (symbolname == "AftSt1ExtraCal.EnrFacMap") columns = 15;
            else if (symbolname == "StartCal.HighAltFacMap") columns = 15;
            else if (symbolname == "BoostCal.p_DiffILimMap") columns = 4;
            else if (symbolname == "MissfCal.outOfLimDelayMAT") columns = 4;
            else if (symbolname == "KnkAdaptCal.WeightMap2") columns = 4;
            else if (symbolname == "KnkAdaptCal.MaxRef") columns = 3;
            else if (symbolname == "MissfAdap.MissfCntMap") columns = 18;
            else if (symbolname == "TorqueCal.M_PumpLossMap") columns = 2;
            else if (symbolname == "HotStCal2.RestartMap") columns = 6;
            else if (symbolname == "StartCal.ScaleFacRpmE85Map") columns = 8;
            else if (symbolname == "StartCal.ScaleFacRpmMap") columns = 8;
            else if (symbolname == "SwitchCal.A_AmbPresMap") columns = 2;

            /*
            Maps met lengte 242 hebben 11 hoogte en breedte 22
            Maps met lengte 200 hebben 10 hoogte en breedte 20
            Maps met lengte 198 hebben 11 hoogte en breedte 18
            Maps met lengte 100 hebben 5 hoogte en breedte 20                 * */

            /* 16
            TorqueCal.M_NominalMap 18
            TorqueCal.M_IgnInflTroqMap 8*/
            else if (GetSymbolLength(curSymbols, symbolname) == 576) columns = 18;
            else if (GetSymbolLength(curSymbols, symbolname) == 512) columns = 16;

            else if (GetSymbolLength(curSymbols, symbolname) == 336) columns = 12;

            else if (GetSymbolLength(curSymbols, symbolname) == 288) columns = 9;
            else if (GetSymbolLength(curSymbols, symbolname) == 256) columns = 8;
            else if (GetSymbolLength(curSymbols, symbolname) == 242) columns = 11; // of 11?
            else if (GetSymbolLength(curSymbols, symbolname) == 224) columns = 8;
            else if (GetSymbolLength(curSymbols, symbolname) == 200) columns = 10; //
            else if (GetSymbolLength(curSymbols, symbolname) == 198) columns = 9; //
            else if (GetSymbolLength(curSymbols, symbolname) == 192) columns = 8;
            else if (GetSymbolLength(curSymbols, symbolname) == 128) columns = 8;
            else if (GetSymbolLength(curSymbols, symbolname) == 120) columns = 5;
            else if (GetSymbolLength(curSymbols, symbolname) == 100) columns = 10;
            else if (GetSymbolLength(curSymbols, symbolname) == 98) columns = 7;
            else if (GetSymbolLength(curSymbols, symbolname) == 80) columns = 5;
            else if (GetSymbolLength(curSymbols, symbolname) == 60) columns = 5;
            else if (GetSymbolLength(curSymbols, symbolname) == 50) columns = 5;
            else if (GetSymbolLength(curSymbols, symbolname) == 96) columns = 6;
            else if (GetSymbolLength(curSymbols, symbolname) == 64) columns = 4;
            else if (GetSymbolLength(curSymbols, symbolname) == 160) columns = 10;
            else if (GetSymbolLength(curSymbols, symbolname) == 72) columns = 9;

            rows = GetSymbolLength(curSymbols, symbolname) / columns;
            return columns;
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:83,代码来源:frmMain.cs

示例9: GetSymbolAddressSRAM

 private Int64 GetSymbolAddressSRAM(SymbolCollection curSymbolCollection, string symbolname)
 {
     foreach (SymbolHelper sh in curSymbolCollection)
     {
         if (sh.Varname == symbolname || sh.Userdescription == symbolname)
         {
             return sh.Start_address;
         }
     }
     return 0;
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:11,代码来源:frmMain.cs

示例10: GetRealtimeNotificationSymbols

 private SymbolCollection GetRealtimeNotificationSymbols()
 {
     SymbolCollection _symbols = new SymbolCollection();
     if (m_symbols != null)
     {
         foreach (SymbolHelper sh in m_symbols)
         {
             if (sh.Start_address > 0xF00000)
             {
                 _symbols.Add(sh);
             }
         }
     }
     return _symbols;
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:15,代码来源:frmMain.cs

示例11: File_ImportTuningPackage_ItemClick

        private void File_ImportTuningPackage_ItemClick(object sender, ItemClickEventArgs e)
        {
            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("Result");

            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)
                                {
                                    if (_softwareIsOpen && sh_Import.Varname == "MapChkCal.ST_Enable")
                                    {
                                        dt.Rows.Add(sh_Import.Varname, "Skipped");
                                    }
                                    else
                                    {
                                        savedatatobinary(addressInFile, sh_Import.Length, dataToInsert, m_currentfile, true);
                                        // add successful
                                        dt.Rows.Add(sh_Import.Varname, "Success");
                                    }
                                }
                                else
                                {
                                    // add failure
                                    dt.Rows.Add(sh_Import.Varname, "Fail");
                                }
                            }
                            catch (Exception E)
                            {
                                // add failure
                                dt.Rows.Add(sh_Import.Varname, "Fail");
                                logger.Debug(E.Message);
                            }
                        }
                    }
                }
                UpdateChecksum(m_currentfile);
                frmImportResults res = new frmImportResults();
                res.SetDataTable(dt);
                res.ShowDialog();
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:81,代码来源:frmMain.cs

示例12: AddToSymbolCollection

 private void AddToSymbolCollection(SymbolCollection scToExport, string symbolName)
 {
     foreach (SymbolHelper sh in m_symbols)
     {
         if (sh.Varname == symbolName || sh.Userdescription == symbolName)
         {
             SymbolHelper shNew = new SymbolHelper();
             shNew.Start_address = sh.Start_address;
             shNew.Symbol_number = sh.Symbol_number;
             shNew.Symbol_number_ECU = sh.Symbol_number_ECU;
             shNew.Internal_address = sh.Internal_address;
             shNew.Varname = symbolName;
             shNew.Flash_start_address = sh.Flash_start_address;
             shNew.Length = sh.Length;
             shNew.Userdescription = symbolName;
             scToExport.Add(shNew);
             break;
         }
     }
 }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:20,代码来源:frmMain.cs

示例13: addToMyMapsToolStripMenuItem_Click

        private void addToMyMapsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridViewSymbols.FocusedRowHandle >= 0)
            {
                SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow(gridViewSymbols.FocusedRowHandle);
                SymbolCollection scmymaps = new SymbolCollection();
                SymbolHelper shnewmymap = new SymbolHelper();
                shnewmymap.Varname = sh.Varname;
                shnewmymap.Description = sh.Varname;
                shnewmymap.Category = "Directly added";
                scmymaps.Add(shnewmymap);
                string filename = System.Windows.Forms.Application.StartupPath + "\\mymaps.xml";
                if (File.Exists(filename))
                {
                    try
                    {
                        System.Xml.XmlDocument mymaps = new System.Xml.XmlDocument();
                        mymaps.Load(System.Windows.Forms.Application.StartupPath + "\\mymaps.xml");
                        foreach (System.Xml.XmlNode category in mymaps.SelectNodes("categories/category"))
                        {
                            foreach (System.Xml.XmlNode map in category.SelectNodes("map"))
                            {
                                SymbolHelper shmap = new SymbolHelper();
                                shmap.Varname = map.Attributes["symbol"].Value;
                                shmap.Category = category.Attributes["title"].Value;
                                shmap.Description = map.Attributes["title"].Value;
                                scmymaps.Add(shmap);
                            }
                        }
                    }
                    catch { }
                }
                // now save a new file
                if (File.Exists(filename))
                {
                    File.Delete(filename);
                }
                XmlDocument doc = new XmlDocument();// Create the XML Declaration, and append it to XML document
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null);
                doc.AppendChild(dec);// Create the root element
                XmlElement root = doc.CreateElement("categories");
                doc.AppendChild(root);

                scmymaps.SortColumn = "Category";
                scmymaps.SortingOrder = GenericComparer.SortOrder.Ascending;
                scmymaps.Sort();

                string previouscat = "";
                XmlElement title = doc.CreateElement("category");
                foreach (SymbolHelper shmm in scmymaps)
                {
                    if (shmm.Category != previouscat)
                    {
                        previouscat = shmm.Category;
                        title = doc.CreateElement("category");
                        title.SetAttribute("title", previouscat);
                        root.AppendChild(title);
                    }
                    XmlElement map = doc.CreateElement("map");
                    map.SetAttribute("symbol", shmm.Varname);
                    map.SetAttribute("title", shmm.Description);
                    title.AppendChild(map);
                }
                doc.Save(filename);
                if (ribbonControl1.Pages[3].Text == "My Maps")
                {
                    ribbonControl1.Pages.RemoveAt(3);
                }
                LoadMyMaps();
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:71,代码来源:frmMain.cs

示例14: TryToOpenFileUsingClass

        private Trionic7File TryToOpenFileUsingClass(string filename, out SymbolCollection symbol_collection, int filename_size, bool isWorkingFile)
        {
            Trionic7File retval = new Trionic7File();

            retval.onProgress += retval_onProgress;
            SymbolTranslator translator = new SymbolTranslator();
            string help = string.Empty;
            _softwareIsOpen = false;
            _softwareIsOpenDetermined = false;
            m_currentsramfile = string.Empty; // geen sramfile erbij
            barStaticItem1.Caption = "";
            barFilenameText.Caption = "";

            FileInfo fi = new FileInfo(filename);
            try
            {
                fi.IsReadOnly = false;
                btnReadOnly.Caption = "File access OK";
            }
            catch (Exception E)
            {
                logger.Debug("Failed to remove read only flag: " + E.Message);
                btnReadOnly.Caption = "File is READ ONLY";
            }

            try
            {
                if (isWorkingFile)
                {
                    T7FileHeader t7InfoHeader = new T7FileHeader();
                    if (t7InfoHeader.init(filename, m_appSettings.AutoFixFooter))
                    {
                        m_current_softwareversion = t7InfoHeader.getSoftwareVersion();
                        m_currentSramOffsett = ReverseInt(t7InfoHeader.Unknown_9cvalue);
                    }
                    else
                    {
                        m_current_softwareversion = "";
                    }
                }
            }
            catch (Exception E2)
            {
                logger.Debug(E2.Message);
            }
            AddFileToMRUList(filename);
            symbol_collection = retval.ExtractFile(filename, m_appSettings.ApplicationLanguage, m_current_softwareversion);

            SetProgressPercentage(60);
            SetProgress("Examining file");
            System.Windows.Forms.Application.DoEvents();
            if (isWorkingFile)
            {
                if (m_currentSramOffsett == 0)
                {
                    m_currentSramOffsett = retval.SramOffsetForOpenFile;
                    logger.Debug("Overrules m_currentSramOffsett with value from t7file: " + m_currentSramOffsett.ToString("X8"));
                }

                // <GS-27042010> now we need to check if there is a symbol information XML file present.
                try
                {
                    IsSoftwareOpen();
                    // fill in the rest of the parameters
                    barFilenameText.Caption = Path.GetFileNameWithoutExtension(filename);
                }
                catch (Exception E3)
                {
                    logger.Debug(E3.Message);
                }
            }

            if (IsBinaryBiopower())
            {
                foreach (SymbolHelper sh in symbol_collection)
                {
                    if (sh.Varname == "BFuelCal.StartMap")
                    {
                        sh.Varname = "BFuelCal.E85Map";
                        XDFCategories cat = XDFCategories.Undocumented;
                        XDFSubCategory sub = XDFSubCategory.Undocumented;
                        sh.Description = translator.TranslateSymbolToHelpText(sh.Varname, out help, out cat, out sub, m_appSettings.ApplicationLanguage);
                    }
                    if (sh.Userdescription == "BFuelCal.StartMap")
                    {
                        sh.Userdescription = "BFuelCal.E85Map";
                        XDFCategories cat = XDFCategories.Undocumented;
                        XDFSubCategory sub = XDFSubCategory.Undocumented;
                        sh.Description = translator.TranslateSymbolToHelpText(sh.Userdescription, out help, out cat, out sub, m_appSettings.ApplicationLanguage);
                    }
                }
            }
            return retval;
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:94,代码来源:frmMain.cs

示例15: exportFixedTuningPackageToolStripMenuItem_Click

        private void exportFixedTuningPackageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SymbolCollection scToExport = new SymbolCollection();
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Trionic 7 packages|*.t7p";
            if (sfd.ShowDialog() == DialogResult.OK)
            {

                // add all relevant symbols to the export collection
                //SymbolHelper sh = new SymbolHelper();
                // must contain Varname, FlashAddress, Length, Userdescription
                AddToSymbolCollection(scToExport, "LimEngCal.TurboSpeedTab"); // add axis
                AddToSymbolCollection(scToExport, "LimEngCal.p_AirSP");
                AddToSymbolCollection(scToExport, "AirCtrlCal.m_MaxAirTab"); // add axis
                AddToSymbolCollection(scToExport, "TempLimPosCal.Airmass");
                //AddToSymbolCollection(scToExport, "X_AccPedalAutSP");
                AddToSymbolCollection(scToExport, "BoostCal.RegMap");   // add axis
                AddToSymbolCollection(scToExport, "BoostCal.SetLoadXSP");
                AddToSymbolCollection(scToExport, "BoostCal.n_EngSP");
                AddToSymbolCollection(scToExport, "PedalMapCal.m_RequestMap");// add axis
                AddToSymbolCollection(scToExport, "PedalMapCal.n_EngineMap");
                AddToSymbolCollection(scToExport, "PedalMapCal.X_PedalMap");
                AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmass");  // add axis
                AddToSymbolCollection(scToExport, "BstKnkCal.OffsetXSP");
                AddToSymbolCollection(scToExport, "BstKnkCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "BstKnkCal.MaxAirmassAu"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxAutTab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxTab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngMaxE85Tab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_ManGearLim"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_CabGearLim"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.n_Eng5GearSP");
                AddToSymbolCollection(scToExport, "TorqueCal.M_5GearLimTab"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_NominalMap"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "TorqueCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "TorqueCal.m_AirTorqMap"); // add axis
                AddToSymbolCollection(scToExport, "TorqueCal.M_EngXSP");
                AddToSymbolCollection(scToExport, "TorqueCal.m_PedYSP");
                AddToSymbolCollection(scToExport, "FCutCal.m_AirInletLimit");
                AddToSymbolCollection(scToExport, "BoosDiagCal.m_FaultDiff");
                AddToSymbolCollection(scToExport, "BoosDiagCal.ErrMaxMReq");
                AddToSymbolCollection(scToExport, "BFuelCal.Map");
                AddToSymbolCollection(scToExport, "BFuelCal.StartMap");
                AddToSymbolCollection(scToExport, "BFuelCal.E85Map");
                AddToSymbolCollection(scToExport, "BFuelCal.AirXSP");
                AddToSymbolCollection(scToExport, "BFuelCal.RpmYSP");
                AddToSymbolCollection(scToExport, "InjCorrCal.BattCorrSP");
                AddToSymbolCollection(scToExport, "InjCorrCal.BattCorrTab");
                AddToSymbolCollection(scToExport, "InjCorrCal.InjectorConst");
                AddToSymbolCollection(scToExport, "IgnNormCal.Map");
                AddToSymbolCollection(scToExport, "IgnE85Cal.fi_AbsMap");
                AddToSymbolCollection(scToExport, "IgnNormCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "IgnNormCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "IgnKnkCal.IndexMap");
                AddToSymbolCollection(scToExport, "KnkFuelCal.fi_MapMaxOff");
                AddToSymbolCollection(scToExport, "KnkFuelCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "BoostCal.PMap");
                AddToSymbolCollection(scToExport, "BoostCal.IMap");
                AddToSymbolCollection(scToExport, "BoostCal.DMap");
                AddToSymbolCollection(scToExport, "BoostCal.PIDXSP");
                AddToSymbolCollection(scToExport, "BoostCal.PIDYSP");
                AddToSymbolCollection(scToExport, "TorqueCal.M_OverBoostTab");
                AddToSymbolCollection(scToExport, "TorqueCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "KnkFuelCal.EnrichmentMap");
                AddToSymbolCollection(scToExport, "IgnKnkCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "IgnKnkCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "KnkDetCal.RefFactorMap");
                AddToSymbolCollection(scToExport, "KnkDetCal.m_AirXSP");
                AddToSymbolCollection(scToExport, "KnkDetCal.n_EngYSP");
                AddToSymbolCollection(scToExport, "MaxSpdCal.T_EngineSP");
                AddToSymbolCollection(scToExport, "MaxSpdCal.n_EngLimAir");
                AddToSymbolCollection(scToExport, "MaxVehicCal.v_MaxSpeed");
                PackageExporter pe = new PackageExporter();
                if (IsSoftwareOpen())
                {
                    pe.AddressOffset = GetOpenFileOffset();
                }
                pe.ExportPackage(scToExport, m_currentfile, sfd.FileName);
            }
        }
开发者ID:mattiasclaesson,项目名称:T7Suite,代码行数:81,代码来源:frmMain.cs


注:本文中的CommonSuite.SymbolCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。