Skip to content

Rewrite New-CBArraySplit, minor tweaks elsewhere. #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HumanEquivalentUnit
Copy link
Owner

One major change and some minor tweaks pull request.

  • New-CBArraySplit does string splitting and joining to test the 4Kb limit, but file extensions can have commas in them so it risks splitting in the middle of a file extension and breaking. Reworked it to build up a temporary array on the fly, checking the extra string length each time won't push the array over the 4Kb limit. Updated it to output to the pipeline. Merged the FileGroupName property into it.

  • Normalise ConvertFrom-Json20 to use Param() block. Added comment.

  • Updated the Get-WmiObject call for drives with shares, formatting, added comments, does the share root with a DirectoryInfoCast which won't error if the item doesn't exist, and calls te Name property instead of string interpolation, forced it to be an array with @() and removed the following $null test.

  • Windows version comment, tweaked "other version" message.

  • ConvertFrom-Json20 call was using parens, which isn't PowerShell function call syntax. Changed, and expanded ForEach-Object alias in that line.

  • Reworked SkipList to do the trim() call when loading and use array -notcontains to remove the exclusions.

  • Changed the emtpy file message to use a here-string instead of backtick continuations.

  • Updated the call to New-CBArraySplit

  • Expanded % alias at end of file.

Patches for possible bug fixing

 - Normalise ConvertFrom-Json20 to use Param() block. Added comment.

 - New-CBArraySplit does string splitting and joining to test the 4Kb limit, but file extensions can have commas in them, so it risks splitting in the middle of a file extension and breaking. Reworked it to build up a tmp array on the fly, checking string length each time before adding to the array. Merged the FileGroupName property into it. Made it output to the pipeline.

 - Updated the Get-WmiObject call for drives with shares, formatting, added comments, does the share root with a DirectoryInfoCast which won't error if the item doesn't exist, and calls te Name property instead of string interpolation, forced it to be an array with @() and removed the following $null test.

 - Windows version comment, tweaked "other version" message.

 - ConvertFrom-Json20 call was using parens, changed and expanded ForEach-Object alias in that line.

 - Reworked SkipList to do the trim() call when loading and use array -notcontains to remove the exclusions.

 - Changed the emtpy file message to use a here-string instead of backtick continuations.

 - Updated the call to New-CBArraySplit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant