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; } }
public static void UpdateFeatureValue(string feature, FastColoredTextBox fctbCurrentFirmware, FastColoredTextBox fctbNewFirmware) { // Get the last occurance for the feature in current firmware int currentrow = MarlinMigrateHelper.GetFirmwareFeatureRow(fctbCurrentFirmware, feature); string currentValue = MarlinMigrateHelper.GetFirmwareFeatureValue(fctbCurrentFirmware, feature); string currentLine = fctbCurrentFirmware.GetLineText(currentrow).Trim(); // Get the last occurance for the feature in new firmware int newrow = MarlinMigrateHelper.GetFirmwareFeatureRow(fctbNewFirmware, feature); string newValue = MarlinMigrateHelper.GetFirmwareFeatureValue(fctbNewFirmware, feature); string newLine = fctbNewFirmware.GetLineText(newrow).Trim(); //TODO: Fix Startwith if (currentLine.StartsWith("//")) { if (!newLine.StartsWith("//")) { fctbNewFirmware.Navigate(newrow); fctbNewFirmware.CommentSelected("//"); } } //TODO: Fix Startwith if (!currentLine.StartsWith("//")) { if (newLine.StartsWith("//")) { fctbNewFirmware.Navigate(newrow); fctbNewFirmware.RemoveLinePrefix("//"); } } //TODO: Fix Startwith if (!currentValue.StartsWith("//")) { string originalLine = fctbNewFirmware.GetLineText(newrow); fctbNewFirmware.Navigate(newrow); List <int> removeRow = new List <int>(); removeRow.Add(newrow); fctbNewFirmware.RemoveLines(removeRow); fctbNewFirmware.Navigate(newrow); fctbNewFirmware.InsertText(originalLine.ReplaceFirst(newValue, currentValue) + Environment.NewLine); } fctbNewFirmware.DoAutoIndent(newrow); fctbNewFirmware.DoAutoIndent(newrow + 1); }
public static void UpdateFeatureValue(string feature, string newValue, FastColoredTextBox fctbNewFirmware) { // Get the last occurance for the feature in new firmware int currentRow = MarlinMigrateHelper.GetFirmwareFeatureRow(fctbNewFirmware, feature); string currentValue = MarlinMigrateHelper.GetFirmwareFeatureValue(fctbNewFirmware, feature); string correntRow = fctbNewFirmware.GetLineText(currentRow); fctbNewFirmware.Navigate(currentRow); List <int> removeRow = new List <int>(); removeRow.Add(currentRow); fctbNewFirmware.RemoveLines(removeRow); fctbNewFirmware.Navigate(currentRow); fctbNewFirmware.InsertText(correntRow.ReplaceFirst(currentValue, newValue) + Environment.NewLine); fctbNewFirmware.DoAutoIndent(currentRow); fctbNewFirmware.DoAutoIndent(currentRow + 1); }