Home Blog File Compare
 

File Compare

Thanks to your super fast feedback, we were able to identify a couple of issues with the new PowerShell Obfuscator introduced in 2.5.1.0, and since we do not want obfuscation to break anything, we decided to ship a service release asap. Version 2.5.1.1 contains the fixes.

As a special “thank you”, we also added a new “file compare” feature that can save your day. Let’s take a look at the changes.

Obfuscation and Splatting

When you obfuscate a script, ISESteroids changes all variables to scrambled variable names, and places these new names into braces. When you splat a variable, these braces cause syntax errors because PowerShell interprets them as a hashtable. This was a quick fix, and in 2.5.1.1, the obfuscator now detects splatting and removes the braces in these cases.

New Obfuscation Features

When you choose Tools/Obfuscate, a dialog opens and lets you control many aspects of the obfuscation process. There are two options that were enhanced in 2.5.1.1:

Obfuscation Options

  • Create Obfuscation Table: when checked, ISESteroids creates a script with hashtables that list the old and new variable and function names. The hashtables are now nicely aligned.
  • Save Obfuscated Script: This checkbox is available only when the script you are obfuscating is saved to file. When checked, the obfuscated script will be saved with the suffix “_obfuscated”. When unchecked, the obfuscated code will open as an “Untitled” document.
  • Create New Pester Test: if you obfuscate a script that has a Pester test associated with it, and this option is checked, ISESteroids will generate a new Pester test for the obfuscated script as well. This is great because obfuscation bears the risk of breaking things, so now you can use your existing Pester tests to test the new obfuscated script as well.

File Compare

File Compare has always been integrated in ISESteroids and was used with the file versioning control. Beginning with 2.5.1.1, you can now also perform ad-hoc file comparisons.

Let’s say you have been working on a script for a while. Now you are wondering what you have changed since you last saved the file. Simply right-click the editor tab and choose “Compare to”/”saved script”:

Compare File Change

You can also compare the current script to any other open script. Any open editor tab qualifies. You can even compare “Untitled” content.¬†ISESteroids then invokes the file compare tool. It now shows you in great detail all the changes between the two selected files.

Winmerge File Compare

With the buttons in the toolbar, you can navigate to the next or previous change, and you can even undo individual changes. Once you close the file comparison tool and save the changes, ISESteroids automatically updates your script. This way, it becomes a snap to undo part or all of the changes.

Help Requested

We noticed an issue with the new Pester integration. Occasionally, when you add a new Pester test to the test script via click on the Pester overlay and “Create Test For Function …”, the new “Describe” block seems to be inserted into the existing test file at a¬†wrong position. We scratched our heads hard but can’t seem to reproduce.

So if you do experience this problem, please report. Better yet, try and see if you can find repro steps that trigger this behavior. Thanks a lot!