private void updateStatus(int currentLocation)
{
this.lastLocation = currentLocation;
string uploadRate = "";
if (this.showSpeed) {
int bytesTransfered = currentLocation - this.lastLocation;
double bytesPerSecond = Math.Round(this.percentage(currentLocation) / 100d * (double)this.filesize) / ((double)this.speedTimer.ElapsedMilliseconds / 1000d);
double uploadRateBps = Math.Round(bytesPerSecond, 2);
double uploadRateKBps = Math.Round(uploadRateBps / 1024, 2);
double uploadRateMBps = Math.Round(uploadRateKBps / 1024, 2);
uploadRate = uploadRateBps + " B/s";
if (uploadRateBps > 1024)
uploadRate = uploadRateKBps + " KB/s";
if (uploadRateKBps > 1024)
uploadRate = uploadRateMBps + " MB/s";
}
this.Form.Text = this.filename + " - " + this.percentage(currentLocation, 0) + "%" + (this.showSpeed ? " - " + uploadRate : "");
int percVal = (int)this.percentage(currentLocation);
this.Form.progressBar.Value = percVal + 1; // First set it to it's value + 1 to bypass the Aero animation
this.Form.progressBar.Value = percVal;
}