コード例 #1
0
        private ObservableCollection <DbcMessage> MergeDBC(DBCReader dbcA, DBCReader dbcB)
        {
            ObservableCollection <DbcMessage> mergedMsg = dbcA.GetAllMessages();

            foreach (var msg in dbcParserB.GetAllMessages())
            {
                if (dbcParserA.GetAllMessages().Any(p => p.ID == msg.ID))
                {
                    //not found in dbcA
                }
                else
                {
                    mergedMsg.Add(msg);
                }
            }
            return(mergedMsg);
        }
コード例 #2
0
        /// <summary>
        /// Load DBC B
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dbcTarget_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openDBC = new OpenFileDialog();

            openDBC.FileName   = "DBC File";
            openDBC.DefaultExt = ".dbc";
            openDBC.Filter     = "CAN db files (.dbc)|*.dbc";

            if (openDBC.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                dbcParserB        = new DBCReader(openDBC.FileName);
                DbcComparer.DbcB  = dbcParserB.GetAllMessages();
                DbcComparer.PathB = openDBC.FileName;

                //binding to controls
                treeViewTarget.ItemsSource = null;
                treeViewTarget.Items.Clear();
                treeViewTarget.ItemsSource = DbcComparer.DbcB;
            }
        }