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"); } }
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; }