Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local verze = "21.0628.R1"
- local anim = 0.1
- local RamCesta = ("/C/system/RAM/updates")
- local w, h = term.getSize()
- ----------------------------------------------------
- local f=fs.open("/C/system/RAM/user","r")
- user=f.readLine()
- pass=f.readLine()
- Fname=f.readLine()
- Lname=f.readLine()
- f.close()
- ----------------------------------------------------
- local f=fs.open("/C/system/Users/"..user.."/.Registry/colors","r")
- local cnt=f.readAll()
- f.close()
- local nastaveni=textutils.unserialize(cnt)
- ----------------------------------------------------
- local f=fs.open("/C/system/Users/"..user.."/.Registry/textcol","r")
- local tnt=f.readAll()
- f.close()
- local text=textutils.unserialize(tnt)
- ----------------------------------------------------
- function ukonceni ()
- fs.delete (RamCesta)
- error()
- end
- function cbarva()
- lista.setTextColor(colors.black)
- lista.setBackgroundColor(colors.gray)
- end
- function defaultvalue()
- end
- function kontrola()
- if fs.exists("/C/system/server/rules/AD/period.cfg") then
- local data = fs.open("/C/system/server/rules/AD/period.cfg", "r")
- stahovani = data.readLine()
- data.close()
- else
- local data = fs.open("/C/system/server/rules/AD/period.cfg", "w")
- data.writeLine("3600")
- data.close()
- kontrola()
- end
- if not fs.exists ("/C/service/updateAD") and not fs.exists ("/C/service/updateAD.lua") then
- if not fs.exists ("/C/stopService/updateAD.lua") then
- shell.run("pastebin get 4ZmxiiV6 /C/service/updateAD.lua")
- multishell.launch({}, "/C/service/updateAD.lua")
- end
- end
- local dat = fs.open("/C/service/updateAD.lua", "r")
- verzeS = dat.readLine()
- dat.close()
- verzeS = string.sub(verzeS,10,19)
- end
- function start()
- defaultvalue()
- local myWindow = window.create(term.current(),w/2-11,h/2-5,25,9)
- myWindow.setBackgroundColor(colors.green)
- myWindow.setTextColor(colors.white)
- myWindow.clear()
- myWindow.setCursorPos (8, 5)
- myWindow.write"Update Manager"
- myWindow.setCursorPos (1, 9)
- myWindow.write(verze)
- myWindow.setCursorPos (1, 1)
- myWindow.write"Pepek@Soft"
- myWindow.setCursorPos (22, 9)
- myWindow.write"2020"
- sleep(1)
- kontrola()
- menu()
- end
- function plocha()
- w, h = term.getSize()
- paintutils.drawLine(1, 1, 51, 1, nastaveni.barva)
- paintutils.drawPixel (51,1, colors.red)
- term.setCursorPos (51,1)
- term.setTextColor(text.barva)
- write "*"
- barW = window.create(term.current(),1,2,w,1)
- barW.setBackgroundColor(colors.gray)
- barW.clear()
- barW.setTextColor(colors.white)
- barW.setCursorPos(2,1)
- barW.write"Update Manager >"
- pozadi = window.create(term.current(),13,3,w,h-2)
- pozadi.setBackgroundColor(colors.white)
- pozadi.setTextColor(colors.black)
- pozadi.clear()
- lista = window.create(term.current(),1,3,12,h-2)
- lista.setBackgroundColor(nastaveni.barva)
- lista.setTextColor(text.barva)
- lista.clear()
- lista.setCursorPos(2,3)
- lista.write"Dashboard"
- lista.setCursorPos(2,h-2)
- lista.setTextColor(colors.white)
- lista.write("Pepek@Soft")
- term.setBackgroundColor(colors.lightGray)
- end
- -----------------------------------------------------------------------------
- local page = "main"
- function main()
- barW.setCursorPos(19,1)
- barW.write"Dashboard"
- pozadi.setCursorPos(2,2)
- pozadi.write ("Manager version: "..verze)
- pozadi.setCursorPos(2,3)
- pozadi.write ("Service version: "..verzeS)
- pozadi.setCursorPos(2,5)
- pozadi.write"Download updates"
- pozadi.setCursorPos(2,7)
- pozadi.write"Every"
- pozadi.setCursorPos(20,7)
- pozadi.write"sec."
- if varovani then
- pozadi.setTextColor(colors.red)
- pozadi.setCursorPos(2,9)
- pozadi.write"Setting has been changed, please"
- pozadi.setCursorPos(2,10)
- pozadi.write"terminate and start service"
- pozadi.setCursorPos(2,11)
- pozadi.write"manually, or restart your computer."
- pozadi.setTextColor(colors.black)
- end
- pozadi.setBackgroundColor(colors.lightGray)
- pozadi.setCursorPos(8,7)
- pozadi.write" "
- pozadi.setCursorPos(9,7)
- pozadi.write(stahovani)
- pozadi.setCursorPos(2,13)
- pozadi.write" Start Service "
- pozadi.setCursorPos(20,13)
- pozadi.write" Update Service "
- end
- function menu()
- plocha()
- if (page == "main") then
- main ()
- end
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if event == "mouse_click" and x >= 2 and x <= 12 and y == 5 then
- cbarva()
- lista.setCursorPos(1,3)--
- lista.write" Dashboard "
- sleep(anim)
- page = "main"
- menu()
- elseif event == "mouse_click" and x >= 20 and x <= 30 and y == 9 then
- pozadi.setBackgroundColor(colors.lightBlue)
- term.setBackgroundColor(colors.lightBlue)
- pozadi.setCursorPos(8,7)
- pozadi.write" "
- pozadi.setCursorPos(9,7)
- stahovani = read()
- local data = fs.open("/C/system/server/rules/AD/period.cfg", "w")
- data.writeLine(stahovani)
- data.close()
- pozadi.setBackgroundColor(colors.white)
- varovani = true
- elseif event == "mouse_click" and x >= 14 and x <= 28 and y == 15 then
- pozadi.setBackgroundColor(colors.gray)
- pozadi.setCursorPos(2,13)
- pozadi.write" Start Service "
- pozadi.setBackgroundColor(colors.white)
- sleep(anim)
- if fs.exists ("/C/service/updateAD.lua") then
- multishell.launch({}, "/C/service/updateAD.lua")
- pozadi.setTextColor(colors.green)
- pozadi.setCursorPos(2,14)
- pozadi.write"Started successfully"
- sleep(0.5)
- varovani = false
- end
- elseif event == "mouse_click" and x >= 32 and x <= 47 and y == 15 then
- pozadi.setBackgroundColor(colors.gray)
- pozadi.setCursorPos(20,13)
- pozadi.write" Update Service "
- pozadi.setBackgroundColor(colors.white)
- sleep(anim)
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.white)
- pozadi.setCursorPos(1,14)
- fs.delete("/C/service/updateAD.lua")
- shell.run("pastebin get 4ZmxiiV6 /C/service/updateAD.lua")
- pozadi.setCursorPos(1,14)
- fs.delete("/C/system/server/rules/AD/Update.lua")
- shell.run("pastebin get mCfZSJgY /C/system/server/rules/AD/Update.lua")
- varovani = true
- end
- if x == 51 and y == 1 then
- ukonceni ()
- else
- menu() -------- stejne jako nazev funkce
- end
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement