Ejemplo n.º 1
0
        private void PromptUpdateRootNotification()
        {
            TopMost = false;
            DialogResult dr = MessageBox.Show("更新成功,是否立即查看更新日志?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            Jnw.Common.AutoUpdate au = GetJnWCommonAutoUpdateInstance();
            if (dr == DialogResult.Yes)
            {
                au.OpenUpdateLog();
            }
            //如果有多个启动器,则打开最新的启动器
            var exe = Jnw.Common.FileHelper.GetFileNames(_winformPath, "KentCraft启动器 v*.exe", false);

            if (exe.Length > 1)
            {
                string newExe = "";
                foreach (var temp in exe)
                {
                    if (newExe == "" ||
                        Convert.ToInt32(temp.Substring((_winformPath + "KentCraft启动器 v").Length, 6)) >
                        Convert.ToInt32(newExe.Substring((_winformPath + "KentCraft启动器 v").Length, 6)))
                    {
                        newExe = temp;
                    }
                }
                au.OpenUpdate(newExe);
            }
            else
            {
                au.OpenUpdate("KentCraft.exe");//程序文件名
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 窗体加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void CheckUpdate_Load(object sender, EventArgs e, int type)
 {
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //解决极少部分系统(window server 2008R2 和极少部分win7)显示Could not create SSL/TLS secure channel
     Jnw.Common.AutoUpdate au = GetJnWCommonAutoUpdateInstance();
     au.KillProcess("KentCraft", true, false);
     //au.KillProcess("java", true);
     //au.KillProcess("javaw", true);
     //判断是否需要更新
     if (type == 1)
     {
         if (!au.CheckUpdate(_tipString))
         {
             NewestCallback newestCallback = new NewestCallback(delegate()
             {
                 au.OpenUpdate("KentCraft.exe");//程序文件名
                 Application.Exit();
             });
             newestCallback();
         }
     }
     else if (type == 2)
     {
         if (!au.CheckUpdate("192.168.1.1", "FileShare", "LoginAccount", "LoginPassword", _tipString))
         {
             NewestCallback newestCallback = new NewestCallback(() => Application.Exit());
             newestCallback();
         }
     }
 }
Ejemplo n.º 3
0
 protected virtual void btnCancel2_Click(object sender, EventArgs e)
 {
     PromptCancelMessageBox2(delegate()
     {
         Jnw.Common.AutoUpdate au = GetJnWCommonAutoUpdateInstance();
         au.OpenUpdate("KentCraft.exe");//程序文件名
         Application.Exit();
     });
 }