OpenGridViewGroups() public method

public OpenGridViewGroups ( GridControl ctrl, int groupleveltoexpand ) : void
ctrl GridControl
groupleveltoexpand int
return void
コード例 #1
0
ファイル: frmMain.cs プロジェクト: Blackfrosch/VAGEDCSuite
        private void CompareToFile(string filename)
        {
            if (Tools.Instance.m_symbols.Count > 0)
            {
                dockManager1.BeginUpdate();
                try
                {
                    DevExpress.XtraBars.Docking.DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                    CompareResults tabdet = new CompareResults();
                    tabdet.ShowAddressesInHex = true;
                    tabdet.SetFilterMode(true);
                    tabdet.Dock = DockStyle.Fill;
                    tabdet.Filename = filename;
                    tabdet.onSymbolSelect += new CompareResults.NotifySelectSymbol(tabdet_onSymbolSelect);
                    dockPanel.Controls.Add(tabdet);
                    dockPanel.Text = "Compare results: " + Path.GetFileName(filename);
                    dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Left, 1);
                    dockPanel.Width = 500;
                    SymbolCollection compare_symbols = new SymbolCollection();
                    List<CodeBlock> compare_blocks = new List<CodeBlock>();
                    List<AxisHelper> compare_axis = new List<AxisHelper>();
                    compare_symbols = DetectMaps(filename, out compare_blocks, out compare_axis, false, false);
                    System.Windows.Forms.Application.DoEvents();

                    Console.WriteLine("ori : " + Tools.Instance.m_symbols.Count.ToString());
                    Console.WriteLine("comp : " + compare_symbols.Count.ToString());

                    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")); //0
                    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");
                    dt.Columns.Add("SymbolNumber1", Type.GetType("System.Int32"));
                    dt.Columns.Add("SymbolNumber2", Type.GetType("System.Int32"));
                    dt.Columns.Add("Userdescription");
                    dt.Columns.Add("MissingInOriFile", Type.GetType("System.Boolean"));
                    dt.Columns.Add("MissingInCompareFile", Type.GetType("System.Boolean"));
                    dt.Columns.Add("CodeBlock1", Type.GetType("System.Int32"));
                    dt.Columns.Add("CodeBlock2", Type.GetType("System.Int32"));
                    string category = "";
                    string ht = string.Empty;
                    double diffperc = 0;
                    int diffabs = 0;
                    double diffavg = 0;
                    int percentageDone = 0;
                    int symNumber = 0;
                    XDFCategories cat = XDFCategories.Undocumented;
                    XDFSubCategory subcat = XDFSubCategory.Undocumented;
                    if (compare_symbols.Count > 0)
                    {
                        CompareResults cr = new CompareResults();
                        cr.ShowAddressesInHex = true;
                        cr.SetFilterMode(true);
                        foreach (SymbolHelper sh_compare in compare_symbols)
                        {
                            foreach (SymbolHelper sh_org in Tools.Instance.m_symbols)
                            {
                                if ((sh_compare.Flash_start_address == sh_org.Flash_start_address) || (sh_compare.Varname == sh_org.Varname))
                                {
                                    // compare
                                    if (!CompareSymbolToCurrentFile(sh_compare.Varname, (int)sh_compare.Flash_start_address, sh_compare.Length, filename, out diffperc, out diffabs, out diffavg, sh_compare.Correction))
                                    {
                                        dt.Rows.Add(sh_compare.Varname, sh_compare.Start_address, sh_compare.Flash_start_address, sh_compare.Length, sh_compare.Length, sh_compare.Varname, false, 0, diffperc, diffabs, diffavg, category, "", sh_org.Symbol_number, sh_compare.Symbol_number, "", false, false, sh_org.CodeBlock, sh_compare.CodeBlock);

                                    }
                                }
                            }
                        }

                        tabdet.CompareSymbolCollection = compare_symbols;
                        tabdet.OriginalSymbolCollection = Tools.Instance.m_symbols;
                        tabdet.OriginalFilename = Tools.Instance.m_currentfile;
                        tabdet.CompareFilename = filename;
                        tabdet.OpenGridViewGroups(tabdet.gridControl1, 1);
                        tabdet.gridControl1.DataSource = dt.Copy();
                    }
                }
                catch (Exception E)
                {
                    Console.WriteLine(E.Message);
                }
                dockManager1.EndUpdate();
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: Blackfrosch/VAGEDCSuite
        private void btnSearchMaps_ItemClick(object sender, ItemClickEventArgs e)
        {
            // ask the user for which value to search and if searching should include symbolnames and/or symbol description
            if (ValidateFile())
            {
                SymbolCollection result_Collection = new SymbolCollection();
                frmSearchMaps searchoptions = new frmSearchMaps();
                if (searchoptions.ShowDialog() == DialogResult.OK)
                {
                    frmProgress progress = new frmProgress();
                    progress.SetProgress("Start searching data...");
                    progress.SetProgressPercentage(0);
                    progress.Show();
                    System.Windows.Forms.Application.DoEvents();
                    int cnt = 0;
                    foreach (SymbolHelper sh in Tools.Instance.m_symbols)
                    {
                        progress.SetProgress("Searching " + sh.Varname);
                        progress.SetProgressPercentage((cnt * 100) / Tools.Instance.m_symbols.Count);
                        bool hit_found = false;
                        if (searchoptions.IncludeSymbolNames)
                        {
                            if (searchoptions.SearchForNumericValues)
                            {
                                if (sh.Varname.Contains(searchoptions.NumericValueToSearchFor.ToString()))
                                {
                                    hit_found = true;
                                }
                            }
                            if (searchoptions.SearchForStringValues)
                            {
                                if (searchoptions.StringValueToSearchFor != string.Empty)
                                {
                                    if (sh.Varname.Contains(searchoptions.StringValueToSearchFor))
                                    {
                                        hit_found = true;
                                    }
                                }
                            }
                        }
                        if (searchoptions.IncludeSymbolDescription)
                        {
                            if (searchoptions.SearchForNumericValues)
                            {
                                if (sh.Description.Contains(searchoptions.NumericValueToSearchFor.ToString()))
                                {
                                    hit_found = true;
                                }
                            }
                            if (searchoptions.SearchForStringValues)
                            {
                                if (searchoptions.StringValueToSearchFor != string.Empty)
                                {
                                    if (sh.Description.Contains(searchoptions.StringValueToSearchFor))
                                    {
                                        hit_found = true;
                                    }
                                }
                            }
                        }
                        // now search the symbol data
                        if (sh.Flash_start_address < Tools.Instance.m_currentfilelength)
                        {
                            byte[] symboldata = Tools.Instance.readdatafromfile(Tools.Instance.m_currentfile, (int)sh.Flash_start_address, sh.Length, Tools.Instance.m_currentFileType);
                            if (searchoptions.SearchForNumericValues)
                            {
                                for (int i = 0; i < symboldata.Length / 2; i += 2)
                                {
                                    float value = Convert.ToInt32(symboldata.GetValue(i)) * 256;
                                    value += Convert.ToInt32(symboldata.GetValue(i + 1));
                                    value *= (float)GetMapCorrectionFactor(sh.Varname);
                                    value += (float)GetMapCorrectionOffset(sh.Varname);
                                    if (value == (float)searchoptions.NumericValueToSearchFor)
                                    {
                                        hit_found = true;
                                    }
                                }
                            }
                            if (searchoptions.SearchForStringValues)
                            {
                                if (searchoptions.StringValueToSearchFor.Length > symboldata.Length)
                                {
                                    // possible...
                                    string symboldataasstring = System.Text.Encoding.ASCII.GetString(symboldata);
                                    if (symboldataasstring.Contains(searchoptions.StringValueToSearchFor))
                                    {
                                        hit_found = true;
                                    }
                                }
                            }
                        }

                        if (hit_found)
                        {
                            // add to collection
                            result_Collection.Add(sh);
                        }
                        cnt++;
                    }
                    progress.Close();
                    if (result_Collection.Count == 0)
                    {
                        frmInfoBox info = new frmInfoBox("No results found...");
                    }
                    else
                    {
                        // start result screen
                        dockManager1.BeginUpdate();
                        try
                        {
                            SymbolTranslator st = new SymbolTranslator();
                            DevExpress.XtraBars.Docking.DockPanel dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                            CompareResults tabdet = new CompareResults();
                            tabdet.ShowAddressesInHex = m_appSettings.ShowAddressesInHex;
                            tabdet.SetFilterMode(m_appSettings.ShowAddressesInHex);
                            tabdet.Dock = DockStyle.Fill;
                            tabdet.UseForFind = true;
                            tabdet.Filename = Tools.Instance.m_currentfile;
                            tabdet.onSymbolSelect += new CompareResults.NotifySelectSymbol(tabdet_onSymbolSelectForFind);
                            dockPanel.Controls.Add(tabdet);
                            dockPanel.Text = "Search results: " + Path.GetFileName(Tools.Instance.m_currentfile);
                            dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Left, 1);

                            dockPanel.Width = 500;

                            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"); //0
                            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");
                            dt.Columns.Add("SymbolNumber1", Type.GetType("System.Int32"));
                            dt.Columns.Add("SymbolNumber2", Type.GetType("System.Int32"));
                            dt.Columns.Add("CodeBlock1", Type.GetType("System.Int32"));
                            dt.Columns.Add("CodeBlock2", Type.GetType("System.Int32"));

                            string ht = string.Empty;
                            XDFCategories cat = XDFCategories.Undocumented;
                            XDFSubCategory subcat = XDFSubCategory.Undocumented;
                            foreach (SymbolHelper shfound in result_Collection)
                            {
                                string helptext = st.TranslateSymbolToHelpText(shfound.Varname);
                                if (shfound.Varname.Contains("."))
                                {
                                    try
                                    {
                                        shfound.Category = shfound.Varname.Substring(0, shfound.Varname.IndexOf("."));
                                    }
                                    catch (Exception cE)
                                    {
                                        Console.WriteLine("Failed to assign category to symbol: " + shfound.Varname + " err: " + cE.Message);
                                    }
                                }
                                dt.Rows.Add(shfound.Varname, shfound.Start_address, shfound.Flash_start_address, shfound.Length, shfound.Length, helptext, false, 0, 0, 0, 0, shfound.Category, "", shfound.Symbol_number, shfound.Symbol_number, shfound.CodeBlock, shfound.CodeBlock);
                            }
                            tabdet.CompareSymbolCollection = result_Collection;
                            tabdet.OpenGridViewGroups(tabdet.gridControl1, 1);
                            tabdet.gridControl1.DataSource = dt.Copy();

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

                    }

                }
            }
        }