GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add new Offset and Count parameters to Format-Hex and refactor the cmdlet by iSazonov · Pull Request #7877 · PowerShell/PowerShell Conversation
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Redundant from at the end of the sentence.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d435640 to
59f3c37
Compare
|
@PowerShell/powershell-committee reviewed this and ok with the proposed changes |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Doc Issue created. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is this not a breaking change?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@PowerShell/powershell-committee discussed this and formatting changes have not been considered breaking changes. The extra zeros are acceptable.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
59f3c37 to
578095f
Compare
|
Steve Lee (@SteveL-MSFT) Travis Plunk (@TravisEz13) Could you please review the PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| case Int32 iInt32: | ||
| inputBytes = BitConverter.GetBytes(iInt32); | ||
| break; | ||
| case Int32[] inputInt32s: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
NIT: variable naming is inconsistent with line 257, perhaps just use i32 and i32s? Same below for int64
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| /// <param name="inputBytes">Bytes for the hexadecimial representaion.</param> | ||
| /// <param name="path">File path.</param> | ||
| /// <param name="offset">Offset in the file.</param> | ||
| private void ConvertToHexidecimal(Span<byte> inputBytes, string path, Int64 offset) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since this method does the actual WriteObject(), perhaps rename as WriteHexidecimal()?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| StringBuilder asciiEnd = new StringBuilder(BytesPerLine); | ||
|
|
||
| // '+1' comes from 'result.Append(nextLine.ToString() + " " + asciiEnd.ToString());' below. | ||
| StringBuilder result = new StringBuilder(nextLine.Capacity+asciiEnd.Capacity+1); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
NIT: have whitespace between operators: nextLine.Capacity + asciiEnd.Capacity + 1
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { Format-Hex -Path $inputFile4 -Count 0 } | Should -Throw -ErrorId "ParameterArgumentValidationError,Microsoft.PowerShell.Commands.FormatHex" | ||
| } | ||
|
|
||
| It "Offset should be >= 0" { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
May be interesting to read from end of file, but is out of scope of this PR :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…dlet (PowerShell#7877) - Add new Offset and Count parameters. - Modify ByteCollection class to support offsets up to UInt64.MaxValue size. - Hide/obsolete Raw parameter because the behavior is by default. - Optimize conversion to bytes to reduce allocations for large input data.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Format-Hex should have Count and Offset parameters
There was an error while loading. Please reload this page.