mirror of
https://github.com/RustySamovar/RustySamovar.git
synced 2024-11-25 03:29:38 +00:00
Autogenerate PacketId enum
This commit is contained in:
parent
4b9fda1f84
commit
227a5ad7c8
7
.gitignore
vendored
7
.gitignore
vendored
@ -14,3 +14,10 @@ Cargo.lock
|
|||||||
|
|
||||||
# keys
|
# keys
|
||||||
/keys/
|
/keys/
|
||||||
|
|
||||||
|
# Vim temp files
|
||||||
|
.*.swp
|
||||||
|
.*.swo
|
||||||
|
|
||||||
|
# Autogenerated files
|
||||||
|
/gen/
|
||||||
|
27
gen_ids.sh
Executable file
27
gen_ids.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#echo "#[macro_use]";
|
||||||
|
#echo "extern crate num_derive;";
|
||||||
|
|
||||||
|
#echo "";
|
||||||
|
|
||||||
|
echo "// Autogenerated file, do not edit!"
|
||||||
|
|
||||||
|
echo "";
|
||||||
|
|
||||||
|
echo "#[repr(u16)]";
|
||||||
|
echo "#[derive(FromPrimitive, ToPrimitive)]";
|
||||||
|
echo "#[derive(Debug, PartialEq, Eq, Clone, Hash)]";
|
||||||
|
|
||||||
|
echo "pub enum PacketId {";
|
||||||
|
|
||||||
|
for f in protobuf/*; do
|
||||||
|
CMD_ID=`cat $f | grep CMD_ID | cut -d'=' -f2 | tr -d ' ;\015'`;
|
||||||
|
|
||||||
|
if [ "x${CMD_ID}" != "x" ]; then
|
||||||
|
NAME=`echo $f | cut -d'/' -f2 | cut -d'.' -f1`;
|
||||||
|
echo " ${NAME} = ${CMD_ID},"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "}";
|
Loading…
Reference in New Issue
Block a user