[C#] a own Launcher in Work.
#11

you should use DownloadFileAsync else if the file is bigger u will have proplems

 

for exampel

 

void update()
{
WebClient Client = new WebClient();
Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(Client_DownloadProgressChanged);
Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);

// starting the download
Client.DownloadFileAsync(new Uri("http:/myadress/myfile.exe"), "myfile.exe");
}

// getting called if any change is there
void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Maximum = (int)e.TotalBytesToReceive;
progressBar1.Value = (int)e.BytesReceived;

// u also can make a label where the percent get showed
int percent = (int)(((double)progressBar1.Value / (double)progressBar1.Maximum) * 100);
Label1.text = percent.ToString() + " %";
}

// getting called when its done
void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Download done!");
}

 

and also in ur "Launcher" it download only the ".lod" file but the laucnehr download an ".zip" file what he extract and u also have always the same adress means he always download the same



Messages In This Thread
[No subject] - by Nikolee - 04-21-2012, 10:44 PM
[No subject] - by HateMe - 04-21-2012, 11:08 PM
[No subject] - by Nikolee - 04-21-2012, 11:12 PM
[No subject] - by HateMe - 04-21-2012, 11:20 PM
[No subject] - by Nikolee - 04-21-2012, 11:41 PM
[No subject] - by someone - 04-22-2012, 08:58 AM
[No subject] - by HateMe - 04-22-2012, 12:42 PM
[No subject] - by Nikolee - 04-22-2012, 02:06 PM
[No subject] - by Nikolee - 04-22-2012, 03:25 PM
[No subject] - by someone - 04-22-2012, 03:44 PM
[No subject] - by HateMe - 04-22-2012, 04:29 PM
[No subject] - by Nikolee - 04-22-2012, 04:45 PM
[No subject] - by HateMe - 04-22-2012, 05:20 PM
[No subject] - by Nikolee - 04-22-2012, 08:28 PM
[No subject] - by someone - 04-23-2012, 12:36 PM
[No subject] - by Nikolee - 04-23-2012, 02:38 PM
[No subject] - by HateMe - 04-23-2012, 03:18 PM
[No subject] - by Nikolee - 04-23-2012, 05:02 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)