c# - Overwriting local files with remote files causes Unity Standalone Application To Freeze -
i developer using unity game engine trying overwrite local files files ftp server. using system.io.file.writeallbytes function so.
when start application , trigger code has been updated, application freeze.
in windows form, code arrives here, uses webclient instance download file, , overwrites if larger local file:
public void downloadfile (webclient webclient, string urladdress, string location, byte[] localfile) { webclient.proxy = null; webclient.credentials = new networkcredential("<user>", "<pass>"); byte[] filedata = webclient.downloaddata("ftp://"+ urladdress); /* * download if bytes of remote file * larger bytes of local file */ if (filedata.length > localfile.length) { file.writeallbytes(location, filedata); } }
using filestream causes application freeze well.
filestream _filestream = new filestream(location, filemode.create, fileaccess.write); _filestream.write(filedata, 0, filedata.length); _filestream.close();
and tried writing files needed updating temporary folder, , using file.copy
what suppose doing overwrite files?
Comments
Post a Comment