Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------- Библиотеки -------------------------------------------
- local event = require('event')
- local term = require('term')
- local shell = require("shell")
- local component = require("component")
- local unicode = require("unicode")
- local gpu = component.gpu
- lc={}
- ------------------------------------------- Переменные -------------------------------------------
- --Массив с программами, которые необходимо загрузить. Первый элемент - ссылка на файл, второй - путь для сохранения файла.
- local applications={'panel','robotCrafter',"robotSorter"}
- app={['panel']={{ "0yc5NB0G", "panel" },{ "Akt7jDXR", "logs.txt" },{ "MvrFgKsE", "bcr.txt" }},
- ['robotCrafter']={{ "8BbAr8gE", "ru" },{ "QtgZyJph", "craftNames.txt" },{ "Hu0yDzLp", "chests.txt" },{ "kNZzGeHS", "robot"},{ "CFvPGRYJ", "creator"}},
- ["robotSorter"]={{"kYKGGj7K","su"},{"N2ErsAEA","sorter"},{"5wSG22Z3","creator2"}}}
- bun1={'Select file ',' Exit '}
- men5=2 men6=4 plk='▌' abl={}
- local b1={"╔═══════════════════════════╗",' Add chest',' Add craft','Chest list',' Delete ',' Exit ','╚═══════════════════════════╝'}
- function getxy() _,_,_,k2,_=event.pull('key_up') return k2 end
- function pal6(men6) if men6==1 then term.setCursor(13,16) io.write(plk) elseif men6==2 then term.setCursor(25,16) io.write(plk) elseif men6==3 then term.setCursor(30,16) io.write(plk) elseif men6==4 then term.setCursor(45,16) io.write(plk) end end
- function pal4(men5) if men5==1 then gpu.set(32,4,plk) gpu.set(32,5,plk) gpu.set(32,6,plk) elseif men5==2 then gpu.set(32,7,plk) gpu.set(32,8,plk) gpu.set(32,9,plk) end end
- function helps() gpu.set(34,1,'▬▬▬▬▬[Help]▬▬▬▬▬') gpu.set(34,2,'Для перемещения ') gpu.set(34,3,'по меню исполь- ') gpu.set(34,4,'зуйте стрелки. ') gpu.set(34,5,'Выбрать: Enter .') gpu.set(34,6,'▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬') gpu.set(34,7,'Программа созда-') gpu.set(34,8,'на для личного ') gpu.set(34,9,'пользования. ') gpu.set(34,10,'[Авторы]: ') gpu.set(34,11,' MeXaN1cK ') gpu.set(34,12,'PandaDoddo72rus') gpu.set(34,13,' (vah) ') gpu.set(34,14,'▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬') gpu.set(34,15,' |hil.su| ') gpu.set(34,16,'▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬') end
- function selectFile()
- et2=true
- while et2 do
- term.clear() helps() pal4(men5) term.setCursor(1,4) for i=1,2 do print(b1[1]) print('║ '.. bun1[i] ..' ║') print(b1[7]) end p2=getxy()
- if p2==200 then men5=men5-1 if men5<1 then men5=1 end
- elseif p2==208 then men5=men5+1 if men5>2 then men5=2 end
- elseif p2==28 then
- if men5==1 then term.clear() for i=1,#applications do abl[i]=applications[i] end page1=1 k1=1 j1=14 et1=true oldPage1=0 et2=false
- while et1 do
- gpu.fill(1,15,50,2,' ') term.setCursor(2,16) io.write('Page: ',page1) term.setCursor(14,16) io.write('<Back|Next>') term.setCursor(46,16) io.write('Exit') term.setCursor(31,16) io.write('Select[#]') pal6(men6) term.setCursor(1,1)
- if oldPage1 ~= page1 then
- gpu.fill(1,1,50,14,' ')
- for i=k1,j1 do
- os.sleep(0.000001)
- if applications[#applications]~=nil then
- if applications[i]~=nil then
- ab2='['..i..']'..'["'..abl[i]..'"]'
- print(ab2)
- end oldPage1=page1 else term.setCursor(15,7) io.write('Пусто!') break
- end end end p2=getxy()
- if p2==203 then men6=men6-1 if men6<1 then men6=1 end
- elseif p2==205 then men6=men6+1 if men6>4 then men6=4 end elseif p2==28 then
- if men6==1 then if k1~=1 then k1=k1-14 j1=j1-14 page1=page1-1 end
- elseif men6==2 then k1=k1+14 j1=j1+14 page1=page1+1 elseif men6==3 then
- gpu.fill(1,16,50,1,' ') term.setCursor(1,16) io.write('Position: > ') lc[#lc+1]=tonumber(io.read()) getxy() et2=false
- elseif men6==4 then term.clear() downloadWindow() et1=false end end end
- elseif men5==2 then term.clear() os.exit() end end
- end end
- --Окно загрузки
- function downloadWindow()
- name='[Loader]: '
- print(name..'Downloading is started!')
- for j=1,#lc do
- i=lc[j]
- arr=applications[i]
- if arr==applications[1] then
- for k=1,#app[arr] do
- print(name..'Download: '..app[arr][k][1])
- shell.execute("pastebin get " .. app[arr][k][1] .. " " .. app[arr][k][2] )
- print(name..'File is download: '..app[arr][k][1]..' !')
- end
- end
- end
- for j=1,#lc do
- i=lc[j]
- arr=applications[i]
- if arr==applications[2] then
- for k=1,#app[arr] do
- print(name..'Download: '..app[arr][k][1])
- shell.execute("pastebin get " .. app[arr][k][1] .. " " .. app[arr][k][2] )
- print(name..'File is download: '..app[arr][k][1]..' !')
- end
- shell.execute("creator") shell.execute("del creator")
- end
- end
- for j=1,#lc do
- i=lc[j]
- arr=applications[i]
- if arr==applications[3] then
- for k=1,#app[arr] do
- print(name..'Download: '..app[arr][k][1])
- shell.execute("pastebin get " .. app[arr][k][1] .. " " .. app[arr][k][2] )
- print(name..'File is download: '..app[arr][k][1]..' !')
- end
- shell.execute("creator2") shell.execute("del creator2")
- end
- end
- print(name..'Downloading completed!')
- end
- ------------------------------------------- Программа -------------------------------------------
- --downloadWindow()
- getxy()
- while true do selectFile() end
Add Comment
Please, Sign In to add comment