internal void SetCollection(Trionic5Tools.SymbolCollection m_RealtimeSymbolCollection)
 {
     lookUpEdit1.Properties.DataSource = m_RealtimeSymbolCollection;
 }
예제 #2
0
        private Trionic5File CompareSymbolTable(string filename, Trionic5Tools.SymbolCollection curSymbolCollection, AddressLookupCollection curAddressLookupCollection, DevExpress.XtraGrid.GridControl curGridControl, out Trionic5FileInformation m_CompareInfo)
        {
            //bool m_fileparsed = false;
            //listView1.Items.Clear();
            SetStatusText("Start symbol parsing");
            SetTaskProgress(0, true);
            Trionic5File m_CompareToFile = new Trionic5File();
            m_CompareToFile.LibraryPath = Application.StartupPath + "\\Binaries";
            m_CompareToFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

            m_CompareToFile.SelectFile(filename);
            m_CompareToFile.onDecodeProgress += new IECUFile.DecodeProgress(m_CompareToFile_onDecodeProgress);
            m_CompareInfo = m_CompareToFile.ParseTrionicFile(filename);
            // available in repository?
            curSymbolCollection = m_CompareInfo.SymbolCollection;
            curAddressLookupCollection = m_CompareInfo.AddressCollection;
            //                ParseFile(progress, filename, curTrionic5Tools.SymbolCollection, curAddressLookupCollection);
               // m_fileparsed = true;
            // AddLogItem("Start symbol export...");
            curSymbolCollection.SortColumn = "Start_address";
            curSymbolCollection.SortingOrder = Trionic5Tools.GenericComparer.SortOrder.Ascending;
            curSymbolCollection.Sort();
            // progress.SetProgress("Filling list");
            SetStatusText("Filling list");
            //listView1.SuspendLayout();
            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"));
            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");

            foreach (Trionic5Tools.SymbolHelper sh in curSymbolCollection)
            {
                float diffperc = 0;
                int diffabs = 0;
                float diffavg = 0;
                if (!CompareSymbolToCurrentFile(sh.Varname, sh.Flash_start_address, sh.Length, filename, out diffperc, out diffabs, out diffavg))
                {
                    dt.Rows.Add(sh.Varname, sh.Start_address, sh.Flash_start_address, sh.Length, sh.Length, m_trionicFileInformation.GetSymbolDescription(sh.Varname), false, (int)m_trionicFileInformation.GetSymbolCategory(sh.Varname), diffperc, diffabs, diffavg, m_trionicFileInformation.GetSymbolCategory(sh.Varname).ToString().Replace("_", " "), m_trionicFileInformation.GetSymbolSubcategory(sh.Varname).ToString().Replace("_", " "));
                }
            }
            curGridControl.DataSource = dt;
            /*if (m_fileparsed)
            {
                CreateRepositoryItem(filename, curTrionic5Tools.SymbolCollection);
            }*/
            //listView1.ResumeLayout();
            SetStatusText("Idle");
            SetTaskProgress(0, false);
            return m_CompareToFile;
            //barButtonItem14.Enabled = true;
        }
예제 #3
0
        private void CompareSymbolTableToFile(string filename, Trionic5Tools.SymbolCollection curSymbolCollection, AddressLookupCollection curAddressLookupCollection, out int numberofsymboldifferent)
        {
            numberofsymboldifferent = 0;
            if (filename != string.Empty)
            {
                //bool m_fileparsed = false;
                SetTaskProgress(0, true);
                SetStatusText("Start symbol parsing");
                // available in repository?
                //ParseFile(progress, filename, curTrionic5Tools.SymbolCollection, curAddressLookupCollection);
                Trionic5File m_CompareToFile = new Trionic5File();
                m_CompareToFile.LibraryPath = Application.StartupPath + "\\Binaries";
                m_CompareToFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

                m_CompareToFile.onDecodeProgress += new IECUFile.DecodeProgress(m_CompareToFile_onDecodeProgress);
                Trionic5FileInformation m_CompareInfo = m_CompareToFile.ParseTrionicFile(filename);
                // available in repository?
                curSymbolCollection = m_CompareInfo.SymbolCollection;
                curAddressLookupCollection = m_CompareInfo.AddressCollection;
                //m_fileparsed = true;
                // AddLogItem("Start symbol export...");
                curSymbolCollection.SortColumn = "Start_address";
                curSymbolCollection.SortingOrder = Trionic5Tools.GenericComparer.SortOrder.Ascending;
                curSymbolCollection.Sort();
                //listView1.SuspendLayout();

                foreach (Trionic5Tools.SymbolHelper sh in curSymbolCollection)
                {
                    float diffperc = 0;
                    int diffabs = 0;
                    float diffavg = 0;
                    if (!CompareSymbolToCurrentFile(sh.Varname, sh.Flash_start_address, sh.Length, filename, out diffperc, out diffabs, out diffavg))
                    {
                        numberofsymboldifferent++;
                    }
                }
                /*if (m_fileparsed)
                {
                    CreateRepositoryItem(filename, curTrionic5Tools.SymbolCollection);
                }*/
                //listView1.ResumeLayout();
                SetTaskProgress(0, false);
                SetStatusText("Idle");
                //barButtonItem14.Enabled = true;
                //progress.Close();

            }
            else
            {
                frmInfoBox info = new frmInfoBox("No file selected, please select one first");
            }
        }
예제 #4
0
        private void StartCompareMapViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, Trionic5Tools.SymbolCollection curSymbols, AddressLookupCollection curAddresses, Trionic5File curFile, Trionic5FileInformation curFileInfo)
        {
            try
            {
                DevExpress.XtraBars.Docking.DockPanel dockPanel;
                bool pnlfound = false;
                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                {

                    if (pnl.Text == "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]")
                    {
                        dockPanel = pnl;
                        pnlfound = true;
                        dockPanel.Show();
                        // nog data verversen?
                    }
                }
                if (!pnlfound)
                {
                    dockManager1.BeginUpdate();
                    try
                    {
                        dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                        dockPanel.Tag = Filename;// m_trionicFile.GetFileInfo().Filename; changed 24/01/2008
                        //IMapViewer tabdet = new MapViewerEx();
                        IMapViewer tabdet;

                        if (m_appSettings.MapViewerType == MapviewerType.Fancy)
                        {
                            tabdet = new MapViewerEx();
                        }
                        else if (m_appSettings.MapViewerType == MapviewerType.Normal)
                        {
                            tabdet = new MapViewer();
                        }
                        else
                        {
                            tabdet = new SimpleMapViewer();
                        }
                        tabdet.AutoUpdateChecksum = m_appSettings.AutoChecksum;
                        tabdet.GraphVisible = m_appSettings.ShowGraphs;
                       // TryTpShowTouchScreenInput();

                        //tabdet.DirectSRAMWriteOnSymbolChange = m_appSettings.DirectSRAMWriteOnSymbolChange;
                       // tabdet.SetViewSize(m_appSettings.DefaultViewSize);

                        //tabdet.IsHexMode = barViewInHex.Checked;
                        tabdet.Viewtype = (Trionic5Tools.ViewType)m_appSettings.DefaultViewType;
                        if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor25)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy;
                            }
                        }
                        else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor30)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal3Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy3Bar;
                            }
                        }
                        else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor35)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal35Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy35Bar;
                            }
                        }
                        else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor40)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal4Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy4Bar;
                            }
                        }
                        else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor50)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal5Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy5Bar;
                            }
                        }
                        //tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                        //tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                        //tabdet.GraphVisible = m_appSettings.ShowGraphs;
                        //tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                        tabdet.Filename = Filename;
                        tabdet.Map_name = SymbolName;

                        tabdet.Map_descr = m_trionicFileInformation.GetSymbolDescription(tabdet.Map_name);
                        tabdet.Map_cat = m_trionicFileInformation.GetSymbolCategory(tabdet.Map_name);
                        tabdet.X_axisvalues = curFile.GetMapXaxisValues(tabdet.Map_name);
                        tabdet.Y_axisvalues = curFile.GetMapYaxisValues(tabdet.Map_name);
                        string xdescr = string.Empty;
                        string ydescr = string.Empty;
                        string zdescr = string.Empty;
                        // van compare file halen?
                        curFile.GetMapAxisDescriptions(tabdet.Map_name, out xdescr, out ydescr, out zdescr);
                        tabdet.X_axis_name = xdescr;
                        tabdet.Y_axis_name = ydescr;
                        tabdet.Z_axis_name = zdescr;

                        //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                        int columns = 8;
                        int rows = 8;

                        int tablewidth = curFile.GetTableMatrixWitdhByName(Filename, tabdet.Map_name, out columns, out rows);
                        int address = Convert.ToInt32(SymbolAddress);
                        if (address != 0)
                        {
                            while (address > curFileInfo.Filelength) address -= curFileInfo.Filelength;
                            tabdet.Map_address = address;
                            int length = SymbolLength;
                            tabdet.Map_length = length;
                            byte[] mapdata = curFile.ReadData((uint)address, (uint)length);
                            tabdet.Map_content = mapdata;
                            tabdet.Correction_factor = curFile.GetCorrectionFactorForMap(tabdet.Map_name);
                            tabdet.Correction_offset = curFile.GetOffsetForMap(tabdet.Map_name);
                            tabdet.IsUpsideDown = true;
                            tabdet.ShowTable(columns, curFile.GetFileInfo().isSixteenBitTable(SymbolName));
                            tabdet.Dock = DockStyle.Fill;
                            //tabdet.onSymbolSave += new MapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onClose += new IMapViewer.ViewerClose(OnCloseMapViewer);
                            tabdet.onAxisEditorRequested += new IMapViewer.AxisEditorRequested(mv_onAxisEditorRequested);
                            //tabdet.onAxisLock += new MapViewer.NotifyAxisLock(tabdet_onAxisLock);
                            //tabdet.onSliderMove += new MapViewer.NotifySliderMove(tabdet_onSliderMove);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                            tabdet.onCellLocked += new IMapViewer.CellLocked(mv_onCellLocked);

                            //tabdet.onSplitterMoved += new MapViewer.SplitterMoved(tabdet_onSplitterMoved);
                            //tabdet.onSurfaceGraphViewChanged += new MapViewer.SurfaceGraphViewChanged(tabdet_onSurfaceGraphViewChanged);
                            //tabdet.onGraphSelectionChanged += new MapViewer.GraphSelectionChanged(tabdet_onGraphSelectionChanged);
                            //tabdet.onViewTypeChanged += new MapViewer.ViewTypeChanged(tabdet_onViewTypeChanged);

                            tabdet.SetViewSize((Trionic5Tools.ViewSize)m_appSettings.DefaultViewSize);
                            //dockPanel.DockAsTab(dockPanel1);
                            //dockPanel.Text = "Symbol: " + SymbolName + " [" + Filename + "]";
                            dockPanel.Text = Path.GetFileName(Filename) + " [" + SymbolName + "]";

                            bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.Contains("[" + SymbolName +"]") && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                    {
                                        dockPanel.DockAsTab(pnl, 0);
                                        //pnl.Options.ShowCloseButton = false;
                                        isDocked = true;
                                        break;
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                if (m_appSettings.AutoDockSameFile)
                                {
                                    foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                    {
                                        if ((string)pnl.Tag == m_trionicFileInformation.Filename && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                        {
                                            dockPanel.DockAsTab(pnl, 0);
                                            //pnl.Options.ShowCloseButton = false;
                                            isDocked = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 0);
                                if (m_appSettings.AutoSizeNewWindows)
                                {
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    else
                                    {
                                        //dockPanel.Width = this.Width - dockSymbols.Width - 10;

                                    }
                                }
                                if (dockPanel.Width < 400) dockPanel.Width = 400;
                                //                    dockPanel.Width = 400;
                            }
                            tabdet.InitEditValues();
                            dockPanel.Controls.Add(tabdet);

                        }

                    }
                    catch (Exception E)
                    {
                        Console.WriteLine(E.Message);
                    }
                    dockManager1.EndUpdate();
                }

            }
            catch (Exception startnewcompareE)
            {
                Console.WriteLine(startnewcompareE.Message);
            }
        }