コード例 #1
0
        private void ShowFirmwareFeatures(string feature)
        {
            MarlinMigrateHelper.BookmarkChangeNeeded(feature, fctbCurrentFirmware, fctbNewFirmware);

            // Old firmware
            string oldFeatureValue = MarlinMigrateHelper.GetFirmwareFeatureValue(fctbCurrentFirmware, feature);
            string newFeatureValue = MarlinMigrateHelper.GetFirmwareFeatureValue(fctbNewFirmware, feature);



            int oldRow = MarlinMigrateHelper.GetFirmwareFeatureRow(fctbCurrentFirmware, feature);
            int newRow = MarlinMigrateHelper.GetFirmwareFeatureRow(fctbNewFirmware, feature);

            txtBxCurrentFirmwareValue.Text = oldFeatureValue;

            if (newRow == 0)
            {
                MessageBox.Show(
                    @"It looks like feature " + feature + @" is obsolite in new firmware" + Environment.NewLine,
                    @"Obsolite feature", MessageBoxButtons.OK, MessageBoxIcon.Information);
                fctbCurrentFirmware.Navigate(oldRow);
                fctbCurrentFirmware.CurrentLineColor = Color.Red;
                fctbNewFirmware.CurrentLineColor     = Color.Transparent;
            }
            else
            {
                fctbCurrentFirmware.Navigate(oldRow);
                fctbCurrentFirmware.CurrentLineColor = oldFeatureValue == newFeatureValue ? Color.GreenYellow : Color.Magenta;
                fctbNewFirmware.Navigate(newRow);
                fctbNewFirmware.CurrentLineColor = oldFeatureValue == newFeatureValue ? Color.GreenYellow : Color.Magenta;
            }
        }
コード例 #2
0
        private void Compare()
        {
            // Load all files in current firmware

            DelegateListBoxItemsClear(lstBxFileNames);
            string[] currentFirmwareFiles = Directory.GetFiles(_configuration.CurrentFirmware, "*.h");


            for (int index = 0; index < currentFirmwareFiles.Length; index++)
            {
                if (backgroundWorkerCompare.CancellationPending)
                {
                    break;
                }


                string   firmwareFile = currentFirmwareFiles[index];
                FileInfo fileInfo     = new FileInfo(firmwareFile);

                backgroundWorkerCompare.ReportProgress(Math.Min(100, (index * 100) / currentFirmwareFiles.Length));


                DelegateText(lblCurrentWorkingOnFile, $"Working on file: {fileInfo.Name} ({progressBarWorkingOnFile.Value} % )");


                LoadFiles(fileInfo.Name);



                if (MarlinMigrateHelper.IsFilesEqual(fctbCurrentFirmware, fctbNewFirmware))
                {
                    continue;                                                                         // No differance = Next file
                }
                foreach (string feature in MarlinMigrateHelper.FindFirmwareFeatures(fctbCurrentFirmware))
                {
                    MarlinMigrateHelper.BookmarkChangeNeeded(feature, fctbCurrentFirmware, fctbNewFirmware);
                    if (fctbCurrentFirmware.Bookmarks.Count != 0)
                    {
                        break;
                    }
                }

                if (fctbCurrentFirmware.Bookmarks.Count != 0)
                {
                    DelegateListBoxAdd(lstBxFileNames, fileInfo);
                }
            }
        }