Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CLAYMORE FILE MANAGER (C) lego11 2020 - An ATARI GEM Product
- basedir = "/data"
- local register = {}
- function clear()
- term.clear()
- term.setCursorPos(1, 1)
- end
- function colore(colore) term.setTextColor(colore) end
- function sfondo(colore) term.setBackgroundColor(colore) end
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1,16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2^(n-1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- e_livsup = false
- function lista_dir(dir)
- e_livsup = false
- sfondo(colors.lightGray)
- clear()
- sfondo(colors.gray)
- colore(colors.white)
- print(" ")
- term.setCursorPos(1, 1)
- term.write(dir .. " - Claymore")
- term.setCursorPos(49, 1)
- sfondo(colors.lightBlue)
- term.write("?")
- term.setCursorPos(51, 1)
- sfondo(colors.red)
- term.write("X")
- local tab_f = fs.list(dir)
- sfondo(colors.black)
- local x = 2
- local y = 3
- if dir ~= basedir then
- e_livsup = true
- term.setCursorPos(x, y)
- sfondo(colors.yellow)
- colore(colors.red)
- term.write("Liv. sup.")
- x = x + 17
- end
- for key, value in pairs(tab_f) do
- for i=x, x+#value do
- register[tostring(i).." "..tostring(y)] = dir .. "/" .. value
- end
- if fs.isDir(dir .. "/" .. value .. "/") == true then
- term.setCursorPos(x, y)
- sfondo(colors.lime)
- colore(colors.black)
- x = x + 17
- term.write(value)
- else
- term.setCursorPos(x, y)
- sfondo(colors.lightBlue)
- colore(colors.black)
- x = x + 17
- term.write(value)
- end
- if x > 45 then
- x = 2
- y = y + 2
- end
- end
- end
- local dir = basedir
- local prevdir = basedir
- while true do
- lista_dir(dir)
- local event, par1, par2, par3 = os.pullEvent()
- if event == "mouse_click" then
- if par3 == 1 and par2 == 51 then
- sfondo(colors.black)
- colore(colors.white)
- clear()
- break
- elseif par3 == 1 and par2 == 49 then
- drawFilledBox(12, 5, 39, 15, colors.white)
- term.setCursorPos(12, 5)
- sfondo(colors.gray)
- colore(colors.white)
- term.write("A proposito di Claymore ")
- sfondo(colors.red)
- term.setCursorPos(39, 5)
- term.write("X")
- colore(colors.black)
- sfondo(colors.white)
- term.setCursorPos(13, 7)
- term.write("Copyright (C) 2020 lego11")
- term.setCursorPos(13, 8)
- term.write("Sole Microsistemi S.p.A.")
- term.setCursorPos(13, 9)
- term.write("Tutti i diritti riservati")
- colore(colors.red)
- term.setCursorPos(13, 10)
- term.write("Alba gu brร th!")
- colore(colors.black)
- term.setCursorPos(13, 12)
- term.write(" [")
- term.setCursorPos(13, 13)
- term.write("@====[{::::::::::::::::::>")
- term.setCursorPos(13, 14)
- term.write(" [")
- while true do
- local event, par1, par2, par3 = os.pullEvent()
- if event == "key" and par1 == 28 then
- break
- elseif event == "mouse_click" and par3 == 5 and par2 == 39 then
- break
- end
- end
- elseif e_livsup == true and par3 == 3 and par2 < 17 and par2 > 2 then
- dir = string.match(dir, "^(.*)/")
- else
- if register[tostring(par2).." "..tostring(par3)] ~= nil then
- if fs.isDir(dir .. "/" .. register[tostring(par2).." "..tostring(par3)]) == true then
- print(dir .. "/" .. register[tostring(par2).." "..tostring(par3)])
- sleep(0.1)
- dir = register[tostring(par2).." "..tostring(par3)]
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement