File tree Expand file tree Collapse file tree 4 files changed +56
-24
lines changed Expand file tree Collapse file tree 4 files changed +56
-24
lines changed Original file line number Diff line number Diff line change 1+ param
2+ (
3+ [ Parameter ( Mandatory = $true ) ][ string ]$sFileName ,
4+ [ Parameter ( Mandatory = $true ) ][ string ]$sObjName
5+ )
6+
7+ $Bytes = [ System.IO.File ]::ReadAllBytes( $sFileName )
8+
9+ Write-Host " static unsigned char $sObjName [] = {"
10+ Write-Host " " - NoNewline
11+
12+ for ( $i = 0 ; $i -lt $Bytes.Length ; $i ++ )
13+ {
14+ $Byte = $Bytes [ $i ]
15+ Write-Host ( " 0x{0:x2}," -f $Byte ) - NoNewline
16+
17+ if ( ( $i % 20 ) -eq 19 )
18+ {
19+ Write-Host " "
20+ Write-Host " " - NoNewline
21+ }
22+ }
23+
24+ Write-Host " 0x00"
25+ Write-Host " };"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ if [ $# -lt 2 ]; then
4+ echo " Usage: $0 <filename> <name>"
5+ exit 1
6+ fi
7+
8+ sFileName=" $1 "
9+ sObjName=" $2 "
10+
11+ exec 3< " $sFileName "
12+
13+ printf " static unsigned char %s[] = {\n " " $sObjName "
14+
15+ i=0
16+ while : ; do
17+ Byte=$( dd bs=1 count=1 < & 3 2> /dev/null | od -An -t u1)
18+ [ -z " $Byte " ] && break
19+
20+ Byte=$( printf " %s" " $Byte " | tr -d ' [:space:]' )
21+ printf " 0x%02x," " $Byte "
22+
23+ i=$(( i + 1 ))
24+ if [ $(( i % 20 )) -eq 0 ]; then
25+ printf " \n "
26+ fi
27+ done
28+
29+ printf " 0x00\n};\n"
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ $Configuration "Release"
4545
4646$CustomBuildStep "nut"
4747{
48- $CommandLine "python $SRCDIR\devtools\bin\texttoarray.py $(InputPath) g_Script_$(InputName)> $(InputName)_nut.h" [$WINDOWS]
49- $CommandLine "python $SRCDIR\devtools\bin\texttoarray.py $(InputPath) g_Script_$(InputName)> $(InputName)_nut.h" [$POSIX]
48+ $CommandLine "powershell $SRCDIR\devtools\bin\texttoarray.ps1 $(InputPath) g_Script_$(InputName)> $(InputName)_nut.h" [$WINDOWS]
49+ $CommandLine "sh $SRCDIR\devtools\bin\texttoarray.sh $(InputPath) g_Script_$(InputName)> $(InputName)_nut.h" [$POSIX]
5050 $Description "$(InputFileName) produces $(InputName)_nut.h"
5151 $Outputs "$(InputName)_nut.h"
5252}
You can’t perform that action at this time.
0 commit comments