Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.setDir("/")
- version = "Static 1.1"
- while true do
- shell.setDir("/")
- listItems = fs.list(shell.dir())
- function Blank()
- term.setBackgroundColor(colors.white)
- term.clear()
- end
- function info(item)
- term.setCursorPos(1,6)
- for i=6,13 do
- term.setCursorPos(1,i)
- term.clearLine()
- end
- term.setCursorPos(1,6)
- print("Info Bar Coming Soon!")
- end
- function periphs()
- local tPeri = {}
- for i,v in pairs(peripheral.getNames()) do
- table.insert(tPeri,peripheral.getType(v))
- end
- return table.concat(tPeri, "|")
- end
- function newItem(x, y, text)
- term.setCursorPos(x, y)
- term.write(text)
- end
- function exists(number)
- if listItems[number] ~= nil then
- return true else return false end
- end
- -- Variables
- Blank()
- maxX, maxY = term.getSize()
- curItem = 1
- table.insert(listItems,1,"edit")
- table.insert(listItems,"New File")
- -- Main Functions
- function Update()
- term.clear()
- paintutils.drawLine(1,4, maxX, 4, colors.red)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(4,2)
- if exists(curItem -3) then
- if fs.isDir(shell.dir().."/"..listItems[curItem - 3]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem - 3].." ")
- else
- end
- if exists(curItem - 2) then
- if fs.isDir(shell.dir().."/"..listItems[curItem - 2]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem - 2].." ")
- else
- end
- if exists(curItem - 1) then
- if fs.isDir(shell.dir().."/"..listItems[curItem - 1]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem - 1].." ")
- else
- end
- if exists(curItem) then
- if fs.isDir(shell.dir().."/"..listItems[curItem]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.setBackgroundColor(colors.gray)
- term.write(listItems[curItem].." ")
- term.setBackgroundColor(colors.white)
- end
- if exists(curItem + 1) then
- if fs.isDir(shell.dir().."/"..listItems[curItem + 1]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 1].." ")
- end
- if exists(curItem + 2) then
- if fs.isDir(shell.dir().."/"..listItems[curItem + 2]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 2].." ")
- end
- if exists(curItem + 3) then
- if fs.isDir(shell.dir().."/"..listItems[curItem + 3]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 3].." ")
- end
- if curItem == 1 and exists(curItem + 4) and exists(curItem + 5) and exists(curItem + 6) then
- if fs.isDir(shell.dir().."/"..shell.dir().."/"..listItems[curItem + 4]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 4].." ")
- if fs.isDir(shell.dir().."/"..shell.dir().."/"..listItems[curItem + 5]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 5].." ")
- if fs.isDir(shell.dir().."/"..shell.dir().."/"..listItems[curItem + 6]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 6].." ")
- end
- if curItem == 2 and exists(curItem + 4) and exists(curItem + 5) then
- if fs.isDir(shell.dir().."/"..shell.dir().."/"..listItems[curItem + 4]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 4].." ")
- if fs.isDir(shell.dir().."/"..shell.dir().."/"..listItems[curItem + 5]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 5].." ")
- end
- if curItem == 3 and exists(curItem + 4) then
- if fs.isDir(shell.dir().."/"..listItems[curItem + 4]) then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.black)
- end
- term.write(listItems[curItem + 4].." ")
- end
- term.setTextColor(colors.black)
- term.setCursorPos(1,6)
- print("ID : "..os.getComputerID())
- term.setCursorPos(1,8)
- print("Connected Peripherals : ")
- print(periphs())
- term.setCursorPos(1,10)
- print("Version : "..version)
- term.setCursorPos(1,12)
- print("Files/Folders : "..#listItems)
- end
- function List()
- repeat
- event, key = os.pullEvent("key")
- if key == 205 or key == 32 then
- curItem = curItem + 1
- if curItem > #listItems then
- curItem = #listItems
- Update()
- end
- Update()
- elseif key == 203 or key == 30 then
- curItem = curItem - 1
- if curItem < 1 then
- curItem = 1
- Update()
- end
- Update()
- end
- until key == 28 or key == 210 or key == 14 or key == 211
- if key == 28 then
- Info()
- elseif key == 210 then
- shell.run("edit "..listItems[curItem])
- elseif key == 14 then
- shell.setDir("/")
- listItems = fs.list("/")
- elseif key == 211 then
- fs.delete(listItems[curItem])
- end
- end
- function Info()
- info(shell.dir().."/"..listItems[curItem])
- local event, key = os.pullEvent("key")
- if key == keys.enter then
- if listItems[curItem] ~= "New File" then
- if fs.isDir(shell.dir().."/"..listItems[curItem]) == false then
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.black)
- term.write("Arguments :")
- term.setTextColor(colors.red)
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,2)
- term.clearLine()
- term.setCursorPos(1,4)
- term.clearLine()
- term.setCursorPos(1,6)
- term.clearLine()
- term.setCursorPos(1,2)
- local arg1 = read()
- term.setCursorPos(1,4)
- local arg2 = read()
- term.setCursorPos(1,6)
- local arg3 = read()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1,1)
- term.clear()
- shell.run(listItems[curItem],arg1,arg2,arg3)
- os.pullEvent()
- else
- shell.setDir(shell.dir().."/"..listItems[curItem])
- listItems = fs.list(shell.dir())
- curItem = 1
- Update()
- List()
- end
- else
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- term.write("File Name :")
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.gray)
- term.clearLine()
- term.setTextColor(colors.red)
- local input = read()
- shell.run("edit "..input)
- end
- end
- Update()
- List()
- end
- Update()
- List()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement