Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Download Manager for cawOS 2.0
- --load api
- os.loadAPI("caAPI")
- --set monitor
- function set_monitor()
- local monitor_number = caAPI.get_hardware("monitor")
- local found = fs.exists("config/monitor.cfg")
- if found == true then
- file = fs.open("config/monitor.cfg","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- monitor_number = fileData[1]
- radio_number = fileData[3]
- end
- mon = peripheral.wrap(monitor_number)
- end
- --download
- function download(name,id)
- mon.setCursorPos(3,22)
- mon.write("Start Download")
- sleep(1)
- mon.setCursorPos(3,23)
- shell.run("delete "..name)
- shell.run("pastebin get "..id.." "..name)
- sleep(1)
- draw_screen()
- end
- --uninstall
- function delete(name)
- mon.setCursorPos(3,22)
- mon.write("Uninstall Programm")
- sleep(1)
- mon.setCursorPos(3,23)
- shell.run("delete "..name)
- sleep(1)
- draw_screen()
- end
- --enter paste
- function past()
- mon.setCursorPos(3,22)
- mon.write("Input Pastebin Code:")
- id = read()
- mon.setCursorPos(3,23)
- mon.write("Input ProgramName:")
- name = read()
- sleep(1)
- mon.setCursorPos(3,23)
- download(name,id)
- end
- --draw screen
- function draw_screen()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.white)
- mon.clear()
- mon.setBackgroundColor(colors.white)
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.blue)
- mon.write("Program Download Manager 1.0 ")
- mon.setCursorPos(50,1)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.black)
- mon.write("X")
- mon.setCursorPos(1,3)
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.black)
- mon.write(" ")
- mon.setCursorPos(1,26)
- mon.write(" ")
- mon.setCursorPos(1,5)
- mon.write(" ")
- for yi = 4,25 do
- mon.setCursorPos(1,yi)
- mon.write(" ")
- mon.setCursorPos(50,yi)
- mon.write(" ")
- yi = yi + 1
- end
- mon.setCursorPos(3,4)
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.write("Name")
- mon.setCursorPos(26,4)
- mon.write("Genere")
- mon.setCursorPos(42,4)
- mon.write("State")
- mon.setCursorPos(2,2)
- mon.setTextColor(colors.green)
- mon.write("Download with Pastebin code")
- mon.setTextColor(colors.black)
- --list
- mon.setCursorPos(3,6)
- mon.write("Open FM Radio")
- mon.setCursorPos(26,6)
- mon.write("Audio")
- mon.setCursorPos(3,7)
- mon.write("Command Remote")
- mon.setCursorPos(26,7)
- mon.write("Control")
- mon.setCursorPos(3,8)
- mon.write("Train Control")
- mon.setCursorPos(26,8)
- mon.write("Control")
- mon.setCursorPos(3,9)
- mon.write("Cable Remote")
- mon.setCursorPos(26,9)
- mon.write("Control")
- mon.setCursorPos(3,10)
- mon.write("Stargate")
- mon.setCursorPos(26,10)
- mon.write("Play")
- mon.setCursorPos(3,11)
- mon.write("Nitrosoft Games")
- mon.setCursorPos(26,11)
- mon.write("Games")
- mon.setCursorPos(3,12)
- mon.write("FileManager")
- mon.setCursorPos(26,12)
- mon.write("Office")
- mon.setCursorPos(3,13)
- mon.write("NPaintTurtle")
- mon.setCursorPos(26,13)
- mon.write("3D Print")
- mon.setCursorPos(3,14)
- mon.write("NPaintPro")
- mon.setCursorPos(26,14)
- mon.write("Office/3D Print")
- mon.setCursorPos(3,15)
- mon.write("BigReactor Control")
- mon.setCursorPos(26,15)
- mon.write("Control")
- mon.setCursorPos(3,16)
- mon.write("BigReactor Status")
- mon.setCursorPos(26,16)
- mon.write("Info")
- mon.setCursorPos(3,17)
- mon.write("SteelTank Status")
- mon.setCursorPos(26,17)
- mon.write("Info")
- mon.setCursorPos(3,18)
- mon.write("ME Bridge")
- mon.setCursorPos(26,18)
- mon.write("Info")
- mon.setCursorPos(3,19)
- mon.write("Energy Cell")
- mon.setCursorPos(26,19)
- mon.write("Info")
- mon.setCursorPos(3,20)
- mon.write("Mekanism Reactor")
- mon.setCursorPos(26,20)
- mon.write("Control")
- --state
- fDir = shell.programs()
- programs = {}
- for i=1,#fDir do
- if(fDir[i] == "Radio") or (fDir[i] == "Command_Remote") or (fDir[i] == "Train_Control") or (fDir[i] == "Cable_Remote") or (fDir[i] == "Stargate") or (fDir[i] == "Nitrosoft_Games") or (fDir[i] == "FileManager") or (fDir[i] == "NPaintTurtle") or (fDir[i] == "NPaintPro") or (fDir[i] == "BigReactor_Control") or (fDir[i] == "BigReactor_Status") or (fDir[i] == "SteelTank_Status") or (fDir[i] == "ME_Bridge") or (fDir[i] == "Energy_Cell") or (fDir[i] == "Mekanism_Reactor")then
- table.insert(programs, fDir[i])
- end
- end
- mon.setCursorPos(41,6)
- if caAPI.in_table(programs, "Radio") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,6)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,7)
- if caAPI.in_table(programs, "Command_Remote") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,7)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,8)
- if caAPI.in_table(programs, "Train_Control") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,8)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,9)
- if caAPI.in_table(programs, "Cable_Remote") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,9)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,10)
- if caAPI.in_table(programs, "Stargate") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,10)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,11)
- if caAPI.in_table(programs, "Nitrosoft_Games") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,11)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,12)
- if caAPI.in_table(programs, "FileManager") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,12)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,13)
- if caAPI.in_table(programs, "NPaintTurtle") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,13)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,14)
- if caAPI.in_table(programs, "NPaintPro") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,14)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,15)
- if caAPI.in_table(programs, "BigReactor_Control") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,15)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,16)
- if caAPI.in_table(programs, "BigReactor_Status") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,16)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,17)
- if caAPI.in_table(programs, "SteelTank_Status") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,17)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,18)
- if caAPI.in_table(programs, "ME_Bridge") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,18)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,19)
- if caAPI.in_table(programs, "Energy_Cell") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,19)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- mon.setCursorPos(41,20)
- if caAPI.in_table(programs, "Mekanism_Reactor") == true then
- mon.setTextColor(colors.red)
- mon.write("Update")
- mon.setCursorPos(2,20)
- mon.write("X")
- else
- mon.setTextColor(colors.green)
- mon.write("Download")
- end
- --end
- touch()
- end
- function touch()
- db_power = true
- while db_power == true do
- event,side,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if x == 50 and y == 1 then
- db_power = false
- shell.run("clear")
- end
- if y == 2 then
- db_power = false
- past()
- end
- if x == 2 and y == 6 then
- delete("Radio")
- end
- if y == 6 then
- db_power = false
- download("Radio","j5ZUCFLA")
- end
- if x == 2 and y == 7 then
- delete("Command_Remote")
- end
- if y == 7 then
- db_power = false
- download("Command_Remote","QVwJs5kw")
- end
- if x == 2 and y == 8 then
- delete("Train_Control")
- end
- if y == 8 then
- db_power = false
- download("Train_Control","vXs3xKVK")
- end
- if x == 2 and y == 9 then
- delete("Cable_Remote")
- end
- if y == 9 then
- db_power = false
- download("Cable_Remote","1Uj9ttEB")
- end
- if x == 2 and y == 10 then
- delete("Stargate")
- end
- if y == 10 then
- db_power = false
- download("Stargate","m7iwSETt")
- end
- if x == 2 and y == 11 then
- delete("Nitrosoft_Games")
- end
- if y == 11 then
- db_power = false
- download("Nitrosoft_Games","KZsuv1pc")
- end
- if x == 2 and y == 12 then
- delete("FileManager")
- end
- if y == 12 then
- db_power = false
- download("FileManager","CTrCeDBt")
- end
- if x == 2 and y == 13 then
- delete("NPaintTurtle")
- end
- if y == 13 then
- db_power = false
- download("NPaintTurtle","tzw1Sw78")
- end
- if x == 2 and y == 14 then
- delete("NPaintPro")
- end
- if y == 14 then
- db_power = false
- download("NPaintPro","pzWSRqNF")
- end
- if x == 2 and y == 15 then
- delete("BigReactor_Control")
- end
- if y == 15 then
- db_power = false
- download("BigReactor_Control","0Jru5EvU")
- end
- if x == 2 and y == 16 then
- delete("BigReactor_Status")
- end
- if y == 16 then
- db_power = false
- download("BigReactor_Status","exMX8gSW")
- end
- if x == 2 and y == 17 then
- delete("SteelTank_Status")
- end
- if y == 17 then
- db_power = false
- download("SteelTank_Status","4d0WZkrZ")
- end
- if x == 2 and y == 18 then
- delete("ME_Bridge")
- end
- if y == 18 then
- db_power = false
- download("ME_Bridge","DVD7pcce")
- end
- if x == 2 and y == 19 then
- delete("Energy_Cell")
- end
- if y == 19 then
- db_power = false
- download("Energy_Cell","QYx2d1be")
- end
- if x == 2 and y == 20 then
- delete("Mekanism_Reactor")
- end
- if y == 20 then
- db_power = false
- download("Mekanism_Reactor","LSd82qiF")
- end
- end
- end
- end
- --start program
- set_monitor()
- draw_screen()
Add Comment
Please, Sign In to add comment