SHOW:
|
|
- or go back to the newest paste.
| 1 | rednet.open("top")
| |
| 2 | ||
| 3 | --HASH MUST MATCH SENDER HASH, OTHERWISE FILES WILL FAIL TO SEND | |
| 4 | hash = "HASH" | |
| 5 | ||
| 6 | term.clear() | |
| 7 | term.setCursorPos(1,1) | |
| 8 | print("Getting Files...")
| |
| 9 | ||
| 10 | while true do | |
| 11 | id, ftconfirm = rednet.receive() | |
| 12 | if ftconfirm == hash then | |
| 13 | id2, filename = rednet.receive() | |
| 14 | if filename == "startup" or filename == "startup.lua" then | |
| 15 | print() | |
| 16 | print("Startup received. Change name & save, delete, or save as startup?")
| |
| 17 | write("save,delete,override?")
| |
| 18 | savearg = input() | |
| 19 | if savearg == "save" then | |
| 20 | write("File Name?: ")
| |
| 21 | newname = input() | |
| 22 | f = fs.open(newname, "w") | |
| 23 | id3, filedata = rednet.receive() | |
| 24 | f.write(filedata) | |
| 25 | f.close() | |
| 26 | os.reboot() | |
| 27 | if savearg == "delete" then | |
| 28 | os.reboot() | |
| 29 | end | |
| 30 | if savearg == "override" then | |
| 31 | end | |
| 32 | else | |
| 33 | f = fs.open(filename, "w") | |
| 34 | id3, filedata = rednet.receive() | |
| 35 | f.write(filedata) | |
| 36 | f.close() | |
| 37 | print() | |
| 38 | print("File "..filename.." received! Sent by: "..id)
| |
| 39 | end | |
| 40 | end | |
| 41 | end |