Starting to work on a web version of EduNetworkBuilder. The first bunch

of commits are probably going to be a bit interesting.
This commit is contained in:
2024-04-17 17:14:07 -05:00
parent 38a6107cea
commit 8a08bd209e
311 changed files with 739218 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#!/bin/bash
function GetOrder()
{
level=$1
#grep sortorder *.json | sed 's/\"//g;s/sortorder://;s/,/ /;s/://;s/\(Level[0-9]*\)\(.*\)json\(.*\)$/\1 \3 \1\2json/;s/ */ /g'
grep sortorder *.json | sed 's/\"//g;s/sortorder://;s/,/ /;s/://;s/\(Level[0-9]*\)\(.*\)json\(.*\)$/\3 \1\2json/;s/ */ /g' | grep $level | sort -g | sed 's/.*Level/Level/'
}
cd Resources
echo "allpuzzles=[" > ../allpuzzles.js
counter=0
for a in 0 1 2 3 4 5 6; do
GetOrder Level$a
done | while read onelevel; do
#We need to compile it
if [ $counter -gt 0 ]; then
echo "," >> ../allpuzzles.js
fi
counter=$((counter+1))
name=${onelevel/.json/}
echo $name
cat $onelevel | sed "s/\"Network\": {/\"Network\": {\n\"name\": \"$name\",\n/" >> ../allpuzzles.js
done
echo "]" >> ../allpuzzles.js

View File

@ -0,0 +1,21 @@
#!/bin/bash
#
# Convert the EduNetworkBuilder levels from XML to json
# Run this from the web directory, and make sure to have xq installed
if which xq >/dev/null; then
if [ -d Resources -a -d EduResources ]; then
for a in EduResources/Level{0,1,2,3,4,5,6}*; do
b=$(basename $a | sed 's/.enbx/\.json/');
if [ ! -e Resources/$b ]; then
echo $b
xq '.' $a > Resources/$b
fi
done
else
echo "You must be in the web directory of the EduNetworkBuilder git repo for this to work"
fi
else
echo "xq must be installed. This comes with the jq program"
echo "jq is used for working with json files and xq is the counterpart"
echo "that converts xml to json."
fi