Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.white)
- term.clear()
- -- Hack OS - v0.19
- -- By FoxWorn3365
- -- APPUNTI
- -- Configurazioni sistema: .localConf
- -- Configurazioni pubbliche: .publicConf
- -- Immagini: /Hack/images/
- -- APP: /Hack/programmi/
- -- App di esempio:
- -- Directory: /Hack/programmi/fileManager/
- -- Icona: /Hack/programmi/fileManager/app.ico
- -- File da eseguire: /Hack/programmi/fileManager/exec.luaDir
- -- Configurazioni (facoltativo) (OBBLIGO AUTOGENERAZIONE): /Hack/programmi/fileManager/conf.public
- -- Nome dell'APP (massimo 4 caratteri): /Hack/programmi/fileManager/app.name
- -- API: https://fcosma.it/hackos/api
- maxw, maxh = term.getSize()
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1, 16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- function giremu(inputstr, sep)
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- function clear()
- sfondo(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.lightGray)
- term.setCursorPos((maxw - #testo) / 2, 1)
- term.setTextColor(colors.white)
- term.write(testo)
- end
- function alarm(testo, colore, y)
- drawFilledBox(1, y, maxw, y, colors[colore])
- term.setCursorPos((maxw - #testo) / 2, y)
- term.setTextColor(colors.white)
- term.write(testo)
- no()
- end
- function bottone(x, y, color, text)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function drawA()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- end
- function ico(x, y, color, text)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function pulisci()
- drawA()
- term.clear()
- term.setCursorPos(1, 1)
- end
- don = 0
- while true do
- if don == 0 then
- pulisci()
- titolo("Hack OS - Impostazioni")
- drawA()
- ico(51, 1, "red", "X")
- print("\nImpostazioni del Computer")
- bottone(5, 5, "gray", "Cambia il Nome")
- bottone(5, 6, "gray", "Cambia la Password")
- bottone(5, 7, "gray", "Imposta uno Sfondo (IMAGE)")
- bottone(5, 8, "gray", "Imposta uno Sfondo (COLOR)")
- bottone(5, 10, "green", "Aggiorna Hack Desktop")
- bottone(5, 12, "green", "Aggiorna Hack Store")
- bottone(5, 14, "orange", "Aggiorna Impostazioni")
- bottone(5, 16, "red", "Reinstalla Hack OS")
- local event, bt, x, y = os.pullEvent("mouse_click")
- if y == 1 and x == 51 then
- shell.run("desktop")
- elseif y == 5 then
- don = 1
- elseif y == 6 then
- don = 2
- elseif y == 7 then
- don = 3
- elseif y == 8 then
- don = 4
- elseif y == 16 then
- shell.run("pastebin get DVXwL6uV /init")
- shell.run("rm /Hack/")
- shell.run("/init")
- elseif y == 14 then
- shell.run("rm /Hack/programmi/settings/exec.luaDir")
- shell.run("pastebin get EKH7AzbK /Hack/programmi/settings/exec.luaDir")
- elseif y == 10 then
- shell.run("rm /startup")
- shell.run("rm /desktop")
- shell.run("pastebin get AQX6gG3e /startup")
- shell.run("pastebin get ZyEEJig6 /desktop")
- term.setTextColor(colors.lime)
- print("Hack OS aggiornato! Riavvio in 3 secondi")
- sleep(2)
- shell.run("reboot")
- elseif y == 12 then
- shell.run("rm /Hack/programmi/store/exec.luaDir")
- shell.run("pastebin get B0TnDgED /Hack/programmi/store/exec.luaDir")
- term.setTextColor(colors.lime)
- print("Hack Store aggiornato! Riavvio in 3 secondi")
- sleep(2)
- shell.run("reboot")
- end
- elseif don == 1 then
- pulisci()
- titolo("Hack OS - Impostazioni")
- drawA()
- print("\n\n\nInserisci il nuovo nome:")
- nName = read()
- local h = fs.open("/.localConf", "r")
- oldConf = giremu(h.readAll(), "$")
- h.close()
- shell.run("rm /.localConf")
- local h = fs.open("/.localConf", "w")
- if nName == nil or nName == '' then
- h.writeLine("HackOS-PC$"..oldConf[2].."$"..oldConf[3])
- else
- h.writeLine(nName.."$"..oldConf[2].."$"..oldConf[3])
- end
- h.flush()
- h.close()
- term.setTextColor(colors.lime)
- print("\nFatto! Riavvio tra 3 secondi...")
- sleep(2)
- shell.run("reboot")
- elseif don == 2 then
- pulisci()
- titolo("Hack OS - Impostazioni")
- drawA()
- print("\n\n\nInserisci la nuova password:")
- nPass = read()
- local h = fs.open("/.localConf", "r")
- oldConf = giremu(h.readAll(), "$")
- h.close()
- shell.run("rm /.localConf")
- local h = fs.open("/.localConf", "w")
- if nPass ~= nil or nPass ~= '' then
- h.writeLine(oldConf[1].."$"..oldConf[2].."$"..nPass)
- else
- h.writeLine(oldConf[1].."$"..oldConf[2])
- end
- h.flush()
- h.close()
- term.setTextColor(colors.lime)
- print("\nFatto! Riavvio tra 3 secondi...")
- sleep(2)
- shell.run("reboot")
- elseif don == 3 then
- pulisci()
- titolo("Hack OS - Impostazioni")
- drawA()
- print("\n\n\nRICORDA! L'immagine deve essere nella directory /Hack/files/!\nInserisci il file: (metti null per rimuovere)")
- nBkg = read()
- if nBkg ~= "null" then
- if fs.exists("/Hack/files/"..nBkg) == true then
- shell.run("rm /.bkgConf")
- local h = fs.open("/.bkgConf", "w")
- h.write(nBkg)
- h.flush()
- h.close()
- term.setTextColor(colors.lime)
- print("\nFatto! Riavvio tra 3 secondi...")
- sleep(1.5)
- shell.run("reboot")
- else
- print("\nVuoto! Riavvio tra 3 secondi...")
- sleep(1.5)
- shell.run("reboot")
- end
- elseif nBkg == nil or nBkg == "" then
- shell.run("/Hack/programmi/settings/exec.luaDir")
- else
- shell.run("rm /.bkgConf")
- shell.run("/Hack/programmi/settings/exec.luaDir")
- end
- elseif don == 4 then
- pulisci()
- titolo("Hack OS - Impostazioni")
- drawA()
- print("\n\n\nInserisci il colore:")
- nCll = read()
- if nCll ~= "green" and nCll ~= "red" and nCll ~= "white" and nCll ~= "blue" and nCll ~= "aqua" and nCll ~= "orange" and nCll ~= "black" and nCll ~= "gray" and nCll ~= "lime" ~= "cyan" then
- print("\nCOLORE INVALIDO!\nVerrai reindirizzato tra 3 secondi...")
- sleep(1)
- shell.run("/Hack/programmi/settings/exec.luaDir")
- else
- if nCll ~= nil or nCll ~= "" then
- shell.run("rm /.bkgColor")
- local h = fs.open("/.bkgColor", "w")
- h.write(nCll)
- h.flush()
- h.close()
- term.setTextColor(colors.lime)
- print("\nFatto! Riavvio tra 3 secondi...")
- sleep(2)
- shell.run("reboot")
- else
- shell.run("/Hack/programmi/settings/exec.luaDir")
- shell.run("rm /.bkgColor")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement