diff --git a/LANCommander/Snippets/Examples/Separate ASCII Bytes.ps1 b/LANCommander/Snippets/Examples/Separate ASCII Bytes.ps1 new file mode 100644 index 0000000..2ea805a --- /dev/null +++ b/LANCommander/Snippets/Examples/Separate ASCII Bytes.ps1 @@ -0,0 +1,2 @@ +# Takes an input byte[] and separates it with 0x00 between each character +$bytes = Separate-AsciiBytes -Data $bytes \ No newline at end of file diff --git a/LANCommander/Snippets/Functions/Separate-AsciiBytes.ps1 b/LANCommander/Snippets/Functions/Separate-AsciiBytes.ps1 new file mode 100644 index 0000000..d8c86f1 --- /dev/null +++ b/LANCommander/Snippets/Functions/Separate-AsciiBytes.ps1 @@ -0,0 +1,12 @@ +function Separate-AsciiBytes([byte[]]$Data) +{ + $array = @() + + foreach ($byte in $Data) + { + $array += $byte + $array += 0x00 + } + + return $array +} \ No newline at end of file