首页 > 技术文章 > 自动更新

lhlong 2016-02-01 10:44 原文

Dll :  AutoUpdate.dll

 

配置文件

        /// <summary>
        /// 自动更新检测及更新
        /// </summary>
        private void updJudge()
        {
            try
            {

       
                AutoUpdate.AppUpdater ft = new AutoUpdate.AppUpdater();

                //检测到可更新个数
                var fdsaf = ft.CheckForUpdate();

                //大于0则为直接更新,小于0为不需要更新
                if (ft.CheckForUpdate() > 0)
                {


                    string filename = "AutoUpdate.exe";
                    //更新文件与程序文件所在一个目录

                    System.Diagnostics.Process Proc;
                    Proc = new Process();
                    Proc.StartInfo.FileName = filename;
                    Proc.Start();
                   
                    MsgBoxExp.LogInfo("程序自动升级成功!", this.GetType());
                    Application.Current.Shutdown();

                }
                else
                {
                       //不用更新
                }


            }
            catch (Exception ex)
            {

                MsgBoxExp.LogErrorFormat("程序自动升级错误,详细:{0}", ex.Message, this.GetType());
            }
        }

  

推荐阅读