MeXaN1cK

Launcher(Main)

Mar 31st, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.46 KB | None | 0 0
  1. ------------------------------------------- Библиотеки -------------------------------------------
  2. local event = require('event')
  3. local term = require('term')
  4. local shell = require("shell")
  5. local component = require("component")
  6. local unicode = require("unicode")
  7. local gpu = component.gpu
  8. lc={}
  9. ------------------------------------------- Переменные -------------------------------------------
  10.  
  11. --Массив с программами, которые необходимо загрузить. Первый элемент - ссылка на файл, второй - путь для сохранения файла.
  12. local applications={'panel','robotCrafter',"robotSorter"}
  13. app={['panel']={{ "0yc5NB0G", "panel" },{ "Akt7jDXR", "logs.txt" },{ "MvrFgKsE", "bcr.txt" }},
  14. ['robotCrafter']={{ "8BbAr8gE", "ru" },{ "QtgZyJph", "craftNames.txt" },{ "Hu0yDzLp", "chests.txt" },{ "kNZzGeHS", "robot"},{ "CFvPGRYJ", "creator"}},
  15. ["robotSorter"]={{"kYKGGj7K","su"},{"N2ErsAEA","sorter"},{"5wSG22Z3","creator2"}}}
  16.  
  17. bun1={'Select file ','    Exit    '}
  18. men5=2 men6=4 plk='▌' abl={}
  19. local b1={"╔═══════════════════════════╗",' Add chest',' Add craft','Chest list','  Delete  ','   Exit   ','╚═══════════════════════════╝'}
  20. function getxy() _,_,_,k2,_=event.pull('key_up') return k2 end
  21. 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
  22. 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
  23. 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
  24. function selectFile()
  25.  et2=true
  26. while et2 do
  27. 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()
  28. if p2==200 then men5=men5-1 if men5<1 then men5=1 end
  29. elseif p2==208 then men5=men5+1 if men5>2 then men5=2 end
  30. elseif p2==28 then
  31. 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
  32. while et1 do
  33. 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)
  34. if oldPage1 ~= page1 then
  35. gpu.fill(1,1,50,14,' ')
  36. for i=k1,j1 do
  37. os.sleep(0.000001)
  38. if applications[#applications]~=nil then
  39. if applications[i]~=nil then
  40. ab2='['..i..']'..'["'..abl[i]..'"]'
  41. print(ab2)
  42. end oldPage1=page1 else term.setCursor(15,7) io.write('Пусто!') break
  43. end end end p2=getxy()
  44. if p2==203 then men6=men6-1 if men6<1 then men6=1 end
  45. elseif p2==205 then men6=men6+1 if men6>4 then men6=4 end elseif p2==28 then
  46. if men6==1 then if k1~=1 then k1=k1-14 j1=j1-14 page1=page1-1 end
  47. elseif men6==2 then k1=k1+14 j1=j1+14 page1=page1+1 elseif men6==3 then
  48. gpu.fill(1,16,50,1,' ') term.setCursor(1,16) io.write('Position: > ') lc[#lc+1]=tonumber(io.read()) getxy() et2=false
  49. elseif men6==4 then term.clear() downloadWindow() et1=false end end end
  50. elseif men5==2 then term.clear() os.exit() end end
  51. end end
  52.  
  53.  
  54. --Окно загрузки
  55. function downloadWindow()
  56. name='[Loader]: '
  57. print(name..'Downloading is started!')
  58.     for j=1,#lc do
  59.     i=lc[j]
  60.     arr=applications[i]
  61.     if arr==applications[1] then
  62.     for k=1,#app[arr] do
  63.     print(name..'Download: '..app[arr][k][1])
  64.     shell.execute("pastebin get " .. app[arr][k][1] .. " " .. app[arr][k][2] )
  65.     print(name..'File is download: '..app[arr][k][1]..' !')
  66.     end  
  67.     end
  68.     end
  69.     for j=1,#lc do
  70.     i=lc[j]
  71.     arr=applications[i]
  72.     if arr==applications[2] then   
  73.     for k=1,#app[arr] do
  74.     print(name..'Download: '..app[arr][k][1])
  75.     shell.execute("pastebin get " .. app[arr][k][1] .. " " .. app[arr][k][2] )
  76.     print(name..'File is download: '..app[arr][k][1]..' !')
  77.     end    
  78.     shell.execute("creator") shell.execute("del creator")
  79.     end
  80.     end
  81.     for j=1,#lc do
  82.     i=lc[j]
  83.     arr=applications[i]
  84.     if arr==applications[3] then
  85.     for k=1,#app[arr] do
  86.     print(name..'Download: '..app[arr][k][1])
  87.     shell.execute("pastebin get " .. app[arr][k][1] .. " " .. app[arr][k][2] )
  88.     print(name..'File is download: '..app[arr][k][1]..' !')
  89.     end  
  90.     shell.execute("creator2") shell.execute("del creator2")
  91.     end
  92.     end
  93.     print(name..'Downloading completed!')
  94. end
  95. ------------------------------------------- Программа -------------------------------------------
  96.  
  97. --downloadWindow()
  98. getxy()
  99. while true do selectFile() end
Add Comment
Please, Sign In to add comment