Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- term.clear()
- term.setCursorPos(1,1)
- local selection = 1;
- local version = "1.3.1";
- local path = "";
- local page = 1;
- local function cPrint(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- print(text)
- end
- local function cWrite(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- write(text)
- end
- function dmenu()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- print("Type 'Downloads' to view downloads.")
- print("Type 'Download' to download files.")
- command = read()
- if command == "Downloads" then
- path = "downloads"
- filemanager()
- elseif command == "Download" then
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- write("Please enter the file ID: ")
- code = read()
- write("Please enter the name: ")
- name = read()
- if fs.exists("downloads/" ..name) then
- write(name.. " already exists! Would you like to overwrite this file? ")
- option = read()
- if option == "Yes" then
- fs.delete("downloads/" ..name)
- shell.run("pastebin","get", code, "downloads/" ..name)
- sleep(2)
- dmenu()
- elseif option == "No" then
- print("Cancled...")
- sleep(2)
- dmenu()
- else
- print("Option does not exist! Say Yes or No.")
- sleep(2)
- dmenu()
- end
- else
- shell.run("pastebin","get", code, "downloads/" ..name)
- sleep(3)
- dmenu()
- end
- else
- print("Command does not exist!")
- sleep(2)
- dmenu()
- end
- end
- function BootOptions()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- if page == 1 then
- if selection == 1 then
- cPrint("--> File Manager <--")
- else
- cPrint("File Manager")
- end
- if selection == 2 then
- cPrint("--> Internet <--")
- else
- cPrint("Internet")
- end
- if selection == 3 then
- cPrint("--> Download Manager <--")
- else
- cPrint("Download Manager")
- end
- if selection == 4 then
- cPrint("--> Switch to monitor mode <--")
- else
- cPrint("Switch to monitor mode")
- end
- if selection == 5 then
- cPrint("--> Lua mode <--")
- else
- cPrint("Lua mode")
- end
- elseif page == 2 then
- if selection == 1 then
- cPrint("--> Game Library <--")
- else
- cPrint("Game Library")
- end
- if selection == 2 then
- cPrint("--> Change Password <--")
- else
- cPrint("Change Password")
- end
- if selection == 3 then
- cPrint("--> Blank <--")
- else
- cPrint("Blank")
- end
- if selection == 4 then
- cPrint("--> Blank <--")
- else
- cPrint("Blank")
- end
- if selection == 5 then
- cPrint("--> Blank <--")
- else
- cPrint("Blank")
- end
- end
- if selection == 6 then
- cPrint("--> Shutdown <--")
- else
- cPrint("Shutdown")
- end
- print("")
- if page == 1 then
- cPrint("Page " ..page.. " of 2. -->")
- elseif page == 2 then
- cPrint("< -- Page " ..page.. " of 2")
- end
- end
- function password()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- if fs.exists("/.pass") then
- cWrite("Password: ")
- file = fs.open("/.pass","r")
- correctpass = file.readAll()
- file.close()
- pass = read("*")
- if pass == correctpass then
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome!")
- sleep(2)
- BootOptions()
- else
- print("")
- write("Incorrect! Rebooting!")
- sleep(2)
- os.reboot()
- end
- else
- cPrint("No password set. Set one now.")
- cWrite("New password: ")
- newPass = read("*")
- cWrite("Comfirm Password: ")
- comPass = read("*")
- if newPass == comPass then
- file = fs.open("/.pass","w")
- file.write(newPass)
- file.close()
- print("Password set, rebooting...")
- sleep(2)
- os.reboot()
- else
- print("Password does not match comfirm.")
- sleep(2)
- password()
- end
- end
- end
- function Loader()
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- cPrint("Loading.")
- cPrint("[ ]")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- cPrint("Loading.")
- cPrint("[II ]")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- cPrint("Loading.")
- cPrint("[IIII ]")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- cPrint("Loading.")
- cPrint("[IIIIII]")
- sleep(1)
- --BootOptions()
- password()
- end
- Loader()
- while true do
- local e,key = os.pullEvent( "key" )
- if key == 17 or key == 200 then
- if selection > 1 then
- selection = selection - 1
- BootOptions()
- end
- elseif key == 31 or key == 208 then
- if selection < 6 then
- selection = selection + 1
- BootOptions()
- end
- elseif key == 203 then
- if page > 1 then
- page = page - 1
- BootOptions()
- end
- elseif key == 205 then
- if page < 2 then
- page = page + 1
- BootOptions()
- end
- elseif key == 28 then
- if selection == 6 then
- os.shutdown()
- elseif selection > 2 and page == 2 then
- BootOptions()
- else
- break
- end
- end
- end
- function filemanager()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("C://" ..path)
- cPrint("---------------------")
- shell.run("dir", path)
- cPrint("---------------------")
- write("C://")
- directory = read()
- path = directory
- if fs.isDir( path ) then
- if path == "disk" then
- print("Browse or Label?")
- write("Do: ")
- command = read()
- if command == "Browse" then
- filemanager()
- elseif command == "Label" then
- write("Choose a side: ")
- diskside = read()
- write("Enter what you want to label it: ")
- diskname = read()
- shell.run("label", "set", diskside, diskname)
- print("Labeled!")
- sleep(1)
- path = ""
- filemanager()
- else
- print("Invalid Command!")
- sleep(1)
- path = ""
- filemanager()
- end
- else
- filemanager()
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- print("Run, Copy, Delete, Edit, Move, or Upload?")
- write("Do: ")
- command = read()
- if command == "Run" then
- shell.run(path)
- elseif command == "Copy" then
- write("Copy to where?")
- copypath = read()
- fs.copy(path, copypath)
- print("Copied!")
- sleep(1)
- path = ""
- filemanager()
- elseif command == "Delete" then
- print("Deleted.")
- fs.delete(path)
- sleep(1)
- path = ""
- filemanager()
- elseif command == "Upload" then
- shell.run("pastebin","put", path)
- sleep(5)
- path = ""
- filemanager()
- elseif command == "Move" then
- write("Move where?")
- movepath = read()
- fs.move(path, movepath)
- print("Moved!")
- sleep(3)
- path = ""
- filemanager()
- elseif command == "Edit" then
- shell.run("edit", path)
- else
- print("Command does not exist.")
- sleep(1)
- path = ""
- filemanager()
- end
- end
- end
- function games()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("Game Library: ")
- if fs.exists("games") then
- shell.run("dir", "games")
- else
- fs.makeDir("games")
- fs.copy("rom/programs/computer/worm", "games/Worm")
- shell.run("dir", "games")
- end
- write("C://games/")
- input = read()
- if fs.exists("games/"..input) then
- shell.run("games/" ..input)
- else
- print("This game does not exist, would you like to download it (y/n)?")
- input = read()
- if input == "n" then
- games()
- elseif input == "y" then
- write("Enter the pastebin game ID: ")
- fileid = read()
- write("Enter the game name: ")
- filename = read()
- shell.run("pastebin", "get", fileid, "games/" ..filename)
- games()
- else
- print("Unknown...")
- sleep(3)
- games()
- end
- end
- end
- function password()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- cPrint("")
- cWrite("Old Password: ")
- file = fs.open("/.pass","r")
- correctpass = file.readAll()
- file.close()
- pass = read("*")
- if pass == correctpass then
- cWrite("New Password: ")
- oldpass = read("*")
- fs.delete("/.pass")
- else
- print("")
- write("Incorrect! Rebooting!")
- sleep(2)
- os.reboot()
- end
- end
- if page == 1 then
- if selection == 1 then
- if fs.exists("movies") then
- else
- fs.makeDir("movies")
- fs.copy("rom/programs/secret/alongtimeago", "movies/starwars")
- end
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("C://" ..path)
- cPrint("---------------------")
- shell.run("dir", path)
- cPrint("---------------------")
- write("C://")
- directory = read()
- path = directory
- if fs.isDir( path ) then
- if path == "disk" then
- print("Browse or Label?")
- write("Do: ")
- command = read()
- if command == "Browse" then
- filemanager()
- elseif command == "Label" then
- write("Choose a side: ")
- diskside = read()
- write("Enter what you want to label it: ")
- diskname = read()
- shell.run("label", "set", diskside, diskname)
- print("Labeled!")
- sleep(1)
- path = ""
- filemanager()
- else
- print("Invalid Command!")
- sleep(1)
- path = ""
- filemanager()
- end
- else
- filemanager()
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- print("Run, Copy, Delete, Edit, Move, or Upload?")
- write("Do: ")
- command = read()
- if command == "Run" then
- shell.run(path)
- elseif command == "Copy" then
- write("Copy to where?")
- copypath = read()
- fs.copy(path, copypath)
- print("Copied!")
- sleep(1)
- path = ""
- filemanager()
- elseif command == "Delete" then
- print("Deleted.")
- fs.delete(path)
- sleep(1)
- path = ""
- filemanager()
- elseif command == "Upload" then
- shell.run("pastebin","put", path)
- sleep(5)
- path = ""
- filemanager()
- elseif command == "Move" then
- write("Move where?")
- movepath = read()
- fs.move(path, movepath)
- print("Moved!")
- sleep(3)
- path = ""
- filemanager()
- elseif command == "Edit" then
- shell.run("edit", path)
- else
- print("Command does not exist.")
- sleep(1)
- path = ""
- filemanager()
- end
- end
- end
- if selection == 2 then
- if fs.exists("rn") then
- shell.run("rn")
- else
- shell.run("pastebin","get","Y320Z2K0","rn")
- shell.run("rn")
- end
- end
- if selection == 4 then
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- print("Please choose a monitor side (left or right?): ")
- monitorside = read()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- shell.run("monitor", monitorside, "startup")
- end
- if selection == 5 then
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- if fs.exists("newluacode") then
- shell.run("newluacode")
- else
- shell.run("pastebin", "get", "emFiR2kK", "newluacode")
- term.clear()
- term.setCursorPos(1,1)
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------")
- shell.run("newluacode")
- end
- end
- if selection == 3 then
- if fs.exists("downloads") then
- else
- fs.makeDir("downloads")
- end
- dmenu()
- end
- elseif page == 2 then
- if selection == 1 then
- games()
- end
- if selection == 2 then
- cPrint("---------------------")
- cPrint("DellOS v" ..version)
- cPrint("---------------------/n")
- cWrite("Old password: ")
- newPass = read("*")
- file = fs.open("/.pass","r")
- correctpass = file.readAll()
- file.close()
- if newPass == correctpass then
- cWrite("New password: ")
- comPass = read("*")
- fs.delete("/.pass")
- file = fs.open("/.pass","w")
- file.write(newPass)
- file.close()
- cPrint("Password set! Rebooting")
- sleep(2)
- os.reboot()
- else
- cPrint("Incorrect password!")
- sleep(2)
- os.reboot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement