This repository was archived by the owner on Jul 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathsaveloader.py
More file actions
106 lines (96 loc) · 2.86 KB
/
saveloader.py
File metadata and controls
106 lines (96 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import csv
import os
from time import sleep
editedLine = 0
global settingsdict
def detectSave():
savefileexists = os.path.exists("./save.pcsf")
if savefileexists == True:
print('Save file detected.')
else:
f = open('save.pcsf', 'a')
f.write("95,1")
f.close()
def detectSettings():
settingsFileExists = os.path.exists("./settings.pcsf")
if settingsFileExists == True:
print('Settings file detected')
else:
print('Settings file not found. Would you like to create one? (Y/N)')
settingsDataCreation = input("> ")
if settingsDataCreation == "Y" or settingsDataCreation == "y":
sett = open('settings.pcsf', 'a')
sett.write("screenDown,False")
sett.close()
else:
print('Aborting.')
sleep(1)
exit()
def loadSystemSave(systemname):
with open('save.pcsf') as f:
csv_reader = csv.reader(f, delimiter=',')
for line in csv_reader:
if line[0] == systemname:
systemleve = line[1]
systemlevel = int(systemleve)
return systemlevel
return False
def loadSettingsSave(setting):
try:
with open('settings.pcsf') as sett:
csv_reader = csv.reader(sett, delimiter=',')
for line in csv_reader:
if line[0] == setting:
name = line[0]
value = line[1]
return value
return False
except:
return False
def editSystemSave(system, level):
global editedLine
editedLine = 0
level2 = str(level)
with open('save.pcsf') as f:
csv_reader = csv.reader(f, delimiter=',')
for line in csv_reader:
if line[0] == system:
break
editedLine = editedLine + 1
f = open('save.pcsf', 'r')
filesaver = f.readlines()
filesaver[editedLine] = system+","+level2+"\n"
x = open("save.pcsf", "w")
x.writelines(filesaver)
x.close()
def editSettingsFile(setting, value):
global editedLine
editedLine = 0
lineExists = False
sett = open('settings.pcsf', 'a')
sett.close()
with open('settings.pcsf') as sett:
csv_reader = csv.reader(sett, delimiter=',')
for line in csv_reader:
if line[0] == setting:
lineExists = True
break
editedLine = editedLine + 1
if lineExists == False:
addSetting(setting, value)
return True
sett = open('settings.pcsf', 'r')
filesaver = sett.readlines()
filesaver[editedLine] = setting+","+value+"\n"
xx = open("settings.pcsf", "w")
xx.writelines(filesaver)
xx.close()
sleep(0.1)
def addSystemSave(system):
x = open("save.pcsf", "a")
x.writelines(system+",1\n")
x.close()
def addSetting(settingname, settingvalue):
x = open("settings.pcsf", "a")
x.writelines(settingname + "," + settingvalue + "\n")
x.close()