Announcement

Collapse
No announcement yet.

Comparison of Strings in C#

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Comparison of Strings in C#

    At least in C#, comparison of strings in code could be more helpful. For instance, two lines like this

    in file 1: [Operation("VehicleIdentificationFieldsVehicleGet")]
    in file 2: [Operation("SpecificationsV1VehicleIdentificationFi eldsVehicleGet")]

    compare with the entire quoted string in each line the same color. I think it would be more useful to show changes within the quoted strings like it does for other code. Is there a setting tor that?

    Thanks,
    John

  • #2
    If you're using the default Beyond Compare settings, the different text SpecificationsV1 within the string quotes in the right side file should be highlighted in red. I've attached a screenshot showing the comparison using default settings.

    If you're not seeing the difference highlighted, it might be due to your Beyond Compare settings. The grammar element type at the current cursor position is displayed in the status bar at the bottom of the window. If you cursor into the different text, is it identified as String or as some other grammar element type? Also, if you click the Rules toolbar button (referee icon), is String checked to make it important?
    Chris K Scooter Software

    Comment


    • #3
      Yes, it shows "String" when cursoring in and "Important Difference" at the bottom. The Referee icon shows String as an Important Difference. This is with Version 4.2.9 (build 23626). I tried turning off the check mark next to String under the Important Differences, and it then showed "Ignored Unimportant Difference" at the bottom but in both cases the different text is in the same color. The string text is in a different color than the surrounding C# keywords and operators.

      Comment


      • #4
        I've attached a stripped-down example of what I'm seeing. I couldn't find a simple way to attach just a link as you did.

        Click image for larger version

Name:	ProblemDemo.png
Views:	25
Size:	48.7 KB
ID:	80257

        Comment


        • #5
          Hello,

          I would suggest backing up your current settings with the Tools menu -> Export wizard, and create a complete backup. Then use the Tools menu -> Restore Factory Defaults dialog to revert to factory default settings, and re-attempt the comparison. How does this then look?

          From the above comparison, it looks like you might have a combination of configuration options to set unimportant differences and preserve syntax coloring on different lines.

          For more tools, use the Advanced (underlined A button) in the upper right, where you can upload attachments, insert pictures, or create links, depending on what style you'd like to use.
          Aaron P Scooter Software

          Comment


          • #6
            Thanks, Aaron. I've done that and the difference now displays. But naturally I can't bear to give up all my settings. I've exported the factory settings to a file also so I can compare the two files. You suggested I "might have a combination of configuration options to set unimportant differences and preserve syntax coloring on different lines." Do you know what the option(s) to do that might be called and in which of the 8 .xml files of the .bcpkg they might be?

            Comment


            • #7
              If you can email in the export (and a link back to this forum thread) to support@scootersoftware.com, we could help take a look. My hunch is there is a grammar element defining the string, and the string is Unimportant.

              The coloring option I'm referencing is under the Tools menu -> Options, Tweaks tab, and disable "Show syntax highlighting on difference lines" (default). With this disabled, and also disable Ignore Unimportant Differences toggle (on your toolbar), the unimportant differences should show as blue.
              Aaron P Scooter Software

              Comment


              • #8
                I've done some searching in the files. Could it be either of these?

                <TextSyntaxDiffs Value="True"/>
                <TextUseOrphanColor Value="True"/>

                These lines are in BCPreferences.xml. Both of these are False in Factory settings.

                Comment


                • #9
                  Oops, sorry, didn't see your latest before sending again. I'll try that tomorrow. Thanks.

                  Comment


                  • #10
                    I've mailed the .bcpkg file but I don't know if our mail system will allow it to actually be sent (getting very finicky about sending files).

                    Comment


                    • #11
                      Fixed. Disabling "Show syntax highlighting on difference lines" corrected it. Thanks for the help. You can ignore the e-mail.

                      John

                      Comment


                      • #12
                        Great to hear. Show Syntax highlighting on difference lines is disabled by default, so that any difference on a line removes syntax coloring and replaces it with just difference coloring. With the option enabled, this allows syntax coloring to still display. In combination with Ignore Unimportant Differences enabled (which would hide Unimportant Differences, and treat them as black/equal, which would then allow the syntax coloring).

                        Something on your line (maybe Strings) might still be Unimportant. You may want to double check your default Importance options on the Home screen, in the saved Sessions list, expand the Edit session defaults folder, select Text Compare, and Edit Defaults. From here, you can edit the Importance tab defaults for future text comparisons.

                        Update: I've double checked with your settings, and actually it may be an Important difference is having the font color overridden with the Tweak. You do not need to double check for an Unimportant Difference.
                        Last edited by Aaron; 15-Mar-2019, 10:00 AM.
                        Aaron P Scooter Software

                        Comment

                        Working...
                        X