asteroidsteam icon

AntiFile

asteroidsteam | PRO | 10/29/17 07:06:47 PM UTC | 0 ⭐ | 509 👁️ | Never ⏰ | []
Lua |

2.25 KB

|

None

|

0 👍

/

0 👎

term.setCursorPos(1,1)
  term.setBackgroundColor(colors.cyan)
  term.clear()
  term.setCursorPos(1,1)
  term.setBackgroundColor(colors.red)
  term.clearLine()
  term.setCursorPos(1,1)
  term.setTextColor(colors.white)
  write("JOS AntiFile 1.1.2")
function getFiles() 
  return fs.list("/")
end
function displayFiles()
  term.setCursorPos(1,1)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,2)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,3)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,4)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,5)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,6)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,7)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,8)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
term.setCursorPos(1,9)
  term.setBackgroundColor(colors.cyan)
  term.clearLine()
  term.setCursorPos(1,1)
  term.setBackgroundColor(colors.red)
  term.clearLine()
  term.setCursorPos(1,1)
  term.setTextColor(colors.white)
  write("JOS AntiFile 1.1.2")
  term.setTextColor(colors.orange)
  term.setCursorPos(1,2)
  index = getFiles()
  for i = 1, #index do
    if (fs.isDir(index[i])) then
      term.setBackgroundColor(colors.green)
      write(index[i].." ")
    else
      term.setBackgroundColor(colors.blue)
      write(index[i].." ")
    end
  end
  term.setBackgroundColor(colors.cyan)
end
function remFile(file)
  if (fs.exists(file)) then
    fs.delete(file)
    return true
  else
    return false
  end
end
local x,y = term.getSize()
while true do
  displayFiles()
  term.setCursorPos(1,math.floor(y-1))
  term.clearLine()
  term.setTextColor(colors.orange)
  write("$ ")
  term.setTextColor(colors.red)
  input = read()
  if (input == "reboot") then
    disk.eject("right")
    os.reboot()
  else
    if (remFile(input)) then
      term.setCursorPos(1,y)
      write("Successfully Deleted file!")
    else
      term.setCursorPos(1,y)
      term.clearLine()
      term.setCursorPos(1,y)
      write("Error deleting File!")
    end
  end
end

Comments