Browse Source

Supprimer 'json_to_bin.py'

master
nfx 4 weeks ago
parent
commit
ffe22ef6d6
  1. 21
      json_to_bin.py

21
json_to_bin.py

@ -1,21 +0,0 @@
"""
Converts json level data files into binary level data
"""
import json
from os import listdir
from os.path import isfile, join
LVL_DIR = "lvl/"
BIN_DIR = "lvl_bin/"
if __name__ == "__main__":
files = [f for f in listdir(LVL_DIR) if isfile(join(LVL_DIR, f))]
decoder = json.JSONDecoder()
for v in files:
file = open(join(LVL_DIR, v), "r", encoding="utf-8")
content = decoder.decode(file.read())
newfile = open(join(BIN_DIR, v.replace(".json", ".dat")), "wb")
bin_content = b''
for line in content:
bin_content += bytes(line+[255])
newfile.write(bin_content)
Loading…
Cancel
Save