FILENET-SEND FILES OVER REDNET
Introduction
This a new version of my file transfer api for rednet. The first one was pretty crappy and this one is probably crappy too but yet much better than the first one.
The new version is 1.0 and has a lot more functions than the old one ! (see functions section)
You can (wow..surprise) send /receive files but also blacklist spezial computrer IDs. Any file sent by these computers will be ignored by the receiver.(You can unlock those IDs aswell if you trust them again)
The thing I am most proud of(although it may be fairly easy for others) is the new ASyncReceiveFile() function. This function runs completely in background and won´t block any other functions of your program
Normally if you do this:
tbl={ rednet.receive()}
print("Hello World")
It would stop at :
And print "Hello World" only after a rednet message came in !
With ASyncReceiveFile() , "Hello World" will be printed immidiately . For those people who do not need this function there is a normal receiveFile() that works just like rednet.receive().
The receive function does only return the senderID because everything else is handled automatically(message is written to file,protocol is used internally, distance isn´t used anymore)
Functions
Spoiler
function openSide()
function getVersion()
function blacklist(id)
function removeBlacklist(id)
function sendFile(path,receiverID)
function broadcastFile(path)
function ASyncReceiveFile(path,timeout,override) --override is a bool ; when true the file that is getting received overwrites the existing file with the given name;
function receiveFile(path,timeout,override) --override is a bool ; when true the file that is getting received overwrites the existing file with the given name;
The spezial thing about ASyncReceive is, that it does not stop the program and listens for messages . So the user can use the program just as normal and the message is received in background !As always, the used code is no masterpiece at all and I am sure there many other solutions that may be even better :)/>
In Minecraft type : pastebin get uh4scAu1 filenet
If there are any bugs please report them !
Hope you like it !
mfG Kouksi44