-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathadvancedupdater
121 lines (112 loc) · 12.7 KB
/
advancedupdater
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
-- Advanced Updater by Henness
-- Version 1.1 1/13/2014
-- Config
local author = "Henness0666"
local project = "Advanced-Programs"
local branch = "master"
local screenw,screenh = term.getSize()
-- Functions
function printIntro()
local intro = {
[1] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," ","8","8","8","8","8","8","8","b","."," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[2] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," ","Y","8","8","b"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[3] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","P","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[4] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","P"," ","8","8","8"," "," ",".","d","8","8","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," ","8","8","8","8","b","."," "," ","8","8","8","8","8","b","."," "," "," ",".","d","8","8","8","8","b"," ",".","d","8","8","b","."," "," "," ",".","d","8","8","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," ","d","8","8","P"," ","8","8","8","d","8","8","8"," ",".","d","8","8","b","."," "," "," ",".","d","8","8","b","."," "," ","8","8","8","d","8","8","8"," ","8","8","8","8","b","."," "," ","8","8","8","8","8","b",".","d","8","8","b","."," "," ",".","d","8","8","8","8","b"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[5] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","P"," "," ","8","8","8"," ","d","8","8","\""," ","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," "," "," "," ","\"","8","8","b"," ","8","8","8"," ","\"","8","8","b"," ","d","8","8","P","\""," "," "," ","d","8","P"," "," ","Y","8","b"," ","d","8","8","\""," ","8","8","8"," "," "," "," "," "," ","8","8","8","8","8","8","8","P","\""," "," ","8","8","8","P","\""," "," ","d","8","8","\"","\"","8","8","b"," ","d","8","8","P","\"","8","8","b"," ","8","8","8","P","\""," "," "," "," "," "," ","\"","8","8","b"," ","8","8","8"," ","\"","8","8","8"," ","\"","8","8","b"," ","8","8","K"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[6] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","P"," "," "," ","8","8","8"," ","8","8","8"," "," ","8","8","8"," ","Y","8","8"," "," ","8","8","P"," ",".","d","8","8","8","8","8","8"," ","8","8","8"," "," ","8","8","8"," ","8","8","8"," "," "," "," "," ","8","8","8","8","8","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," ","8","8","8"," "," ","8","8","8"," ","8","8","8"," "," ","8","8","8"," ","8","8","8"," "," "," "," ",".","d","8","8","8","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," ","8","8","8"," ","\"","Y","8","8","8","8","b","."," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[7] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","8","8","8","8","8","8","8","8"," ","Y","8","8","b"," ","8","8","8"," "," ","Y","8","b","d","8","P"," "," ","8","8","8"," "," ","8","8","8"," ","8","8","8"," "," ","8","8","8"," ","Y","8","8","b","."," "," "," ","Y","8","b","."," "," "," "," "," ","Y","8","8","b"," ","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," ","Y","8","8",".",".","8","8","P"," ","Y","8","8","b"," ","8","8","8"," ","8","8","8"," "," "," "," ","8","8","8"," "," ","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," ","8","8","8"," "," "," "," "," "," ","X","8","8"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[8] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","d","8","8","P"," "," "," "," "," ","8","8","8"," "," ","\"","Y","8","8","8","8","8"," "," "," ","Y","8","8","P"," "," "," ","\"","Y","8","8","8","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," ","\"","Y","8","8","8","8","P"," ","\"","Y","8","8","8","8"," "," "," ","\"","Y","8","8","8","8","8"," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," "," ","\"","Y","8","8","P","\""," "," "," ","\"","Y","8","8","8","8","8"," ","8","8","8"," "," "," "," ","\"","Y","8","8","8","8","8","8"," ","8","8","8"," "," ","8","8","8"," "," ","8","8","8"," "," ","8","8","8","8","8","P","'"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[9] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","8","8","8"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[10] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","Y","8","b"," ","d","8","8","P"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "},
[11] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","\"","Y","8","8","P","\""," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}
}
local str = "[PRESS ANY KEY TO SKIP]"
term.clear()
for i=1,#intro[1]-screenw do
term.setCursorPos(1, 1)
write(string.rep("-", screenw))
term.setCursorPos(1, screenh)
write(string.rep("-", (screenw/2)-(#str/2))..str..string.rep("-", (screenw/2)-(#str/2)))
sleep(0.001)
for key,value in pairs(intro) do
for xpos=1,screenw do
term.setCursorPos(xpos, (screenh-11)/2+key)
write(intro[key][xpos+i-1])
end
end
end
end
function skip()
local id, key = os.pullEvent("key")
end
function loadTable(name)
local file = fs.open(name,"r")
local data = file.readAll()
file.close()
return textutils.unserialize(data)
end
function saveTable(table,name)
local file = fs.open(name,"w")
file.write(textutils.serialize(table))
file.close()
end
function getLink(file)
return "https://raw.github.com/" .. author .. "/" .. project .. "/" .. branch .. "/" .. file
end
function download(file, name)
print("Downloading, " .. file)
local data = http.get(getLink(file))
if data then
print(file .. " downloaded")
local file = fs.open(name,"w")
file.write(data.readAll())
file.close()
return true
end
end
function updatePrograms()
term.clear()
term.setCursorPos(1,1)
print("Checking for Updates...")
if fs.exists("apconfig") then
if download("config", "tmpconfig") then
config = loadTable("apconfig")
tmpconfig = loadTable("tmpconfig")
for key,value in pairs(tmpconfig) do
if tmpconfig[key]["version"] > config[key]["version"] then
if fs.exists(key) then
fs.delete(key)
end
download(key, tmpconfig[key]["path"])
end
end
fs.delete("apconfig")
saveTable(tmpconfig, "apconfig")
fs.delete("tmpconfig")
else
print("Unable to connect to http://github.com/")
end
else
print("No config file was found.")
if download("config", "apconfig") then
config = loadTable("apconfig")
for key,value in pairs(config) do
if fs.exists(key) then
fs.delete(key)
end
download(key, config[key]["path"])
end
else
print("Unable to connect to http://github.com/")
end
end
print("All programs updated.")
print("Press any key to continue.")
skip()
end
-- RUN
parallel.waitForAny(printIntro, skip)
updatePrograms()
if fs.exists("advancedgui")then
shell.run("advancedgui")
end