diff --git a/LANCommander.PowerShell/Cmdlets/ConvertTo-StringBytes.cs b/LANCommander.PowerShell/Cmdlets/ConvertTo-StringBytes.cs index dced3b9..72cb014 100644 --- a/LANCommander.PowerShell/Cmdlets/ConvertTo-StringBytes.cs +++ b/LANCommander.PowerShell/Cmdlets/ConvertTo-StringBytes.cs @@ -20,6 +20,9 @@ namespace LANCommander.PowerShell.Cmdlets [Parameter] public int MaxLength { get; set; } = 0; + [Parameter] + public int MinLength { get; set; } = 0; + protected override void ProcessRecord() { byte[] output; @@ -27,6 +30,11 @@ namespace LANCommander.PowerShell.Cmdlets if (MaxLength > 0 && Input.Length > MaxLength) Input = Input.Substring(0, MaxLength); + if (MinLength > 0 && MinLength < MaxLength) + Input = Input.PadRight(MinLength, '\0'); + else if (MinLength > 0) + Input = Input.PadRight(MaxLength, '\0'); + if (Utf16 && BigEndian) output = System.Text.Encoding.BigEndianUnicode.GetBytes(Input); else if (Utf16)