Style fixes in Format-Hex (#8083)
This commit is contained in:
parent
1dc4a7903f
commit
0bce3e0e0d
|
@ -55,16 +55,16 @@ namespace Microsoft.PowerShell.Commands
|
|||
public Encoding Encoding { get; set; } = ClrFacade.GetDefaultEncoding();
|
||||
|
||||
/// <summary>
|
||||
/// Gets and sets count of bytes to read from the input stream.
|
||||
/// Gets or sets count of bytes to read from the input stream.
|
||||
/// </summary>
|
||||
[Parameter()]
|
||||
[Parameter]
|
||||
[ValidateRange(ValidateRangeKind.Positive)]
|
||||
public Int64 Count { get; set; } = Int64.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// Gets and sets offset of bytes to start reading the input stream from.
|
||||
/// Gets or sets offset of bytes to start reading the input stream from.
|
||||
/// </summary>
|
||||
[Parameter()]
|
||||
[Parameter]
|
||||
[ValidateRange(ValidateRangeKind.NonNegative)]
|
||||
public Int64 Offset { get; set; }
|
||||
|
||||
|
@ -284,6 +284,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
// If the object type is not supported, throw an error. Once Serialization is
|
||||
// available on CoreCLR, other types will be supported.
|
||||
default:
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <param name="value">Underlying bytes stored in the collection.</param>
|
||||
/// <param name="path">Indicates the path of the file whose contents are wrapped in the ByteCollection.</param>
|
||||
[Obsolete("The constructor is deprecated.", true)]
|
||||
public ByteCollection(UInt32 offset, Byte[] value, string path)
|
||||
public ByteCollection(UInt32 offset, byte[] value, string path)
|
||||
{
|
||||
Offset64 = offset;
|
||||
Bytes = value;
|
||||
|
@ -108,12 +108,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ByteCollection constructor.
|
||||
/// Initializes a new instance of ByteCollection.
|
||||
/// </summary>
|
||||
/// <param name="offset">The Offset address to be used while displaying the bytes in the collection.</param>
|
||||
/// <param name="value">Underlying bytes stored in the collection.</param>
|
||||
/// <param name="path">Indicates the path of the file whose contents are wrapped in the ByteCollection.</param>
|
||||
public ByteCollection(UInt64 offset, Byte[] value, string path)
|
||||
public ByteCollection(UInt64 offset, byte[] value, string path)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <param name="offset">The Offset address to be used while displaying the bytes in the collection.</param>
|
||||
/// <param name="value">Underlying bytes stored in the collection.</param>
|
||||
[Obsolete("The constructor is deprecated.", true)]
|
||||
public ByteCollection(UInt32 offset, Byte[] value)
|
||||
public ByteCollection(UInt32 offset, byte[] value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
/// <param name="offset">The Offset address to be used while displaying the bytes in the collection.</param>
|
||||
/// <param name="value">Underlying bytes stored in the collection.</param>
|
||||
public ByteCollection(UInt64 offset, Byte[] value)
|
||||
public ByteCollection(UInt64 offset, byte[] value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// ByteCollection constructor.
|
||||
/// </summary>
|
||||
/// <param name="value">Underlying bytes stored in the collection.</param>
|
||||
public ByteCollection(Byte[] value)
|
||||
public ByteCollection(byte[] value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
|
@ -198,7 +198,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets underlying bytes stored in the collection.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public Byte[] Bytes { get; private set; }
|
||||
public byte[] Bytes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path of the file whose contents are wrapped in the ByteCollection.
|
||||
|
@ -216,11 +216,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
// '20 + 3' comes from format "{0:X20} ".
|
||||
// '20' comes from '[Uint64]::MaxValue.ToString().Length'.
|
||||
StringBuilder nextLine = new StringBuilder(20 + 3 + BytesPerLine*3);
|
||||
StringBuilder nextLine = new StringBuilder(20 + 3 + (BytesPerLine * 3));
|
||||
StringBuilder asciiEnd = new StringBuilder(BytesPerLine);
|
||||
|
||||
// '+1' comes from 'result.Append(nextLine.ToString() + " " + asciiEnd.ToString());' below.
|
||||
StringBuilder result = new StringBuilder(nextLine.Capacity+asciiEnd.Capacity + 1);
|
||||
StringBuilder result = new StringBuilder(nextLine.Capacity + asciiEnd.Capacity + 1);
|
||||
|
||||
if (Bytes.Length > 0)
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
nextLine.AppendFormat(CultureInfo.InvariantCulture, LineFormat, currentOffset);
|
||||
|
||||
foreach (Byte currentByte in Bytes)
|
||||
foreach (byte currentByte in Bytes)
|
||||
{
|
||||
// Display each byte, in 2-digit hexadecimal, and add that to the left-hand side.
|
||||
nextLine.AppendFormat("{0:X2} ", currentByte);
|
||||
|
|
Loading…
Reference in a new issue