Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- als .modderOS/diskutils speichern!
- shell.run("/.modderOS/einstellungen")
- local xx,yy = term.getSize()
- local quit = 0
- local select = 0
- local diskDrive
- for _, side in ipairs(rs.getSides()) do
- if peripheral.isPresent(side) and peripheral.getType(side) == "drive" then
- diskDrive = side
- break
- end
- end
- local function reset()
- local x,y = term.getSize()
- term.setBackgroundColor(einstellungen[1])
- term.setTextColor(einstellungen[3])
- term.clear()
- term.setCursorPos(1, 1)
- paintutils.drawLine(1, 1, x, 1, einstellungen[2])
- term.setCursorPos(1, 1)
- print("Disk Utilities")
- term.setBackgroundColor(einstellungen[2])
- term.setTextColor(einstellungen[3])
- local x1 = x-6
- term.setCursorPos(x1,1)
- print("Zurück")
- term.setBackgroundColour(einstellungen[1])
- end
- local function utils()
- term.setCursorPos(2,3)
- term.setBackgroundColor(einstellungen[1])
- write("Disketten-Label: ")
- print(disk.getLabel(diskDrive))
- term.setCursorPos(2,5)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print(" ")
- term.setCursorPos(2,6)
- print(" Label setzen ")
- term.setCursorPos(2,7)
- print(" ")
- term.setCursorPos(2,9)
- print(" ")
- term.setCursorPos(2,10)
- print(" Diskette Löschen ")
- term.setCursorPos(2,11)
- print(" ")
- end
- reset()
- if diskDrive then
- if disk.isPresent(diskDrive) then
- utils()
- while quit == 0 do
- local event, button, x, y = os.pullEvent("mouse_click")
- if event == "mouse_click" then
- if y == 1 and x > xx-7 and x < xx then
- quit = 1
- elseif y >= 5 and y <= 7 and x >= 2 and x <= 19 then
- select = 1
- elseif y >= 9 and y <= 11 and x >= 2 and x <= 19 then
- select = 2
- end
- end
- if select == 1 then
- select = 0
- reset()
- utils()
- paintutils.drawLine(1,yy,xx,yy,colors.black)
- term.setBackgroundColor(colors.black)
- term.setTextColor(einstellungen[3])
- term.setCursorPos(1,yy)
- write("Label:")
- term.setCursorPos(8,yy)
- local label = read()
- disk.setLabel(diskDrive, label)
- reset()
- utils()
- elseif select == 2 then
- select = 0
- reset()
- utils()
- for _, sFile in pairs(fs.list("/disk")) do
- fs.delete("/disk/" .. sFile)
- end
- paintutils.drawLine(1,yy,xx,yy,colors.black)
- term.setBackgroundColor(colors.black)
- term.setTextColor(einstellungen[3])
- term.setCursorPos(xx/2-15,yy)
- write("Diskette erfolgreich gelöscht!")
- sleep(2)
- reset()
- utils()
- end
- end
- else
- paintutils.drawLine(xx/2-13,3,xx/2+13,3,colors.black)
- paintutils.drawLine(xx/2-13,4,xx/2+13,4,colors.black)
- paintutils.drawLine(xx/2-13,5,xx/2+13,5,colors.black)
- term.setCursorPos(xx/2-12,4)
- term.setTextColor(colors.red)
- print("Keine Diskette gefunden!")
- while quit == 0 do
- local event, button, x, y = os.pullEvent("mouse_click")
- if event == "mouse_click" then
- if y == 1 and x > xx-7 and x < xx then
- quit = 1
- end
- end
- end
- end
- else
- paintutils.drawLine(xx/2-17,3,xx/2+17,3,colors.black)
- paintutils.drawLine(xx/2-17,4,xx/2+17,4,colors.black)
- paintutils.drawLine(xx/2-17,5,xx/2+17,5,colors.black)
- term.setCursorPos(xx/2-16,4)
- term.setTextColor(colors.red)
- print("Kein Diskettenlaufwerk gefunden!")
- while quit == 0 do
- local event, button, x, y = os.pullEvent("mouse_click")
- if event == "mouse_click" then
- if y == 1 and x > xx-7 and x < xx then
- quit = 1
- end
- end
- end
- end
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement