Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setBackgroundColor(colors.gray)
- term.clear()
- term.setCursorPos(1,1)
- local function bar(barItem)
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.blue)
- term.clearLine()
- print("Settings | "..barItem)
- term.setCursorPos(49,1)
- print("(X)")
- end
- local function information()
- term.setBackgroundColor(colors.gray)
- term.clear()
- term.setCursorPos(1,1)
- local diskUsage = fs.getSize("osros/")
- local httpOn = http
- bar("Computer Information")
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.gray)
- print("OS Version: "..ver)
- print("OS Disk Usage: "..diskUsage.." (Inaccurate)")
- if http then
- print("HTTP: On")
- else
- print("HTTP: Off")
- end
- print("Coder: OptimusSnorr")
- print("Released by: Snorrful Systems")
- print("")
- print("(C) 2013 Snorrful Systems")
- print("^- Back")
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>1 and X<7 and button == 1 and Y == 9 then
- shell.run("osros/system/settings.ossf")
- elseif X>49 and X<52 and button ==1 and Y == 1 then
- shell.run("osros/system/settings.ossf")
- else
- sleep(0.2)
- information()
- end
- end
- end
- end
- local function bootBehaviour()
- term.setBackgroundColor(colors.gray)
- term.clear()
- term.setCursorPos(1,1)
- local bootOSROS = fs.exists("startup")
- bar("Boot Behaviour")
- term.setCursorPos(1,2)
- if bootOSROS == true then
- term.setBackgroundColor(colors.gray)
- print("Your computer boots OSROS on startup.")
- term.setTextColor(colors.red)
- print("Disable")
- term.setTextColor(colors.white)
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>1 and X<8 and button ==1 and Y==3 then
- shell.run("move startup osros/system/startup.suf")
- bootBehaviour()
- elseif X>49 and X<52 and button == 1 and Y == 1 then
- shell.run("osros/system/settings.ossf")
- else
- bootBehaviour()
- end
- end
- end
- else
- term.setBackgroundColor(colors.gray)
- print("Your computer does not boot OSROS on startup. To start OSROS, type osros/system/startup.suf")
- print("If you wish to boot OSROS on startup, hit enable.")
- term.setTextColor(colors.green)
- print("Enable ")
- term.setTextColor(colors.white)
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>1 and X<8 and button ==1 and Y==5 then
- shell.run("move osros/system/startup.suf startup")
- bootBehaviour()
- elseif X>49 and X<52 and button == 1 and Y == 1 then
- shell.run("osros/system/settings.ossf")
- else
- bootBehaviour()
- end
- end
- end
- end
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>49 and X<52 and button == 1 and Y == 1 then
- shell.run("osros/system/settings.ossf")
- else
- sleep(0.2)
- bootBehaviour()
- end
- end
- end
- local function safeBootSettings()
- term.clear()
- term.setCursorPos(1,1)
- bar("Safe Boot")
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.gray)
- print("What is Safe Boot?")
- print("SafeBoot is a little function by Snorrful Systems (and others) that boots the computer in a safe way,")
- print("for example; if your computer shuts down without deleting the session file, it will ask you if you wish")
- print("to boot normally or SHELL. (SHELL boots after 5 seconds).")
- print("")
- if safeBoot == "false" then
- term.setTextColor(colors.green)
- print("Enable SafeBoot")
- term.setTextColor(colors.white)
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>1 and X<16 and button ==1 and Y ==11 then
- local target = {}
- target.safeBoot = "true"
- target.dBarC = desktopBarColor
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc", "w"), "Could not save configuration!")
- handle.write(output)
- handle.close()
- local handle = assert(fs.open("osros/system/config.osc", "r"), "Couldn't load the configuration!")
- local input = handle.readAll()
- handle.close()
- local conf = textutils.unserialize(input)
- desktopBarColor = conf.dBarC
- safeBoot = conf.safeBoot
- safeBootSettings()
- elseif X>49 and X<52 and button ==1 and Y==1 then
- shell.run("osros/system/settings.ossf")
- else
- safeBootSettings()
- end
- end
- end
- elseif safeBoot == "true" then
- term.setTextColor(colors.red)
- print("Disable SafeBoot")
- term.setTextColor(colors.white)
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>1 and X<17 and button ==1 and Y ==11 then
- local target = {}
- target.safeBoot = "false"
- target.dBarC = desktopBarColor
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc", "w"), "Could not save configuration!")
- handle.write(output)
- handle.close()
- local handle = assert(fs.open("osros/system/config.osc", "r"), "Couldn't load the configuration!")
- local input = handle.readAll()
- handle.close()
- local conf = textutils.unserialize(input)
- desktopBarColor = conf.dBarC
- safeBoot = conf.safeBoot
- safeBootSettings()
- elseif X>49 and X<52 and button ==1 and Y==1 then
- shell.run("osros/system/settings.ossf")
- else
- safeBootSettings()
- end
- end
- end
- end
- end
- local function desktopBarColorChange()
- term.clear()
- term.setCursorPos(1,1)
- bar("Desktop Bar Color")
- term.setBackgroundColor(colors.gray)
- print("Change your desktop bar color. (Only changes upon reboot)")
- print("[BLUE] [RED] [GREEN] [CYAN] [ORANGE]")
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>1 and X<6 and button ==1 and Y== 4 then
- local target = {}
- target.safeBoot = safeBoot
- target.dBarC = colors.blue
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc","w"), "fail")
- handle.write(output)
- handle.close()
- shell.run("osros/system/settings.ossf")
- elseif X>8 and X<12 and button ==1 and Y==4 then
- local target = {}
- target.safeBoot = safeBoot
- target.dBarC = colors.red
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc","w"), "fail")
- handle.write(output)
- handle.close()
- shell.run("osros/system/settings.ossf")
- elseif X>14 and X<20 and button ==1 and Y==4 then
- local target = {}
- target.safeBoot = safeBoot
- target.dBarC = colors.green
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc","w"), "fail")
- handle.write(output)
- handle.close()
- shell.run("osros/system/settings.ossf")
- elseif X>22 and X<27 and button ==1 and Y==4 then
- local target = {}
- target.safeBoot = safeBoot
- target.dBarC = colors.cyan
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc","w"), "fail")
- handle.write(output)
- handle.close()
- shell.run("osros/system/settings.ossf")
- elseif X>29 and X<36 and button ==1 and Y==4 then
- local target = {}
- target.safeBoot = safeBoot
- target.dBarC = colors.orange
- local output = textutils.serialize(target)
- local handle = assert(fs.open("osros/system/config.osc","w"), "fail")
- handle.write(output)
- handle.close()
- shell.run("osros/system/settings.ossf")
- elseif X>49 and X<52 and button ==1 and Y==1 then
- shell.run("osros/system/settings.ossf")
- else
- desktopBarColorChange()
- end
- end
- end
- end
- local function settings()
- bar("Main Menu")
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.gray)
- print("Change Desktop Background")
- print("Computer Information")
- print("Boot Behaviour")
- print("SafeBoot")
- print("Desktop Bar Color")
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if event == "mouse_click" then
- if X>49 and X<52 and button == 1 and Y ==1 then
- shell.run("osros/system/desktop.ossf")
- elseif X>1 and X<25 and button == 1 and Y ==3 then
- information()
- elseif X>1 and X<20 and button == 1 and Y ==4 then
- bootBehaviour()
- elseif X>1 and X<8 and button ==1 and Y == 5 then
- safeBootSettings()
- elseif X>1 and X<30 and button ==1 and Y==2 then
- shell.run("paint osros/files/desktopbg.osif")
- shell.run("osros/system/settings.ossf")
- elseif X>1 and X<24 and button ==1 and Y==6 then
- desktopBarColorChange()
- else
- sleep(0.2)
- shell.run("osros/system/settings.ossf")
- end
- end
- end
- end
- settings()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement