Created
June 28, 2014 03:51
-
-
Save hawksprite/2b83bec62f4f9416b1b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Thread downloadFileThread; | |
void DownloadDatFile() | |
{ | |
// The class is inherinty async so you don't need to put it in a thread, but if you want to monitor the progress | |
// in a "Snappy" manor in something like unity without worrying about the possible frame cap to disrupt thing from the Update callback | |
// then just use this setup to monitor it with a standard .NET thread | |
downloadFileThread = new Thread(new ThreadStart(threadDownloadDatFile)); | |
downloadFileThread.Start(); | |
} | |
void threadDownloadDatFile() | |
{ | |
Downloader downloader = new Downloader(); | |
downloader.Start("http://google.com", "index.html"); | |
while (!downloader.Finished) | |
{ | |
// Progress check | |
float progress = downloader.Progress; // 0.0 - 1.0 | |
int progressPercent = downloader.Progress_Percent; // 0 - 100 | |
} | |
// All unfinished! | |
// Need to now unzip? | |
downloader.Unzip(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment