-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdate.py
139 lines (132 loc) · 4.8 KB
/
Update.py
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
from git import Repo
from requests import get
from os import startfile, path, getcwd, listdir, system, remove
from shutil import move
from winsound import PlaySound, SND_FILENAME
import sys
sys.stdout = open("outputUpdate.txt", 'w+')
try:
f = open('main\\cfg\\currect_version.ini', 'r')
except FileNotFoundError:
try:
system('RMDIR "main" /S /Q')
except BaseException:
pass
Repo.clone_from('https://github.com/JOJO-men/Horizon', 'main')
try:
move("main\\settings.exe", getcwd())
startfile('settings.exe')
except FileNotFoundError as e:
f = open('FatalErrorDownloading.ini', 'w+')
f.write(str(e))
f.close()
sys.exit("Done install")
filename = 'main\\sounds\\updating.wav'
try:
response = get("https://api.github.com/repos/JOJO-men/Horizon/releases/latest")
online = response.json()["published_at"]
offline = f.read()
if str(online) == str(offline):
startfile('main\\Nightmare.exe')
f.close()
elif str(online) != str(offline):
PlaySound(filename, SND_FILENAME)
f.close()
if path.isfile('ConfigGames.ini'):
remove('ConfigGames.ini')
move("main\\cfg\\ConfigGames.ini", getcwd())
if path.isfile('currectGame.ini'):
remove('currectGame.ini')
move("main\\cfg\\currectGame.ini", getcwd())
try:
for f in listdir("main\\icons"):
if path.isfile(f):
remove(f)
move(f"main\\icons\\{f}", getcwd())
except FileNotFoundError:
pass
try:
for f in listdir("main\\games"):
if path.isfile(f):
remove(f)
move(f"main\\games\\{f}", getcwd())
except FileNotFoundError:
pass
system('RMDIR "main" /S /Q')
Repo.clone_from('https://github.com/JOJO-men/Horizon', 'main')
try:
if path.isfile('settings.exe'):
remove('settings.exe')
try:
move("main\\settings.exe", getcwd())
except BaseException:
pass
if path.isfile('main\\cfg\\ConfigGames.ini'):
remove('main\\cfg\\ConfigGames.ini')
try:
move("ConfigGames.ini", "main\\cfg")
except FileNotFoundError:
pass
if path.isfile('main\\cfg\\currectGame.ini'):
remove('main\\cfg\\currectGame.ini')
try:
move("currectGame.ini", "main\\cfg")
except FileNotFoundError:
pass
try:
for i in range(1, 9):
if path.isfile(f'main\\games\\game{i}.lnk'):
remove(f'main\\games\\game{i}.lnk')
move(f"game{i}.lnk", "main\\games")
except FileNotFoundError:
pass
try:
for i in range(1, 5):
if path.isfile(f'main\\games\\web{i}.lnk'):
remove(f'main\\games\\web{i}.lnk')
move(f"web{i}.lnk", "main\\games")
except FileNotFoundError:
pass
try:
for i in range(1, 9):
if path.isfile(f'main\\icons\\game{i}.png'):
remove(f'main\\icons\\game{i}.png')
move(f"game{i}.png", "main\\icons")
except FileNotFoundError:
pass
try:
for i in range(1, 5):
if path.isfile(f'main\\icons\\web{i}.png'):
remove(f'main\\icons\\web{i}.png')
move(f"web{i}.png", "main\\icons")
except FileNotFoundError:
pass
try:
for i in range(1, 9):
if path.isfile(f'main\\icons\\textgame{i}.png'):
remove(f'main\\icons\\textgame{i}.png')
move(f"textgame{i}.png", "main\\icons")
except FileNotFoundError:
pass
try:
for i in range(1, 5):
if path.isfile(f'main\\icons\\textweb{i}.png'):
remove(f'main\\icons\\textweb{i}.png')
move(f"textweb{i}.png", "main\\icons")
except FileNotFoundError:
pass
startfile('main\\Nightmare.exe')
except FileNotFoundError as e:
f = open('FatalErrorDownloading.ini', 'w+')
f.write(str(e))
f.close()
except BaseException as e:
try:
startfile('main\\Nightmare.exe')
f = open('FatalErrorDownloading.ini', 'w+')
f.write(str(e))
f.close()
except FileNotFoundError as e:
f = open('FatalErrorDownloading.ini', 'w+')
f.write(str(e))
f.close()