Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function viewBox(x,y,s,n)
- term.setBackgroundColor(colors.lightGray)
- term.setCursorPos(x,y)
- term.setCursorPos(x,y)
- print(n..(string.rep("-",string.len(s)-string.len(n))))
- term.setCursorPos(x,(y+1))
- print(s)
- term.setCursorPos(x, (y+2))
- print(s)
- term.setCursorPos(x, (y+3))
- print(s)
- term.setCursorPos(x, (y+4))
- print(s)
- term.setCursorPos(x, (y+4))
- print(s)
- term.setCursorPos(x, (y+5))
- print(string.rep("-",string.len(s)))
- end
- local function MAIN(device)
- viewBox(14,6," ","PM")
- term.setCursorPos(14,7)
- local temp = fs.list(device)
- local i = 1
- local j = 0
- local w = true
- while w do
- if (i-j) == 5 then
- j = j + 4
- viewBox(14,6," ","PM")
- end
- term.setCursorPos(14, (6+i-j))
- if fs.isDir(temp[i]) then
- if fs.isReadOnly(temp[i]) then
- term.setBackgroundColor(colors.red)
- print(i..". "..temp[i].." >>")
- else
- term.setTextColour(colors.green)
- print(i..". "..temp[i].." >>")
- end
- term.setBackgroundColor(colors.lightGray)
- else
- term.setTextColour(colors.white)
- print(i..". "..temp[i])
- end
- term.setTextColour(colors.white)
- sleep(0.25)
- i = i + 1
- if i == #temp then
- w = false
- end
- end
- sleep(0.5)
- viewBox(14,6," ","PM")
- term.setCursorPos(14,7)
- print("[C]MD [E]xit [S]hell")
- local w = true
- while w do
- term.setCursorPos(14,8)
- selection = read()
- if selection == "C" or selection == "C" then
- term.setCursorPos(20,9)
- shell.run(".CMD")
- break
- elseif selection == "S" or selection == "s" or selection == "" then
- shell.run("fg")
- break
- elseif selection == "E" or selection == "e" then
- break
- end
- end
- end
- local function DF(side)
- term.setCursorPos(14,7)
- print("Disk found on "..side.." side")
- term.setCursorPos(14,8)
- if fs.exists("disk/init") then
- print("Read? [Y/N]")
- term.setCursorPos(27, 8)
- if read() == "Y" then
- MAIN("disk")
- else
- MAIN("")
- end
- else
- sleep(1)
- term.setCursorPos(14,8)
- print("Disk is unformated")
- term.setCursorPos(14,9)
- print("Format? [Y/N]")
- term.setCursorPos(28,9)
- t = read()
- if t == "Y" or t == "y" then
- term.setCursorPos(14,8)
- print("Formating...")
- shell.run("bg","cp",".DFT","disk/init")
- else
- MAIN("")
- end
- end
- end
- DD = false
- viewBox(14,6," ","PM")
- if disk.isPresent("right") then
- DF("right")
- DD = true
- end
- if disk.isPresent("left") then
- DF("left")
- DD = true
- end
- if disk.isPresent("top") then
- DF("top")
- DD = true
- end
- if disk.isPresent("bottom") then
- DF("bottom")
- DD = true
- end
- if disk.isPresent("front") then
- DF("front")
- DD = true
- end
- if disk.isPresent("back") then
- DF("back")
- DD = true
- end
- if DD == false then
- MAIN("")
- end
Add Comment
Please, Sign In to add comment