Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 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
Add Comment
Please, Sign In to add comment