Example #1
0
		/// <summary>
		/// 下载最新更新至临时文件夹
		/// </summary>
		/// <returns>新文件的完整路径</returns>
		public static string DownloadUpdate(UpdateInformation updateInfo)
		{
			try
			{
				string filename = Path.Combine(
						CoreManager.StartupPath,
						"Update" + Path.DirectorySeparatorChar + "AcDown" + updateInfo.NewVersion.ToString() + ".exe");
				//下载文件
				Network.DownloadFile(new DownloadParameter()
				{
					Url = updateInfo.Url,
					FilePath = filename,
					Referer = @"http://acdown.codeplex.com/wikipage?title=AutoUpdate&referringTitle=For%20Developer",
					UserAgent = @"Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0"
				});
				return filename;
			}
			catch
			{
				return "";
			}
		}
Example #2
0
 /// <summary>
 /// 下载最新更新至临时文件夹
 /// </summary>
 /// <returns>新文件的完整路径</returns>
 public static string DownloadUpdate(UpdateInformation updateInfo)
 {
     try
     {
         string filename = Path.Combine(
             CoreManager.StartupPath,
             "Update" + Path.DirectorySeparatorChar + "AcDown" + updateInfo.NewVersion.ToString() + ".exe");
         //下载文件
         Network.DownloadFile(new DownloadParameter()
         {
             Url       = updateInfo.Url,
             FilePath  = filename,
             Referer   = @"http://acdown.codeplex.com/wikipage?title=AutoUpdate&referringTitle=For%20Developer",
             UserAgent = @"Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0"
         });
         return(filename);
     }
     catch
     {
         return("");
     }
 }
Example #3
0
		/// <summary>
		/// 检查是否有软件更新
		/// </summary>
		private void CheckUpdate()
		{
			toolUpdate.Visible = false;
			ThreadPool.QueueUserWorkItem(new WaitCallback((o) =>
			{
				haveupdate = Updater.CheckUpdate();
				if (haveupdate.NewVersion > new Version(Application.ProductVersion))
				{
					this.Invoke(new MethodInvoker(() =>
					{
						toolUpdate.Visible = true;
						notifyIcon.ShowBalloonTip(10000, "保持AcDown在最新状态!", "AcDown有新版本了哦~\n使用最新版本有助于减少解析错误发生的概率\n请点击主界面上方的“更新AcDown”按钮进行更新", ToolTipIcon.Info);
					}));
				}
			}));
		}