From 06dd1db0a3bc947fd7f614077714b662a3807719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?iFish=28=E6=9C=A8=E9=B1=BC=29?= Date: Wed, 2 Mar 2016 01:26:52 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20#8=20=E5=A4=9A=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E5=9C=B0=E5=9D=80=E6=97=A0=E6=B3=95=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=97=A0=E6=B3=95=E7=BB=A7=E7=BB=AD=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultiServerUpdater.cs | 16 ++++------------ SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs b/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs index 5cedd40..7552bd6 100644 --- a/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs +++ b/SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs @@ -79,22 +79,14 @@ bool PeekNextServer() /// protected override void OnError() { - var ex = Context.Exception; - - if (ex is WebException) + if (PeekNextServer()) { - if (PeekNextServer()) - { - Trace.TraceWarning("尝试更新时出现服务器错误,且服务器已遍历完成。"); - } - else - { - Trace.TraceWarning("尝试更新时出现服务器错误。正尝试自动切换至其它的服务器节点。已切换至 " + Context.UpdateDownloadUrl); - base.BeginCheckUpdateInProcess(); - } + Trace.TraceWarning("尝试更新时出现服务器错误。正尝试自动切换至其它的服务器节点。已切换至 " + Context.UpdateDownloadUrl); + base.BeginCheckUpdateInProcess(); } else { + Trace.TraceWarning("尝试更新时出现服务器错误,且服务器已遍历完成。"); base.OnError(); } } diff --git a/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs b/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs index 5c08e00..cb99e2c 100644 --- a/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs +++ b/SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs @@ -249,6 +249,8 @@ void DownloadUpdateInfoInternal(object sender, RunworkEventArgs e) //等待下载完成 wHandler.WaitOne(); } + if (ex != null) throw ex; + Trace.TraceInformation("服务器返回数据----->" + (data == null ? "" : data.Length.ToString() + "字节")); if (data != null && data.Length > 0x10) { @@ -267,8 +269,6 @@ void DownloadUpdateInfoInternal(object sender, RunworkEventArgs e) throw new ApplicationException("服务器返回了不正确的更新结果"); } - - if (ex != null) throw ex; } e.PostEvent(OnDownloadUpdateInfoFinished); if ((Context.UpdateInfo = XMLSerializeHelper.XmlDeserializeFromString(Context.UpdateInfoTextContent)) == null)