1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
-
- using System;
- using System.Windows.Forms;
- namespace AutomaticUpdate
- {
- static class Program
- {
-
-
-
- [STAThread]
- static void Main(string[] args)
- {
- if (args.Length > 0)
- {
- FormMain.KillPath = args[0].Replace("|"," ");
- if (args.Length > 1)
- {
- FormMain.InputCompressFilePath = args[1].Replace("|", " ");
- }
- }
- System.Threading.Thread.Sleep(1500);
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.ThreadException += Application_ThreadException;
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- Application.Run(new FormMain());
-
- }
- static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
- {
- Exception Exception = (Exception)e.ExceptionObject;
- MessageBox.Show("更新失败,请关闭正在运行的程序后重试。\r\n错误原因:" + Exception.Message);
-
-
-
-
- Application.ExitThread();
- Application.Exit();
- }
- static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
- {
- MessageBox.Show("更新失败,请关闭正在运行的程序后重试。\r\n错误原因:" + e.Exception.Message.ToString());
- Application.ExitThread();
- Application.Exit();
- }
- }
- }
|