#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@stripped
311 Reggie Burnett 2011-02-07
added some timeouts and error handling to the updater tool
modified:
WexInstallerUpdater/MainForm.cs
WexInstallerUpdater/MirroredWebClient.cs
=== modified file 'WexInstallerUpdater/MainForm.cs'
=== modified file 'WexInstallerUpdater/MainForm.cs'
--- a/WexInstallerUpdater/MainForm.cs 2011-02-01 17:53:34 +0000
+++ b/WexInstallerUpdater/MainForm.cs 2011-02-07 23:27:23 +0000
@@ -65,17 +65,30 @@
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
webClient.DownloadFailed += new EventHandler(client_DownloadFailed);
tempFile = Path.GetTempFileName().Replace(".tmp", ".exe");
+
+ killProcessTimer.Tick += new EventHandler(downloadUpdate_TimedOut);
+ killProcessTimer.Interval = 30000;
+ killProcessTimer.Enabled = true;
+
webClient.DownloadFileAsync(manifest.UpdateUrl, tempFile);
}
+ void downloadUpdate_TimedOut(object sender, EventArgs e)
+ {
+ client_DownloadFailed(null, EventArgs.Empty);
+ }
+
void client_DownloadFailed(object sender, EventArgs e)
{
+ killProcessTimer.Enabled = false;
DownloadFailedEventArgs args = e as DownloadFailedEventArgs;
-
+ MessageBox.Show("There was an error downloading the update. Please contact support.");
+ Close();
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
+ killProcessTimer.Enabled = false;
if (e.Cancelled)
{
MessageBox.Show("The update has been cancelled");
@@ -89,6 +102,8 @@
else
{
client = null;
+ killProcessTimer.Interval = 250;
+ killProcessTimer.Tick += new EventHandler(killProcessTimer_Tick);
killProcessTimer.Enabled = true;
}
}
@@ -97,6 +112,8 @@
{
downloadProgress.Maximum = 100;
downloadProgress.Value = e.ProgressPercentage;
+ killProcessTimer.Stop();
+ killProcessTimer.Start();
}
private void Install()
@@ -110,8 +127,7 @@
label1.Text = "Installing...";
downloadProgress.Value = 0;
- ProcessStartInfo psi = new ProcessStartInfo();
- psi.FileName = tempFile;
+ ProcessStartInfo psi = new ProcessStartInfo("msiexec.exe", "/i " + tempFile);
Process.Start(psi);
Close();
}
=== modified file 'WexInstallerUpdater/MirroredWebClient.cs'
--- a/WexInstallerUpdater/MirroredWebClient.cs 2011-02-01 17:53:34 +0000
+++ b/WexInstallerUpdater/MirroredWebClient.cs 2011-02-07 23:27:23 +0000
@@ -68,7 +68,8 @@
return;
}
- if (r.IP.Count == 0)
+ if (r.IP.Count == 0 ||
+ (r.IP[0].Mirrors.Count == 0 && String.IsNullOrEmpty(r.IP[0].Archive)))
{
OnDownloadFailed(new InvalidOperationException("No mirrors found for the given file"));
return;
Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110207232723-gro6ft7he4q3cwjs.bundle
| Thread |
|---|
| • bzr commit into wex-installer-1.0 branch (reggie.burnett:311) | Reggie Burnett | 8 Feb |