Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SimSoft Yellow - Copyright by Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/)
- --Update
- BC(1)
- Clear()
- file = fs.open("SimSoft/Data/SystemColor","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- SystemColor = fileData[3]
- SystemColor = ((SystemColor-1)+1)
- w, h = term.getSize()
- wC = 0
- hC = 1
- while true do
- wC = (wC+1)
- CP(wC, hC)
- BC(SystemColor)
- write(" ")
- if wC == w then
- if hC == 3 then
- break
- else
- hC = (hC+1)
- wC = 0
- end
- end
- end
- anzeige = "SimSoft Update System"
- TC(1)
- CP(((w/2)-((#anzeige)/2)),2)
- print(anzeige)
- BC(1)
- TC(128)
- CP(4,6)
- print("Loading Update File...")
- local cacheBuster = ("%x"):format(math.random(0, 2 ^ 30))
- local datei = http.get("https://pastebin.com/raw/DkuTZtem".. "?cb=" .. cacheBuster)
- datei = datei.readAll()
- local file = fs.open("SimSoft/Data/UpdateTemp", "w")
- file.write(datei)
- file.close()
- file = fs.open("SimSoft/Data/Version","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- SystemVersion = fileData[3]
- file = fs.open("SimSoft/Data/UpdateTemp","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- C = 3
- while true do
- onlineVersion = fileData[(C-2)]
- onlineUpdateCode = fileData[(C-1)]
- if SystemVersion == onlineVersion then
- if C == 3 then
- updateErgebnis = false
- break
- else
- updateErgebnis = true
- break
- end
- else
- C = (C+3)
- end
- end
- TC(128)
- CP(4,7)
- print("> File Successfully Loaded!")
- TC(128)
- CP(4,8)
- print("Checking System And Online Version...")
- if updateErgebnis == false then
- TC(32)
- CP(4,10)
- print("> Your System Is Up To Date!")
- sleep(2)
- else
- TC(16384)
- CP(4,10)
- print("> Your System Is Not Current!")
- TC(128)
- CP(4,10)
- shell.run("pastebin run "..onlineUpdateCode)
- os.reboot()
- end
Add Comment
Please, Sign In to add comment