public void Check() { this.mStatus = CheckUpdateStatus.FAILED; foreach (string URL in this.URLs) { try { WebClient o = new WebClient(); foreach (KeyValuePair<string, string> kvp in this.Items) { o.QueryString.Add(kvp.Key, kvp.Value); } this.Message = o.DownloadString(URL); if (this.Message.Length == 0) { this.Message = Translator.Instance.T("网络通讯错误!"); this.mStatus = CheckUpdateStatus.FAILED; } else if (this.Message.StartsWith("400")) { this.Message = this.Message.Substring(3).Trim(); this.mStatus = CheckUpdateStatus.FAILED; } else if (this.Message.StartsWith("200")) { this.Message = this.Message.Substring(3).Trim(); this.mStatus = CheckUpdateStatus.NOUPDATE; } else { this.mStatus = CheckUpdateStatus.NEW; } break; } catch (Exception e) { this.Message = e.Message; this.mStatus = CheckUpdateStatus.FAILED; } } if (this.mQuiet == false) { //MessageBox.Show(this.Message, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, (this.Status == CheckUpdateStatus.FAILED) ? MessageBoxIcon.Error : MessageBoxIcon.Information); } else { if (this.Status == CheckUpdateStatus.NEW) { //MessageBox.Show(this.Message, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public void Check() { this.mStatus = CheckUpdateStatus.FAILED; foreach (string URL in this.URLs) { try { WebClient o = new WebClient(); foreach (KeyValuePair <string, string> kvp in this.Items) { o.QueryString.Add(kvp.Key, kvp.Value); } this.Message = o.DownloadString(URL); if (this.Message.Length == 0) { this.Message = Translator.Instance.T("网络通讯错误!"); this.mStatus = CheckUpdateStatus.FAILED; } else if (this.Message.StartsWith("400")) { this.Message = this.Message.Substring(3).Trim(); this.mStatus = CheckUpdateStatus.FAILED; } else if (this.Message.StartsWith("200")) { this.Message = this.Message.Substring(3).Trim(); this.mStatus = CheckUpdateStatus.NOUPDATE; } else { this.mStatus = CheckUpdateStatus.NEW; } break; } catch (Exception e) { this.Message = e.Message; this.mStatus = CheckUpdateStatus.FAILED; } } if (this.mQuiet == false) { //MessageBox.Show(this.Message, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, (this.Status == CheckUpdateStatus.FAILED) ? MessageBoxIcon.Error : MessageBoxIcon.Information); } else { if (this.Status == CheckUpdateStatus.NEW) { //MessageBox.Show(this.Message, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }