2025-02-21 16:23:52 -08:00
|
|
|
import json
|
|
|
|
|
|
|
|
def check():
|
|
|
|
print("Save Check Good")
|
|
|
|
|
|
|
|
# Yea I know this is pretty pointless in a seperate file but it's nice to have these things
|
|
|
|
def loadFile(self, file1):
|
|
|
|
with open(file1, "r") as file:
|
|
|
|
|
|
|
|
data = json.load(file)
|
|
|
|
return data
|
|
|
|
|
2025-03-07 20:38:10 -08:00
|
|
|
def saveFile(self, newData, file):
|
|
|
|
with open(file, "r") as file1:
|
|
|
|
data = json.load(file1)
|
|
|
|
def anotherRecusion(data, newData):
|
|
|
|
if type(data) is dict:
|
|
|
|
for key in newData:
|
|
|
|
match data[key]:
|
|
|
|
case str():
|
|
|
|
data[key]=newData[key].get()
|
|
|
|
case bool():
|
|
|
|
data[key]=newData[key].get()
|
|
|
|
case int():
|
|
|
|
data[key]=int(newData[key].get())
|
|
|
|
case dict():
|
|
|
|
data[key] = anotherRecusion(data[key], newData[key])
|
|
|
|
case list():
|
|
|
|
data[key]= anotherRecusion(data[key], newData[key])
|
|
|
|
elif type(data) is list:
|
|
|
|
for key in range(len(newData)):
|
|
|
|
match data[key]:
|
|
|
|
case str():
|
|
|
|
data[key]=newData[key].get()
|
|
|
|
case bool():
|
|
|
|
data[key]=newData[key].get()
|
|
|
|
case int():
|
|
|
|
data[key]=int(newData[key].get())
|
|
|
|
case dict():
|
|
|
|
data[key] = anotherRecusion(data[key], newData[key])
|
|
|
|
case list():
|
|
|
|
data[key]= anotherRecusion(data[key], newData[key])
|
|
|
|
return data
|
|
|
|
data = anotherRecusion(data, newData)
|
|
|
|
print(data)
|
|
|
|
with open(file, "w") as file1:
|
|
|
|
json.dump(data, file1, indent=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-21 16:23:52 -08:00
|
|
|
|
|
|
|
|